diff options
author | Vincent Ambo <tazjin@tvl.su> | 2024-02-20T11·30+0700 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-02-20T12·13+0000 |
commit | e839116e5c583a82d145e5dca336964e6569d487 (patch) | |
tree | 1686b375620f1c9f59afa6ebfae0f1c8bf1f947c /tvix/eval/src | |
parent | f40ff1737e829fb98a01951794eb1f3624cd3cad (diff) |
fix(tvix/eval): make path resolution work by default in impure mode r/7574
The previous behaviour (enabling `import`, but not allowing e.g. `<nixpkgs/lib>` 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 <flokli@flokli.de> Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src')
-rw-r--r-- | tvix/eval/src/lib.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tvix/eval/src/lib.rs b/tvix/eval/src/lib.rs index 9c298df60a8f..8ce37de42732 100644 --- a/tvix/eval/src/lib.rs +++ b/tvix/eval/src/lib.rs @@ -171,6 +171,12 @@ impl<'co, 'ro> Evaluation<'co, 'ro, Box<dyn EvalIO>> { self.io_handle = io.unwrap_or_else(|| Box::new(StdIO) as Box<dyn EvalIO>); 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")] |