1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-15 23:12:44 +01:00

Remove $NIX_BUILD_HOOK and $NIX_CURRENT_LOAD

This is to simplify remote build configuration. These environment
variables predate nix.conf.

The build hook now has a sensible default (namely build-remote).

The current load is kept in the Nix state directory now.
This commit is contained in:
Eelco Dolstra 2017-05-01 15:46:47 +02:00
parent ca9f589a93
commit d7653dfc6d
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
6 changed files with 12 additions and 156 deletions

View file

@ -583,11 +583,7 @@ struct HookInstance
HookInstance::HookInstance()
{
debug("starting build hook");
Path buildHook = getEnv("NIX_BUILD_HOOK");
if (string(buildHook, 0, 1) != "/") buildHook = settings.nixLibexecDir + "/nix/" + buildHook;
buildHook = canonPath(buildHook);
debug("starting build hook %s", settings.buildHook);
/* Create a pipe to get the output of the child. */
fromHook.create();
@ -621,9 +617,9 @@ HookInstance::HookInstance()
std::to_string(verbosity)
};
execv(buildHook.c_str(), stringsToCharPtrs(args).data());
execv(settings.buildHook.get().c_str(), stringsToCharPtrs(args).data());
throw SysError(format("executing %1%") % buildHook);
throw SysError("executing %s", settings.buildHook);
});
pid.setSeparatePG(true);
@ -1569,7 +1565,7 @@ void DerivationGoal::buildDone()
HookReply DerivationGoal::tryBuildHook()
{
if (!settings.useBuildHook || getEnv("NIX_BUILD_HOOK") == "" || !useDerivation) return rpDecline;
if (!settings.useBuildHook || !useDerivation) return rpDecline;
if (!worker.hook)
worker.hook = std::make_unique<HookInstance>();