summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix')
-rw-r--r--nix/libstore/build.cc11
-rw-r--r--nix/local.mk7
-rw-r--r--nix/nix-daemon/guix-daemon.cc9
-rw-r--r--nix/nix-daemon/nix-daemon.cc8
-rw-r--r--nix/scripts/offload.in11
5 files changed, 13 insertions, 33 deletions
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index fe7bf79069..9f1f88933a 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -614,9 +614,7 @@ 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);
+    const Path &buildHook = settings.guixProgram;
 
     /* Create a pipe to get the output of the child. */
     fromHook.create();
@@ -642,13 +640,14 @@ HookInstance::HookInstance()
         if (dup2(builderOut.writeSide, 4) == -1)
             throw SysError("dupping builder's stdout/stderr");
 
-        execl(buildHook.c_str(), buildHook.c_str(), settings.thisSystem.c_str(),
+        execl(buildHook.c_str(), buildHook.c_str(), "offload",
+	    settings.thisSystem.c_str(),
             (format("%1%") % settings.maxSilentTime).str().c_str(),
             (format("%1%") % settings.printBuildTrace).str().c_str(),
             (format("%1%") % settings.buildTimeout).str().c_str(),
             NULL);
 
-        throw SysError(format("executing `%1%'") % buildHook);
+        throw SysError(format("executing `%1% offload'") % buildHook);
     });
 
     pid.setSeparatePG(true);
@@ -1581,7 +1580,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/nix/local.mk b/nix/local.mk
index c4c3920fa3..8e52c77bd9 100644
--- a/nix/local.mk
+++ b/nix/local.mk
@@ -157,13 +157,6 @@ noinst_HEADERS =						\
 nodist_pkglibexec_SCRIPTS =			\
   %D%/scripts/substitute
 
-if BUILD_DAEMON_OFFLOAD
-
-nodist_pkglibexec_SCRIPTS +=			\
-  %D%/scripts/offload
-
-endif BUILD_DAEMON_OFFLOAD
-
 # The '.service' files for systemd.
 systemdservicedir = $(libdir)/systemd/system
 nodist_systemdservice_DATA = etc/guix-daemon.service etc/guix-publish.service
diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc
index f47d142612..73962af584 100644
--- a/nix/nix-daemon/guix-daemon.cc
+++ b/nix/nix-daemon/guix-daemon.cc
@@ -474,15 +474,8 @@ main (int argc, char *argv[])
       settings.set ("substitute-urls", GUIX_SUBSTITUTE_URLS);
 
 #ifdef HAVE_DAEMON_OFFLOAD_HOOK
-      /* Use our build hook for distributed builds by default.  */
+      /* Use 'guix offload' for distributed builds by default.  */
       settings.useBuildHook = true;
-      if (getenv ("NIX_BUILD_HOOK") == NULL)
-	{
-	  std::string build_hook;
-
-	  build_hook = settings.nixLibexecDir + "/offload";
-	  setenv ("NIX_BUILD_HOOK", build_hook.c_str (), 1);
-	}
 #else
       /* We are not installing any build hook, so disable it.  */
       settings.useBuildHook = false;
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index 56137701a1..f29bcd2eab 100644
--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -580,8 +580,14 @@ static void performOp(bool trusted, unsigned int clientVersion,
             settings.set("build-max-silent-time", std::to_string(readInt(from)));
         }
 
-        if (GET_PROTOCOL_MINOR(clientVersion) >= 2)
+        if (GET_PROTOCOL_MINOR(clientVersion) >= 2) {
+#ifdef HAVE_DAEMON_OFFLOAD_HOOK
             settings.useBuildHook = readInt(from) != 0;
+#else
+	    readInt(from);			  // ignore the user's setting
+#endif
+	}
+
         if (GET_PROTOCOL_MINOR(clientVersion) >= 4) {
             settings.buildVerbosity = (Verbosity) readInt(from);
             logType = (LogType) readInt(from);
diff --git a/nix/scripts/offload.in b/nix/scripts/offload.in
deleted file mode 100644
index 50faed31c0..0000000000
--- a/nix/scripts/offload.in
+++ /dev/null
@@ -1,11 +0,0 @@
-#!@SHELL@
-# A shorthand for "guix offload", for use by the daemon.
-
-if test "x$GUIX_UNINSTALLED" = "x"
-then
-    prefix="@prefix@"
-    exec_prefix="@exec_prefix@"
-    exec "@bindir@/guix" offload "$@"
-else
-    exec guix offload "$@"
-fi