fix(tvix/eval): make path resolution work by default in impure mode

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
This commit is contained in:
Vincent Ambo 2024-02-20 18:30:42 +07:00 committed by clbot
parent f40ff1737e
commit e839116e5c

View file

@ -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")]