about summary refs log tree commit diff
path: root/tvix/nix-compat
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-10-18T10·32+0100
committerflokli <flokli@flokli.de>2023-10-18T10·32+0000
commit57b69baf7c8891f0032ef70415482f9a38396bb7 (patch)
treefc86b597cd794ecec1818681200c23734f8cc80a /tvix/nix-compat
parent1bb7e84241be81effd7ca57182b2d6edaddc1508 (diff)
refactor(tvix/nix-compat): use hash_with_mode's nix_hash_string r/6851
HashWithMode already provides a to_nix_hash_string() method, giving us
exactly the string we need here.

Change-Id: Id2635bf3ea6c2514faf3c26b297866d774f4ff4a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9799
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/nix-compat')
-rw-r--r--tvix/nix-compat/src/store_path/utils.rs8
1 files changed, 1 insertions, 7 deletions
diff --git a/tvix/nix-compat/src/store_path/utils.rs b/tvix/nix-compat/src/store_path/utils.rs
index 6064bb36b3b3..b774fbdb662d 100644
--- a/tvix/nix-compat/src/store_path/utils.rs
+++ b/tvix/nix-compat/src/store_path/utils.rs
@@ -89,13 +89,7 @@ pub fn build_regular_ca_path<S: AsRef<str>, I: IntoIterator<Item = S>>(
                 &{
                     let content_digest = {
                         let mut hasher = Sha256::new_with_prefix("fixed:out:");
-                        hasher.update(hash_with_mode.mode().prefix());
-                        hasher.update(hash_with_mode.digest().algo().to_string());
-                        hasher.update(":");
-                        hasher.update(
-                            &data_encoding::HEXLOWER
-                                .encode(hash_with_mode.digest().digest_as_bytes()),
-                        );
+                        hasher.update(hash_with_mode.to_nix_hash_string());
                         hasher.update(":");
                         hasher.finalize()
                     };