guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

49/376: Allow $NIX_BUILD_HOOK to be relative to Nix libexec directory


From: Ludovic Courtès
Subject: 49/376: Allow $NIX_BUILD_HOOK to be relative to Nix libexec directory
Date: Wed, 28 Jan 2015 22:03:58 +0000

civodul pushed a commit to tag 1.8
in repository guix.

commit e196eecbe6552d5afed89ad480544c90cf959922
Author: Eelco Dolstra <address@hidden>
Date:   Fri Jul 11 13:55:06 2014 +0200

    Allow $NIX_BUILD_HOOK to be relative to Nix libexec directory
---
 src/libstore/build.cc   |    6 ++++--
 src/libstore/globals.cc |    2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 1870abe..d594706 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);
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index 8bffdd7..b9d028b 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]