From f5c6acbbeb21ae36255ff03015d94000d4fc0030 Mon Sep 17 00:00:00 2001 From: Aspen Smith Date: Sat, 10 Aug 2024 15:13:29 -0400 Subject: [PATCH] fix(tvix/cli): always configure nix path Configure the nix path even if globals is already set. Change-Id: I6598c92ab40ff952f73da04d9e7d3aeb13c16b53 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12176 Tested-by: BuildkiteCI Autosubmit: aspen Reviewed-by: Ilan Joselevich --- tvix/cli/src/lib.rs | 2 +- tvix/cli/tests/repl.rs | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tvix/cli/src/lib.rs b/tvix/cli/src/lib.rs index 2351da13a..060665480 100644 --- a/tvix/cli/src/lib.rs +++ b/tvix/cli/src/lib.rs @@ -113,9 +113,9 @@ pub fn evaluate( eval_builder = add_derivation_builtins(eval_builder, Rc::clone(&tvix_store_io)); eval_builder = add_fetcher_builtins(eval_builder, Rc::clone(&tvix_store_io)); eval_builder = add_import_builtins(eval_builder, tvix_store_io); - eval_builder = configure_nix_path(eval_builder, &args.nix_search_path); } }; + eval_builder = configure_nix_path(eval_builder, &args.nix_search_path); if let Some(source_map) = source_map { eval_builder = eval_builder.with_source_map(source_map); diff --git a/tvix/cli/tests/repl.rs b/tvix/cli/tests/repl.rs index c66443309..7b9b9e345 100644 --- a/tvix/cli/tests/repl.rs +++ b/tvix/cli/tests/repl.rs @@ -9,7 +9,11 @@ macro_rules! test_repl { #[test] fn $name() { let tokio_runtime = tokio::runtime::Runtime::new().unwrap(); - let args = tvix_cli::Args::parse_from(Vec::::new()); + let args = tvix_cli::Args::parse_from(vec![ + OsString::from("tvix"), + OsString::from("--nix-search-path"), + OsString::from("nixpkgs=/tmp"), + ]); let mut repl = tvix_cli::Repl::new(init_io_handle(&tokio_runtime, &args), &args); $({ let result = repl.send($send.into()); @@ -83,3 +87,12 @@ test_repl!(explain() { => a 2-item attribute set "#]]; }); + +test_repl!(reference_nix_path() { + "" => expect![[r#" + => /tmp :: path + "#]]; + "" => expect![[r#" + => /tmp :: path + "#]]; +});