diff options
Diffstat (limited to 'tvix/glue/src/builtins')
-rw-r--r-- | tvix/glue/src/builtins/derivation.rs | 2 | ||||
-rw-r--r-- | tvix/glue/src/builtins/fetchers.rs | 19 |
2 files changed, 15 insertions, 6 deletions
diff --git a/tvix/glue/src/builtins/derivation.rs b/tvix/glue/src/builtins/derivation.rs index 1a8d18943ebe..8c7df96f91c1 100644 --- a/tvix/glue/src/builtins/derivation.rs +++ b/tvix/glue/src/builtins/derivation.rs @@ -475,7 +475,7 @@ pub(crate) mod derivation_builtins { .map_err(DerivationError::InvalidDerivation)?; // TODO: avoid cloning - known_paths.add(drv_path.clone(), drv.clone()); + known_paths.add_derivation(drv_path.clone(), drv.clone()); let mut new_attrs: Vec<(String, NixString)> = drv .outputs diff --git a/tvix/glue/src/builtins/fetchers.rs b/tvix/glue/src/builtins/fetchers.rs index ec5dd969bced..0de3d5462561 100644 --- a/tvix/glue/src/builtins/fetchers.rs +++ b/tvix/glue/src/builtins/fetchers.rs @@ -87,11 +87,20 @@ pub(crate) mod fetcher_builtins { .map_err(|e| ErrorKind::TvixError(Rc::new(e)))? { Some(store_path) => { - let path = store_path.to_absolute_path().into(); - // TODO: add fetch to fetcher - drop(fetch); - - Ok(Value::Path(Box::new(path))) + // Move the fetch to KnownPaths, so it can be actually fetched later. + let sp = state + .known_paths + .borrow_mut() + .add_fetch(fetch, &name) + .expect("Tvix bug: should only fail if the store path cannot be calculated"); + + debug_assert_eq!( + sp, store_path, + "calculated store path by KnownPaths should match" + ); + + // Emit the calculated Store Path. + Ok(Value::Path(Box::new(store_path.to_absolute_path().into()))) } None => { // If we don't have enough info, do the fetch now. |