Allow fixed-output derivations to depend on (floating) content-addressed ones

Fix an overlook of https://github.com/NixOS/nix/pull/4056
This commit is contained in:
regnat 2020-11-25 18:20:35 +01:00
parent 13c557fe82
commit 9bd8184f1f
3 changed files with 14 additions and 2 deletions

View File

@ -493,8 +493,8 @@ void DerivationGoal::inputsRealised()
if (useDerivation) {
auto & fullDrv = *dynamic_cast<Derivation *>(drv.get());
if ((!fullDrv.inputDrvs.empty() &&
fullDrv.type() == DerivationType::CAFloating) || fullDrv.type() == DerivationType::DeferredInputAddressed) {
if ((!fullDrv.inputDrvs.empty() && derivationIsCA(fullDrv.type()))
|| fullDrv.type() == DerivationType::DeferredInputAddressed) {
/* We are be able to resolve this derivation based on the
now-known results of dependencies. If so, we become a stub goal
aliasing that resolved derivation goal */

View File

@ -63,4 +63,15 @@ rec {
echo ${rootCA}/non-ca-hello > $out/dep
'';
};
dependentFixedOutput = mkDerivation {
name = "dependent-fixed-output";
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = "sha256-QvtAMbUl/uvi+LCObmqOhvNOapHdA2raiI4xG5zI5pA=";
buildCommand = ''
cat ${dependentCA}/dep
echo foo > $out
'';
};
}

View File

@ -40,6 +40,7 @@ testCutoff () {
#testDerivation dependentCA
testCutoffFor transitivelyDependentCA
testCutoffFor dependentNonCA
testCutoffFor dependentFixedOutput
}
testGC () {