about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tvix/nix-compat/src/store_path/utils.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/tvix/nix-compat/src/store_path/utils.rs b/tvix/nix-compat/src/store_path/utils.rs
index d054d5955696..d060e0eac925 100644
--- a/tvix/nix-compat/src/store_path/utils.rs
+++ b/tvix/nix-compat/src/store_path/utils.rs
@@ -66,6 +66,13 @@ pub fn build_ca_path<'a, S: AsRef<str>, I: IntoIterator<Item = S>>(
         return Err(BuildStorePathError::InvalidReference());
     }
 
+    /// Helper function, used for the non-sha256 [CAHash::Nar] and all [CAHash::Flat].
+    fn fixed_out_digest(prefix: &str, hash: &NixHash) -> [u8; 32] {
+        Sha256::new_with_prefix(format!("{}:{}:", prefix, hash.to_nix_hex_string()))
+            .finalize()
+            .into()
+    }
+
     let (ty, inner_digest) = match &ca_hash {
         CAHash::Text(ref digest) => (make_references_string("text", references, false), *digest),
         CAHash::Nar(NixHash::Sha256(ref digest)) => (
@@ -101,14 +108,6 @@ pub fn build_ca_path<'a, S: AsRef<str>, I: IntoIterator<Item = S>>(
         .map_err(BuildStorePathError::InvalidStorePath)
 }
 
-/// Helper function, used in [build_ca_path] for the non-sha256 [CAHash::Nar]
-/// and [CAHash::Flat].
-fn fixed_out_digest(prefix: &str, hash: &NixHash) -> [u8; 32] {
-    Sha256::new_with_prefix(format!("{}:{}:", prefix, hash.to_nix_hex_string()))
-        .finalize()
-        .into()
-}
-
 /// For given NAR sha256 digest and name, return the new [StorePathRef] this
 /// would have, or an error, in case the name is invalid.
 pub fn build_nar_based_store_path<'a>(