feat(tvix/nix-compat): implement Serialize, Deserialize for NixHash

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>
This commit is contained in:
Florian Klink 2024-04-12 13:17:07 +03:00 committed by flokli
parent 57fba1f167
commit a2322d7c14
3 changed files with 50 additions and 9 deletions

View file

@ -61,7 +61,7 @@ impl FetchArgs {
name: Option<String>,
sha256: Option<String>,
mode: HashMode,
) -> nixhash::Result<Self> {
) -> nixhash::NixHashResult<Self> {
Ok(Self {
name: name.unwrap_or_else(|| url_basename(&url).to_owned()),
url,