1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 06:21:14 +02:00

* Experimental feature: allow a derivation to tell the build hook that

it requires a certain feature on the build machine, e.g.

    requiredSystemFeatures = [ "kvm" ];

  We need this in Hydra to make sure that builds that require KVM
  support are forwarded to machines that have KVM support.  Probably
  this should also be enforced for local builds.
This commit is contained in:
Eelco Dolstra 2010-08-27 13:18:13 +00:00
parent e41ecbf730
commit 766f708418
4 changed files with 43 additions and 12 deletions

View file

@ -1327,8 +1327,16 @@ HookReply DerivationGoal::tryBuildHook()
if (!worker.hook)
worker.hook = boost::shared_ptr<HookInstance>(new HookInstance);
writeLine(worker.hook->toHook.writeSide, (format("%1% %2% %3%") %
(worker.getNrLocalBuilds() < maxBuildJobs ? "1" : "0") % drv.platform % drvPath).str());
/* Tell the hook about system features (beyond the system type)
required from the build machine. (The hook could parse the
drv file itself, but this is easier.) */
Strings features = tokenizeString(drv.env["requiredSystemFeatures"]);
foreach (Strings::iterator, i, features) checkStoreName(*i); /* !!! abuse */
/* Send the request to the hook. */
writeLine(worker.hook->toHook.writeSide, (format("%1% %2% %3% %4%")
% (worker.getNrLocalBuilds() < maxBuildJobs ? "1" : "0")
% drv.platform % drvPath % concatStringsSep(",", features)).str());
/* Read the first line of input, which should be a word indicating
whether the hook wishes to perform the build. */