diff --git a/tvix/eval/src/builtins/impure.rs b/tvix/eval/src/builtins/impure.rs index 3438aa06f..41e3805b2 100644 --- a/tvix/eval/src/builtins/impure.rs +++ b/tvix/eval/src/builtins/impure.rs @@ -1,7 +1,26 @@ -use crate::value::Builtin; +use std::{ + collections::BTreeMap, + time::{SystemTime, UNIX_EPOCH}, +}; + +use smol_str::SmolStr; + +use crate::{ + value::{Builtin, NixString}, + Value, +}; + +fn impure_builtins() -> Vec { + vec![] +} /// Return all impure builtins, that is all builtins which may perform I/O outside of the VM and so /// cannot be used in all contexts (e.g. WASM). -pub(super) fn builtins() -> Vec { - vec![] +pub(super) fn builtins() -> BTreeMap { + let mut map: BTreeMap = impure_builtins() + .into_iter() + .map(|b| (b.name().into(), Value::Builtin(b))) + .collect(); + + map } diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index cd4200a13..848ac9e25 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -3,12 +3,10 @@ //! See //tvix/eval/docs/builtins.md for a some context on the //! available builtins in Nix. -use std::{ - cmp, - collections::{BTreeMap, HashMap}, - path::PathBuf, - rc::Rc, -}; +use std::cmp; +use std::collections::{BTreeMap, HashMap}; +use std::path::PathBuf; +use std::rc::Rc; use crate::{ errors::ErrorKind, @@ -385,7 +383,7 @@ fn builtins_set() -> NixAttrs { add_builtins(pure_builtins()); #[cfg(feature = "impure")] { - add_builtins(impure::builtins()); + map.extend(impure::builtins()); } NixAttrs::from_map(map)