about summary refs log tree commit diff
path: root/tvix/nix-compat/src/derivation/write.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/write.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/write.rs')
-rw-r--r--tvix/nix-compat/src/derivation/write.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/tvix/nix-compat/src/derivation/write.rs b/tvix/nix-compat/src/derivation/write.rs
index 83106cd9e6..04810e736a 100644
--- a/tvix/nix-compat/src/derivation/write.rs
+++ b/tvix/nix-compat/src/derivation/write.rs
@@ -33,6 +33,13 @@ pub const QUOTE: char = '"';
 /// the context a lot.
 pub(crate) trait AtermWriteable: Display {
     fn aterm_write(&self, writer: &mut impl Write) -> std::io::Result<()>;
+
+    fn aterm_bytes(&self) -> Vec<u8> {
+        let mut bytes = Vec::new();
+        self.aterm_write(&mut bytes)
+            .expect("unexpected write errors to Vec");
+        bytes
+    }
 }
 
 impl AtermWriteable for StorePathRef<'_> {
@@ -182,12 +189,15 @@ pub(crate) fn write_input_derivations(
 
 pub(crate) fn write_input_sources(
     writer: &mut impl Write,
-    input_sources: &BTreeSet<String>,
+    input_sources: &BTreeSet<StorePath>,
 ) -> Result<(), io::Error> {
     write_char(writer, BRACKET_OPEN)?;
     write_array_elements(
         writer,
-        &input_sources.iter().map(String::from).collect::<Vec<_>>(),
+        &input_sources
+            .iter()
+            .map(StorePath::to_absolute_path)
+            .collect::<Vec<_>>(),
     )?;
     write_char(writer, BRACKET_CLOSE)?;