From 7c92b07efd6d3a183c2b6970102647fea08fc49a Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Tue, 28 Dec 2021 14:29:30 +0100 Subject: [PATCH] feat(tvix): set up cargo rust project First steps for baba Change-Id: Id6a68c5630cb85f280f4dcc7b2acf10c02454fd6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/4732 Tested-by: BuildkiteCI Reviewed-by: tazjin --- tvix/.envrc | 10 ++++++++++ tvix/.gitignore | 3 +++ tvix/.vscode/extensions.json | 8 ++++++++ tvix/Cargo.lock | 7 +++++++ tvix/Cargo.toml | 10 ++++++++++ tvix/default.nix | 2 ++ tvix/shell.nix | 10 ++++++++++ tvix/src/bin/nix-store.rs | 3 +++ tvix/src/main.rs | 3 +++ 9 files changed, 56 insertions(+) create mode 100644 tvix/.envrc create mode 100644 tvix/.gitignore create mode 100644 tvix/.vscode/extensions.json create mode 100644 tvix/Cargo.lock create mode 100644 tvix/Cargo.toml create mode 100644 tvix/default.nix create mode 100644 tvix/shell.nix create mode 100644 tvix/src/bin/nix-store.rs create mode 100644 tvix/src/main.rs diff --git a/tvix/.envrc b/tvix/.envrc new file mode 100644 index 000000000..ea1ec94e4 --- /dev/null +++ b/tvix/.envrc @@ -0,0 +1,10 @@ +source_env ../.envrc + +if type lorri &>/dev/null; then + echo "direnv: using lorri from PATH ($(type -p lorri))" + eval "$(lorri direnv)" +else + # fall back to using direnv's builtin nix support + # to prevent bootstrapping problems. + use nix +fi diff --git a/tvix/.gitignore b/tvix/.gitignore new file mode 100644 index 000000000..f807dfa42 --- /dev/null +++ b/tvix/.gitignore @@ -0,0 +1,3 @@ +/target +/result-* +/result diff --git a/tvix/.vscode/extensions.json b/tvix/.vscode/extensions.json new file mode 100644 index 000000000..dd7012c10 --- /dev/null +++ b/tvix/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + "recommendations": [ + "matklad.rust-analyzer" + ], + "unwantedRecommendations": [ + "rust-lang.rust" + ] +} diff --git a/tvix/Cargo.lock b/tvix/Cargo.lock new file mode 100644 index 000000000..75581ea7d --- /dev/null +++ b/tvix/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "tvix" +version = "0.1.0" diff --git a/tvix/Cargo.toml b/tvix/Cargo.toml new file mode 100644 index 000000000..2a59a77ea --- /dev/null +++ b/tvix/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "tvix" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + + +[[bin]] +name = "nix-store" diff --git a/tvix/default.nix b/tvix/default.nix new file mode 100644 index 000000000..82cd87cda --- /dev/null +++ b/tvix/default.nix @@ -0,0 +1,2 @@ +{...}: +{} diff --git a/tvix/shell.nix b/tvix/shell.nix new file mode 100644 index 000000000..600d96d76 --- /dev/null +++ b/tvix/shell.nix @@ -0,0 +1,10 @@ +let + depot = (import ./.. {}); + pkgs = depot.third_party.nixpkgs; + +in pkgs.mkShell { + buildInputs = [ + pkgs.rustup + pkgs.rust-analyzer + ]; +} diff --git a/tvix/src/bin/nix-store.rs b/tvix/src/bin/nix-store.rs new file mode 100644 index 000000000..7bf5442cb --- /dev/null +++ b/tvix/src/bin/nix-store.rs @@ -0,0 +1,3 @@ +fn main () { + println!("hello, nix"); +} diff --git a/tvix/src/main.rs b/tvix/src/main.rs new file mode 100644 index 000000000..40086e6f2 --- /dev/null +++ b/tvix/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, tvix!"); +}