refactor(tvix/glue): move nix_path handling to helper in tvix-glue

Change-Id: I2327560c4cf0d3f90e253e3c2f47cb29c762461e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9910
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2023-11-03 14:03:19 +02:00 committed by clbot
parent 619f1fe88d
commit a72a1044c2
3 changed files with 14 additions and 11 deletions

View file

@ -26,3 +26,13 @@ pub fn add_derivation_builtins(
eval.src_builtins
.push(("derivation", include_str!("derivation.nix")));
}
/// Tell the Evaluator to resolve <nix> to the path `/__corepkgs__`,
/// which has special handling in [tvix_io::TvixIO].
/// This is used in nixpkgs to import `fetchurl.nix` from `<nix>`.
pub fn configure_nix_path(eval: &mut tvix_eval::Evaluation, nix_search_path: &Option<String>) {
eval.nix_path = nix_search_path
.as_ref()
.map(|p| format!("nix=/__corepkgs__:{}", p))
.or_else(|| Some("nix=/__corepkgs__".to_string()));
}