Don't run pre-build-hook if we don't have a derivation

This fixes a build failure on OS X when using Hydra or Nix 1.12's
build-remote (since they don't copy the derivation to the build
machine).

(cherry picked from commit 7f5b750b40)
This commit is contained in:
Eelco Dolstra 2017-06-12 16:07:34 +02:00
parent c20641ce56
commit 0be5b949d3
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -2121,7 +2121,7 @@ void DerivationGoal::startBuilder()
} }
} }
if (settings.preBuildHook != "") { if (useChroot && settings.preBuildHook != "" && dynamic_cast<Derivation *>(drv.get())) {
printMsg(lvlChatty, format("executing pre-build hook %1%") printMsg(lvlChatty, format("executing pre-build hook %1%")
% settings.preBuildHook); % settings.preBuildHook);
auto args = useChroot ? Strings({drvPath, chrootRootDir}) : auto args = useChroot ? Strings({drvPath, chrootRootDir}) :