about summary refs log tree commit diff
path: root/tvix/nix-compat/src/derivation/mod.rs
diff options
context:
space:
mode:
authorPeter Kolloch <info@eigenvalue.net>2024-02-21T07·07+0700
committerclbot <clbot@tvl.fyi>2024-02-21T11·34+0000
commit035f617b7f11f2ec4a9e08e3a31a175e71a6544b (patch)
tree67bf2b777167dbfa1c7a885ed333a1f723dd994e /tvix/nix-compat/src/derivation/mod.rs
parentc06fb01b3b7a752e0c04ba21a02cdc3f431055e1 (diff)
feat(tvix/nix-compat): input_sources as StorePath r/7584
https: //b.tvl.fyi/issues/264
Change-Id: I7a235734dc1f8e93e387a04ba369f3b702c6d5b6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10992
Autosubmit: Peter Kolloch <info@eigenvalue.net>
Reviewed-by: flokli <flokli@flokli.de>
Reviewed-by: Peter Kolloch <info@eigenvalue.net>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/nix-compat/src/derivation/mod.rs')
-rw-r--r--tvix/nix-compat/src/derivation/mod.rs18
1 files changed, 7 insertions, 11 deletions
diff --git a/tvix/nix-compat/src/derivation/mod.rs b/tvix/nix-compat/src/derivation/mod.rs
index 3cf9a5ba7f22..2e4178b872f6 100644
--- a/tvix/nix-compat/src/derivation/mod.rs
+++ b/tvix/nix-compat/src/derivation/mod.rs
@@ -40,7 +40,7 @@ pub struct Derivation {
 
     /// Plain store paths of additional inputs.
     #[serde(rename = "inputSrcs")]
-    pub input_sources: BTreeSet<String>,
+    pub input_sources: BTreeSet<StorePath>,
 
     /// Maps output names to Output.
     pub outputs: BTreeMap<String, Output>,
@@ -131,16 +131,12 @@ impl Derivation {
 
         // collect the list of paths from input_sources and input_derivations
         // into a (sorted, guaranteed by BTreeSet) list of references
-        let references: BTreeSet<String> = {
-            let mut inputs = self.input_sources.clone();
-            let input_derivation_keys: Vec<String> = self
-                .input_derivations
-                .keys()
-                .map(|k| k.to_absolute_path())
-                .collect();
-            inputs.extend(input_derivation_keys);
-            inputs
-        };
+        let references: BTreeSet<String> = self
+            .input_sources
+            .iter()
+            .chain(self.input_derivations.keys())
+            .map(StorePath::to_absolute_path)
+            .collect();
 
         build_text_path(name, self.to_aterm_bytes(), references)
             .map(|s| s.to_owned())