diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 24576f67093..72694cfbbe7 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -924,6 +924,11 @@ void DerivationGoal::init() /* The first thing to do is to make sure that the derivation exists. If it doesn't, it may be created through a substitute. */ + if (buildMode == bmNormal && worker.store.isValidPath(drvPath)) { + haveDerivation(); + return; + } + addWaitee(worker.makeSubstitutionGoal(drvPath)); state = &DerivationGoal::haveDerivation;