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-14T12·45+0300
committertazjin <tazjin@tvl.su>2023-01-17T10·31+0000
commit499e72c1cba8f7aa0415d3d8b93c57ca98457635 (patch)
treec53a7eae4120c4a3c05e49831f11d8fdb38a9525 /tvix/cli/src/main.rs
parent9cb3daee20ad68f6d8351f116d50da789d3f1daf (diff)
feat(tvix/cli): track known plain paths in NixCompatIO r/5672
When adding things to a C++ Nix store, ensure that the path is tracked
in the tracker.

Since the mechanism for propagating the tracker instance isn't
finalised yet, I've opted to take an Rc<RefCell> parameter for it. How
exactly that ends up there is going to become clear in the next
commits, but for now it's just instantiated in main with
Default::default.

Change-Id: I90f0b44f2d4f292dedc98ff1aa39041d279b61fd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7833
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/cli/src/main.rs')
-rw-r--r--tvix/cli/src/main.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/tvix/cli/src/main.rs b/tvix/cli/src/main.rs
index 42297d365b..242cece9ec 100644
--- a/tvix/cli/src/main.rs
+++ b/tvix/cli/src/main.rs
@@ -2,9 +2,12 @@ mod known_paths;
 mod nix_compat;
 mod refscan;
 
+use std::cell::RefCell;
+use std::rc::Rc;
 use std::{fs, path::PathBuf};
 
 use clap::Parser;
+use known_paths::KnownPaths;
 use rustyline::{error::ReadlineError, Editor};
 use tvix_eval::observer::{DisassemblingObserver, TracingObserver};
 use tvix_eval::Value;
@@ -48,7 +51,9 @@ struct Args {
 /// evaluation succeeded.
 fn interpret(code: &str, path: Option<PathBuf>, args: &Args, explain: bool) -> bool {
     let mut eval = tvix_eval::Evaluation::new_impure(code, path);
-    eval.io_handle = Box::new(nix_compat::NixCompatIO::new());
+    let known_paths: Rc<RefCell<KnownPaths>> = Default::default();
+
+    eval.io_handle = Box::new(nix_compat::NixCompatIO::new(known_paths));
     eval.nix_path = args.nix_search_path.clone();
 
     let source_map = eval.source_map();