diff options
author | Florian Klink <flokli@flokli.de> | 2023-11-19T17·50+0200 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-11-22T17·54+0000 |
commit | ef8a8af0bfa5963a4a19023acb2c94c3bc61f4d6 (patch) | |
tree | 1ff54b83215b21006008e6fd6371457603e0541d /tvix/nix-compat/src/derivation | |
parent | a8d48d4d9c2c4f1f4c97007271c1bfc36d989c74 (diff) |
refactor(tvix/nix-compat): cleanup parse_{ca,hash} and fmt structs r/7045
These were used to format to and parse from strings. Move this to the CAHash and NixHash structs directly, and be explicit in the name about which encoding for digests is used. For output path calculation, nix encodes the nixpaths in hex, but for writing out NARInfos, it's using nixbase32. Change-Id: Ia585a76a3811b2609e7ce259fda66a29403b7e07 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10079 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/nix-compat/src/derivation')
-rw-r--r-- | tvix/nix-compat/src/derivation/mod.rs | 2 | ||||
-rw-r--r-- | tvix/nix-compat/src/derivation/tests/mod.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/tvix/nix-compat/src/derivation/mod.rs b/tvix/nix-compat/src/derivation/mod.rs index a765e343096e..d62a339b77a9 100644 --- a/tvix/nix-compat/src/derivation/mod.rs +++ b/tvix/nix-compat/src/derivation/mod.rs @@ -135,7 +135,7 @@ impl Derivation { Sha256::new_with_prefix(format!( "fixed:out:{}{}:{}", ca_kind_prefix(ca_hash), - ca_hash.digest().to_nix_hash_string(), + ca_hash.digest().to_nix_hex_string(), out_output.path )) .finalize() diff --git a/tvix/nix-compat/src/derivation/tests/mod.rs b/tvix/nix-compat/src/derivation/tests/mod.rs index a14ca0938837..d6770bdbaca8 100644 --- a/tvix/nix-compat/src/derivation/tests/mod.rs +++ b/tvix/nix-compat/src/derivation/tests/mod.rs @@ -193,7 +193,7 @@ fn derivation_or_fod_hash(drv_path: &str, expected_nix_hash_string: &str) { let actual = drv.derivation_or_fod_hash(|_| panic!("must not be called")); - assert_eq!(expected_nix_hash_string, actual.to_nix_hash_string()); + assert_eq!(expected_nix_hash_string, actual.to_nix_hex_string()); } /// This reads a Derivation (in A-Term), trims out all fields containing |