about summary refs log tree commit diff
path: root/tvix/cli/src/main.rs
diff options
context:
space:
mode:
authorAspen Smith <root@gws.fyi>2024-02-19T15·17-0500
committerclbot <clbot@tvl.fyi>2024-02-19T16·51+0000
commit0db46dacea88bc15f06d586bee7acf2f50645f0a (patch)
tree696e6cb26777f9af85f539d5f231c408c940f222 /tvix/cli/src/main.rs
parentb1474529480fc9c36dedaca8ba640c11c64ad3ab (diff)
feat(tvix/glue): Init fetcher builtins r/7557
Initialize a new empty builtins module `fetcher_builtins`, which will
contain the builtins which fetch URLs from the internet:

* fetchurl
* fetchGit
* fetchTarball
* fetchTree (maybe? this is experimental)

These builtins are all implemented in CPP nix at:
https://github.com/NixOS/nix/blob/2.20.2/src/libexpr/primops/fetchTree.cc

These builtins are added to the evaluation context using a similar
mechanism to the derivation builtins, and have been added everywhere
derivation builtins were previously being added.

Change-Id: I133b91cc9560f23028621414537f712e7bd8a825
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10974
Autosubmit: aspen <root@gws.fyi>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/cli/src/main.rs')
-rw-r--r--tvix/cli/src/main.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/tvix/cli/src/main.rs b/tvix/cli/src/main.rs
index 24b180c1f289..65f5d5363c1d 100644
--- a/tvix/cli/src/main.rs
+++ b/tvix/cli/src/main.rs
@@ -9,6 +9,7 @@ use tvix_build::buildservice;
 use tvix_eval::builtins::impure_builtins;
 use tvix_eval::observer::{DisassemblingObserver, TracingObserver};
 use tvix_eval::{EvalIO, Value};
+use tvix_glue::builtins::add_fetcher_builtins;
 use tvix_glue::tvix_io::TvixIO;
 use tvix_glue::tvix_store_io::TvixStoreIO;
 use tvix_glue::{builtins::add_derivation_builtins, configure_nix_path};
@@ -128,7 +129,8 @@ fn interpret(code: &str, path: Option<PathBuf>, args: &Args, explain: bool) -> b
     );
     eval.strict = args.strict;
     eval.builtins.extend(impure_builtins());
-    add_derivation_builtins(&mut eval, tvix_store_io);
+    add_derivation_builtins(&mut eval, Rc::clone(&tvix_store_io));
+    add_fetcher_builtins(&mut eval, tvix_store_io);
     configure_nix_path(&mut eval, &args.nix_search_path);
 
     let source_map = eval.source_map();