about summary refs log tree commit diff
path: root/tvix/eval/src/eval.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/eval/src/eval.rs')
-rw-r--r--tvix/eval/src/eval.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/tvix/eval/src/eval.rs b/tvix/eval/src/eval.rs
index 7b7d3983d4ec..aed4292282b9 100644
--- a/tvix/eval/src/eval.rs
+++ b/tvix/eval/src/eval.rs
@@ -58,12 +58,21 @@ pub fn interpret(code: &str, location: Option<PathBuf>, options: Options) -> Eva
         println!("{:?}", root_expr);
     }
 
+    // TODO: encapsulate this import weirdness in builtins
+    let mut builtins = global_builtins();
+
+    #[cfg(feature = "impure")]
+    builtins.insert(
+        "import",
+        Value::Builtin(crate::builtins::impure::builtins_import(source.clone())),
+    );
+
     let result = if options.dump_bytecode {
         crate::compiler::compile(
             &root_expr,
             location,
             file.clone(),
-            global_builtins(),
+            builtins,
             &mut DisassemblingObserver::new(source.clone(), std::io::stderr()),
         )
     } else {
@@ -71,7 +80,7 @@ pub fn interpret(code: &str, location: Option<PathBuf>, options: Options) -> Eva
             &root_expr,
             location,
             file.clone(),
-            global_builtins(),
+            builtins,
             &mut NoOpObserver::default(),
         )
     }?;