diff options
author | Ryan Lahfa <tvl@lahfa.xyz> | 2024-01-16T04·31+0100 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-01-18T14·28+0000 |
commit | 12ae96cff2e925f502cee8afb4f8dcf54aba27d8 (patch) | |
tree | 661f8bf7401b524d9ac3dc6770eddd10b3bdb4d7 /tvix/glue/src/builtins/derivation.rs | |
parent | 43b9e25025eef302369ff27074bfa5bbfb1c7115 (diff) |
feat(tvix/glue): use TvixStoreIO as derivation builtin state r/7410
We propagate a `TvixStoreIO` as the `state` of our derivation-specific builtins in the glue crate. The evaluators `io_handle` itself is using a Rc<dyn EvalIO>. An earlier version of TvixStoreIO was also introducing generics over the different internal services themselves, but we opted for instead hardcoding this to Arc<dyn …> for the sake of less macro voodoo. Change-Id: I535c476f06b840858fa3070c4a237ece47f7a15b Reviewed-on: https://cl.tvl.fyi/c/depot/+/10636 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Autosubmit: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/glue/src/builtins/derivation.rs')
-rw-r--r-- | tvix/glue/src/builtins/derivation.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tvix/glue/src/builtins/derivation.rs b/tvix/glue/src/builtins/derivation.rs index c5ed8ec2fffe..180567b8c4a8 100644 --- a/tvix/glue/src/builtins/derivation.rs +++ b/tvix/glue/src/builtins/derivation.rs @@ -1,10 +1,9 @@ //! Implements `builtins.derivation`, the core of what makes Nix build packages. use crate::builtins::DerivationError; -use crate::known_paths::KnownPaths; +use crate::tvix_store_io::TvixStoreIO; use bstr::BString; use nix_compat::derivation::{Derivation, Output}; use nix_compat::nixhash; -use std::cell::RefCell; use std::collections::{btree_map, BTreeSet}; use std::rc::Rc; use tvix_eval::builtin_macros::builtins; @@ -121,7 +120,7 @@ fn handle_fixed_output( Ok(None) } -#[builtins(state = "Rc<RefCell<KnownPaths>>")] +#[builtins(state = "Rc<TvixStoreIO>")] pub(crate) mod derivation_builtins { use std::collections::BTreeMap; @@ -152,7 +151,7 @@ pub(crate) mod derivation_builtins { /// use the higher-level `builtins.derivation` instead. #[builtin("derivationStrict")] async fn builtin_derivation_strict( - state: Rc<RefCell<KnownPaths>>, + state: Rc<TvixStoreIO>, co: GenCo, input: Value, ) -> Result<Value, ErrorKind> { @@ -425,7 +424,7 @@ pub(crate) mod derivation_builtins { } populate_inputs(&mut drv, input_context); - let mut known_paths = state.borrow_mut(); + let mut known_paths = state.as_ref().known_paths.borrow_mut(); // At this point, derivation fields are fully populated from // eval data structures. |