From e839116e5c583a82d145e5dca336964e6569d487 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 20 Feb 2024 18:30:42 +0700 Subject: fix(tvix/eval): make path resolution work by default in impure mode The previous behaviour (enabling `import`, but not allowing e.g. `` to resolve) was very confusing. Now imports from NIX_PATH become enabled by default, unless the user already overrode that behaviour with something else by setting `Evaluation::nix_path` manually. Change-Id: Iad970beb633d9887be4b185b01e6f5858d81bea3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10993 Reviewed-by: flokli Autosubmit: tazjin Tested-by: BuildkiteCI --- tvix/eval/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tvix/eval/src') diff --git a/tvix/eval/src/lib.rs b/tvix/eval/src/lib.rs index 9c298df60a..8ce37de427 100644 --- a/tvix/eval/src/lib.rs +++ b/tvix/eval/src/lib.rs @@ -171,6 +171,12 @@ impl<'co, 'ro> Evaluation<'co, 'ro, Box> { self.io_handle = io.unwrap_or_else(|| Box::new(StdIO) as Box); self.enable_import = true; self.builtins.extend(builtins::impure_builtins()); + + // Make `NIX_PATH` resolutions work by default, unless the + // user already overrode this with something else. + if self.nix_path.is_none() { + self.nix_path = std::env::var("NIX_PATH").ok(); + } } #[cfg(feature = "impure")] -- cgit 1.4.1