diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-04-01 12:40:49 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2022-04-01 12:40:49 +0200 |
commit | fdfe737867920ed0ec29ba8ffb7d19854d8658bb (patch) | |
tree | 0cc0948f7a9cebd9649b9adff438cae3b10aa1cd /src/libexpr | |
parent | c9a29d0d92529338026190374d0e7e886f486e47 (diff) |
Fix handling of outputHash when outputHashAlgo is not specified
https://hydra.nixos.org/build/171351131
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/primops.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 969391725..73817dbdd 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -991,7 +991,7 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * * bool contentAddressed = false; bool isImpure = false; std::optional<std::string> outputHash; - std::optional<std::string> outputHashAlgo; + std::string outputHashAlgo; std::optional<FileIngestionMethod> ingestionMethod; StringSet outputs; @@ -1190,8 +1190,7 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * * .errPos = posDrvName }); - std::optional<HashType> ht = parseHashTypeOpt(outputHashAlgo.value_or("sha256")); - Hash h = newHashAllowEmpty(*outputHash, ht); + auto h = newHashAllowEmpty(*outputHash, parseHashTypeOpt(outputHashAlgo)); auto method = ingestionMethod.value_or(FileIngestionMethod::Flat); auto outPath = state.store->makeFixedOutputPath(method, h, drvName); @@ -1212,7 +1211,7 @@ static void prim_derivationStrict(EvalState & state, const Pos & pos, Value * * .errPos = posDrvName }); - auto ht = parseHashType(outputHashAlgo.value_or("sha256")); + auto ht = parseHashTypeOpt(outputHashAlgo).value_or(htSHA256); auto method = ingestionMethod.value_or(FileIngestionMethod::Recursive); for (auto & i : outputs) { |