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-05-17T15·33+0300
committertazjin <tazjin@tvl.su>2023-05-18T19·12+0000
commitba4807e1de44a234fc9499dad0011440cde113fb (patch)
tree938107dbb5da42d2146221e63003dc68c89f3b29 /tvix/cli/src/main.rs
parent7f99eb44a5c734dba27682025f0dbdc253a7cabd (diff)
refactor(tvix/cli): split CLI-specific IO logic into TvixIO type r/6159
This adds a wrapper type TvixIO<T: EvalIO>, which can wrap around an
arbitrary EvalIO implementation and perform actions needed for the
Tvix CLI (marking imported paths as known, and handling __corepkgs__).

Change-Id: I5fc1ca199b9f94b21a89103b84575e0f8f58dff9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8579
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/cli/src/main.rs')
-rw-r--r--tvix/cli/src/main.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/tvix/cli/src/main.rs b/tvix/cli/src/main.rs
index 99b5b451f56c..9a81cff50863 100644
--- a/tvix/cli/src/main.rs
+++ b/tvix/cli/src/main.rs
@@ -3,6 +3,7 @@ mod errors;
 mod known_paths;
 mod nix_compat;
 mod refscan;
+mod tvix_io;
 
 use std::cell::RefCell;
 use std::rc::Rc;
@@ -62,7 +63,10 @@ fn interpret(code: &str, path: Option<PathBuf>, args: &Args, explain: bool) -> b
     let known_paths: Rc<RefCell<KnownPaths>> = Default::default();
 
     eval.strict = args.strict;
-    eval.io_handle = Box::new(nix_compat::NixCompatIO::new(known_paths.clone()));
+    eval.io_handle = Box::new(tvix_io::TvixIO::new(
+        known_paths.clone(),
+        nix_compat::NixCompatIO::new(),
+    ));
 
     // bundle fetchurl.nix (used in nixpkgs) by resolving <nix> to
     // `/__corepkgs__`, which has special handling in [`nix_compat`].