about summary refs log tree commit diff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-07-11T11·55+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-07-11T11·55+0200
commite196eecbe6552d5afed89ad480544c90cf959922 (patch)
tree3b919f7e5e40c830dbb218be10ba96de5cb1b05d /src/libstore/build.cc
parentd0eb970fb4d3b5c347506b77f9657fc5eb6229e2 (diff)
Allow $NIX_BUILD_HOOK to be relative to Nix libexec directory
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 1870abead491..d59470603295 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -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);