about summary refs log tree commit diff
path: root/tvix/nix-compat/src/derivation/utils.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-03-04T02·25+0100
committertazjin <tazjin@tvl.su>2023-03-04T12·26+0000
commit1f9b5822391fa63b83f4224ba43ed404ded6dae8 (patch)
tree11e9a8006e3792e253409b778bde56713588edb4 /tvix/nix-compat/src/derivation/utils.rs
parentc2a681eaff09777011e6ea892411f6ac261caea7 (diff)
feat(tvix/nix-compat/derivation): make use of NixPath in some places r/5882
Some of these strings are actually just the nix hash representation of
the hash calculated earlier.

There's another one passed around via calculate_drv_replacement_str, but
that's left for a followup.

Change-Id: Id99a2a926a980d679eb49c34ee6a36bf224699b0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8218
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/nix-compat/src/derivation/utils.rs')
-rw-r--r--tvix/nix-compat/src/derivation/utils.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/tvix/nix-compat/src/derivation/utils.rs b/tvix/nix-compat/src/derivation/utils.rs
index 77ac94b42462..cbb5d02a2180 100644
--- a/tvix/nix-compat/src/derivation/utils.rs
+++ b/tvix/nix-compat/src/derivation/utils.rs
@@ -1,5 +1,6 @@
 use crate::derivation::DerivationError;
 use crate::nixbase32;
+use crate::nixhash::NixHash;
 use crate::store_path::{self, StorePath};
 use sha2::{Digest, Sha256};
 
@@ -67,9 +68,11 @@ pub fn path_with_references<S: AsRef<str>, I: IntoIterator<Item = S>, C: AsRef<[
         hasher.finalize()
     };
 
+    let h = NixHash::new(crate::nixhash::HashAlgo::Sha256, content_digest.to_vec());
+
     s.push_str(&format!(
-        ":sha256:{:x}:{}:{}",
-        content_digest,
+        ":{}:{}:{}",
+        h.to_nix_hash_string(),
         store_path::STORE_DIR,
         name
     ));