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

View file

@ -63,4 +63,15 @@ rec {
echo ${rootCA}/non-ca-hello > $out/dep 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 #testDerivation dependentCA
testCutoffFor transitivelyDependentCA testCutoffFor transitivelyDependentCA
testCutoffFor dependentNonCA testCutoffFor dependentNonCA
testCutoffFor dependentFixedOutput
} }
testGC () { testGC () {