Allow $NIX_BUILD_HOOK to be relative to Nix libexec directory
This commit is contained in:
parent
d0eb970fb4
commit
e196eecbe6
|
@ -590,7 +590,9 @@ HookInstance::HookInstance()
|
|||
{
|
||||
debug("starting build hook");
|
||||
|
||||
Path buildHook = absPath(getEnv("NIX_BUILD_HOOK"));
|
||||
Path buildHook = getEnv("NIX_BUILD_HOOK");
|
||||
if (string(buildHook, 0, 1) != "/") buildHook = settings.nixLibexecDir + "/nix/" + buildHook;
|
||||
buildHook = canonPath(buildHook);
|
||||
|
||||
/* Create a pipe to get the output of the child. */
|
||||
fromHook.create();
|
||||
|
@ -1503,7 +1505,7 @@ void DerivationGoal::buildDone()
|
|||
|
||||
HookReply DerivationGoal::tryBuildHook()
|
||||
{
|
||||
if (!settings.useBuildHook || getEnv("NIX_BUILD_HOOK") == "") return rpDecline;
|
||||
if (!settings.useBuildHook) return rpDecline;
|
||||
|
||||
if (!worker.hook)
|
||||
worker.hook = std::shared_ptr<HookInstance>(new HookInstance);
|
||||
|
|
|
@ -38,7 +38,7 @@ Settings::Settings()
|
|||
thisSystem = SYSTEM;
|
||||
maxSilentTime = 0;
|
||||
buildTimeout = 0;
|
||||
useBuildHook = true;
|
||||
useBuildHook = getEnv("NIX_BUILD_HOOK") != "";
|
||||
printBuildTrace = false;
|
||||
reservedSize = 1024 * 1024;
|
||||
fsyncMetadata = true;
|
||||
|
|
Loading…
Reference in a new issue