diff options
author | Florian Klink <flokli@flokli.de> | 2024-04-12T10·17+0300 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2024-04-13T10·03+0000 |
commit | a2322d7c142543224eeb9eebc1fedea7aea8b612 (patch) | |
tree | cbe42b6fefbe9f52a10987d53b20666e95f1cef9 /tvix/nix-compat/src/derivation/parser.rs | |
parent | 57fba1f167ac64ded89d4c61af08bb0f65c7f1f5 (diff) |
feat(tvix/nix-compat): implement Serialize, Deserialize for NixHash r/7890
We use the (slightly more tolerant) from_str to deserialize, and serialize out as SRI. Change-Id: If76b0ed2d4e243904f02df34f6c90b976c0bab8c Reviewed-on: https://cl.tvl.fyi/c/depot/+/11393 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Diffstat (limited to 'tvix/nix-compat/src/derivation/parser.rs')
-rw-r--r-- | tvix/nix-compat/src/derivation/parser.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tvix/nix-compat/src/derivation/parser.rs b/tvix/nix-compat/src/derivation/parser.rs index 3f291c2040c3..769a7c5a96e0 100644 --- a/tvix/nix-compat/src/derivation/parser.rs +++ b/tvix/nix-compat/src/derivation/parser.rs @@ -48,7 +48,7 @@ pub(crate) fn parse(i: &[u8]) -> Result<Derivation, Error<&[u8]>> { fn from_algo_and_mode_and_digest<B: AsRef<[u8]>>( algo_and_mode: &str, digest: B, -) -> crate::nixhash::Result<CAHash> { +) -> crate::nixhash::NixHashResult<CAHash> { Ok(match algo_and_mode.strip_prefix("r:") { Some(algo) => nixhash::CAHash::Nar(nixhash::from_algo_and_digest( algo.try_into()?, |