about summary refs log tree commit diff
path: root/tvix/cli/src/main.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-01-22T22·44+0300
committertazjin <tazjin@tvl.su>2023-01-27T12·21+0000
commit8a9aa018dcf54f00344993c8467610be3442eb8f (patch)
treea46fad927107961cf9a7087db259efe56c7e88ff /tvix/cli/src/main.rs
parent3d7c371e2208c6171a70c0b0485fcd7e6ea6d47b (diff)
feat(tvix/cli): implement builtins.derivationStrict r/5768
Implements the logic for converting an evaluator value supplied as
arguments to builtins.derivationStrict into an actual,
fully-functional derivation struct.

This skips the implementation of structuredAttrs, which are left for a
subsequent commit.

Note: We will need to port some eval tests over to CLI to test this
correct, which will be done in a separate commit later on.

Change-Id: I0db69dcf12716180de0eb0b126e3da4683712966
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7756
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/cli/src/main.rs')
-rw-r--r--tvix/cli/src/main.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/tvix/cli/src/main.rs b/tvix/cli/src/main.rs
index 0150d83bc6b4..552b8e941c55 100644
--- a/tvix/cli/src/main.rs
+++ b/tvix/cli/src/main.rs
@@ -12,7 +12,7 @@ use clap::Parser;
 use known_paths::KnownPaths;
 use rustyline::{error::ReadlineError, Editor};
 use tvix_eval::observer::{DisassemblingObserver, TracingObserver};
-use tvix_eval::Value;
+use tvix_eval::{Builtin, BuiltinArgument, Value, VM};
 
 #[derive(Parser)]
 struct Args {
@@ -55,8 +55,10 @@ fn interpret(code: &str, path: Option<PathBuf>, args: &Args, explain: bool) -> b
     let mut eval = tvix_eval::Evaluation::new_impure(code, path);
     let known_paths: Rc<RefCell<KnownPaths>> = Default::default();
 
-    eval.io_handle = Box::new(nix_compat::NixCompatIO::new(known_paths));
+    eval.io_handle = Box::new(nix_compat::NixCompatIO::new(known_paths.clone()));
     eval.nix_path = args.nix_search_path.clone();
+    eval.builtins
+        .extend(derivation::derivation_builtins(known_paths));
 
     let source_map = eval.source_map();
     let result = {