about summary refs log tree commit diff
path: root/tvix/glue/src/lib.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-11-03T12·03+0200
committerclbot <clbot@tvl.fyi>2023-11-04T15·18+0000
commita72a1044c29ce41973e0cf81bcee04923f21995f (patch)
treefd4025cafbbc0e55d8c3256eff599f98ff543dbb /tvix/glue/src/lib.rs
parent619f1fe88d009e228cfd348da12b98f6a4533052 (diff)
refactor(tvix/glue): move nix_path handling to helper in tvix-glue r/6938
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
Diffstat (limited to 'tvix/glue/src/lib.rs')
-rw-r--r--tvix/glue/src/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/tvix/glue/src/lib.rs b/tvix/glue/src/lib.rs
index acb81d31445f..760e730217ee 100644
--- a/tvix/glue/src/lib.rs
+++ b/tvix/glue/src/lib.rs
@@ -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()));
+}