mirror of
https://github.com/NixOS/nix.git
synced 2025-11-16 07:22:43 +01:00
Get rid of impureOutputHash
I do not believe there is any problem with computing `hashDerivationModulo` the normal way with impure derivations. Conversely, the way this used to work is very suspicious because two almost-equal derivations that only differ in depending on different impure derivations could have the same drv hash modulo. That is very suspicious because there is no reason to think those two different impure derivations will end up producing the same content-addressed data! Co-authored-by: Alain Zscheile <zseri.devel@ytrizja.de>
This commit is contained in:
parent
23259bde1a
commit
50912d02e2
3 changed files with 32 additions and 41 deletions
|
|
@ -843,16 +843,6 @@ DrvHash hashDerivationModulo(Store & store, const Derivation & drv, bool maskOut
|
|||
};
|
||||
}
|
||||
|
||||
if (type.isImpure()) {
|
||||
std::map<std::string, Hash> outputHashes;
|
||||
for (const auto & [outputName, _] : drv.outputs)
|
||||
outputHashes.insert_or_assign(outputName, impureOutputHash);
|
||||
return DrvHash {
|
||||
.hashes = outputHashes,
|
||||
.kind = DrvHash::Kind::Deferred,
|
||||
};
|
||||
}
|
||||
|
||||
auto kind = std::visit(overloaded {
|
||||
[](const DerivationType::InputAddressed & ia) {
|
||||
/* This might be a "pesimistically" deferred output, so we don't
|
||||
|
|
@ -865,7 +855,7 @@ DrvHash hashDerivationModulo(Store & store, const Derivation & drv, bool maskOut
|
|||
: DrvHash::Kind::Deferred;
|
||||
},
|
||||
[](const DerivationType::Impure &) -> DrvHash::Kind {
|
||||
assert(false);
|
||||
return DrvHash::Kind::Deferred;
|
||||
}
|
||||
}, drv.type().raw);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue