about summary refs log tree commit diff
path: root/tvix/cli
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-12-09T10·33+0300
committertazjin <tazjin@tvl.su>2022-12-21T13·23+0000
commit60d9fba56d12279157e62c6df60b421ec116c8ee (patch)
treecae3342868ab4091e4e451314647d9c26c8804d6 /tvix/cli
parent36eaa9b3b379e11fe611bdd74f88eb6095ccc8cd (diff)
chore(tvix/cli): re-add NIX_PATH handling r/5448
Change-Id: I5595d6f5141ed4a533ca44a46264dc604fca6be1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7549
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'tvix/cli')
-rw-r--r--tvix/cli/src/main.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/tvix/cli/src/main.rs b/tvix/cli/src/main.rs
index 5604e1a83fdd..897c31570ac0 100644
--- a/tvix/cli/src/main.rs
+++ b/tvix/cli/src/main.rs
@@ -12,6 +12,10 @@ struct Args {
     #[clap(long, short = 'E')]
     expr: Option<String>,
 
+    /// A colon-separated list of directories to use to resolve `<...>`-style paths
+    #[clap(long, short = 'I', env = "NIX_PATH")]
+    nix_search_path: Option<String>,
+
     /// Print "raw" (unquoted) output.
     #[clap(long)]
     raw: bool,
@@ -21,7 +25,9 @@ struct Args {
 /// and the result itself. The return value indicates whether
 /// evaluation succeeded.
 fn interpret(code: &str, path: Option<PathBuf>, args: &Args) -> bool {
-    let eval = tvix_eval::Evaluation::new(code, path);
+    let mut eval = tvix_eval::Evaluation::new(code, path);
+    eval.nix_path = args.nix_search_path.clone();
+
     let source_map = eval.source_map();
     let result = eval.evaluate();