about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libmain/shared.cc2
-rw-r--r--src/libstore/build.cc1
-rw-r--r--src/libstore/globals.cc1
-rw-r--r--src/libstore/globals.hh4
-rw-r--r--src/libstore/remote-store.cc8
-rw-r--r--src/libstore/remote-store.hh1
-rw-r--r--src/libstore/worker-protocol.hh3
-rw-r--r--src/nix-worker/nix-worker.cc7
8 files changed, 22 insertions, 5 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index a606f0dae339..09841e45befb 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -212,6 +212,8 @@ static void initAndRun(int argc, char * * argv)
             readOnlyMode = true;
         else if (arg == "--max-silent-time")
             maxSilentTime = getIntArg(arg, i, args.end());
+        else if (arg == "--no-build-hook")
+            useBuildHook = false;
         else remaining.push_back(arg);
     }
 
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 36e3b5e1dd8b..d46286713253 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1247,6 +1247,7 @@ static string makeValidityRegistration(const PathSet & paths,
 
 DerivationGoal::HookReply DerivationGoal::tryBuildHook()
 {
+    if (!useBuildHook) return rpDecline;
     Path buildHook = getEnv("NIX_BUILD_HOOK");
     if (buildHook == "") return rpDecline;
     buildHook = absPath(buildHook);
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index 6c4944539d5e..eaea4b707eea 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -26,6 +26,7 @@ bool readOnlyMode = false;
 string thisSystem = "unset";
 unsigned int maxSilentTime = 0;
 Paths substituters;
+bool useBuildHook = true;
 
 
 static bool settingsRead = false;
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index ea15da0e644b..f650cd1b79b5 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -72,6 +72,10 @@ extern unsigned int maxSilentTime;
    from a CD. */
 extern Paths substituters;
 
+/* Whether to use build hooks (for distributed builds).  Sometimes
+   users want to disable this from the command-line. */
+extern bool useBuildHook;
+
 
 Strings querySetting(const string & name, const Strings & def);
 
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index 4d866071b181..cc847c050484 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -59,7 +59,7 @@ RemoteStore::RemoteStore()
         unsigned int magic = readInt(from);
         if (magic != WORKER_MAGIC_2) throw Error("protocol mismatch");
 
-        unsigned int daemonVersion = readInt(from);
+        daemonVersion = readInt(from);
         if (GET_PROTOCOL_MAJOR(daemonVersion) != GET_PROTOCOL_MAJOR(PROTOCOL_VERSION))
             throw Error("Nix daemon protocol version not supported");
         writeInt(PROTOCOL_VERSION, to);
@@ -169,6 +169,8 @@ void RemoteStore::setOptions()
     writeInt(verbosity, to);
     writeInt(maxBuildJobs, to);
     writeInt(maxSilentTime, to);
+    if (GET_PROTOCOL_MINOR(daemonVersion) >= 2)
+        writeInt(useBuildHook, to);
     processStderr();
 }
 
@@ -230,7 +232,9 @@ Path RemoteStore::queryDeriver(const Path & path)
     writeInt(wopQueryDeriver, to);
     writeString(path, to);
     processStderr();
-    return readStorePath(from);
+    Path drvPath = readString(from);
+    if (drvPath != "") assertStorePath(drvPath);
+    return drvPath;
 }
 
 
diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh
index 79a15e11ef9d..01cac93a4ccb 100644
--- a/src/libstore/remote-store.hh
+++ b/src/libstore/remote-store.hh
@@ -71,6 +71,7 @@ private:
     FdSink to;
     FdSource from;
     Pid child;
+    unsigned int daemonVersion;
 
     void processStderr(Sink * sink = 0, Source * source = 0);
 
diff --git a/src/libstore/worker-protocol.hh b/src/libstore/worker-protocol.hh
index 22f5973a96ee..44db4ad9b141 100644
--- a/src/libstore/worker-protocol.hh
+++ b/src/libstore/worker-protocol.hh
@@ -8,8 +8,9 @@ namespace nix {
 #define WORKER_MAGIC_1 0x6e697863
 #define WORKER_MAGIC_2 0x6478696f
 
-#define PROTOCOL_VERSION 0x101
+#define PROTOCOL_VERSION 0x102
 #define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00)
+#define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff)
 
 
 typedef enum {
diff --git a/src/nix-worker/nix-worker.cc b/src/nix-worker/nix-worker.cc
index 9f387a4ec130..5e261aa16198 100644
--- a/src/nix-worker/nix-worker.cc
+++ b/src/nix-worker/nix-worker.cc
@@ -223,7 +223,8 @@ struct TunnelSource : Source
 };
 
 
-static void performOp(Source & from, Sink & to, unsigned int op)
+static void performOp(unsigned int clientVersion,
+    Source & from, Sink & to, unsigned int op)
 {
     switch (op) {
 
@@ -422,6 +423,8 @@ static void performOp(Source & from, Sink & to, unsigned int op)
         verbosity = (Verbosity) readInt(from);
         maxBuildJobs = readInt(from);
         maxSilentTime = readInt(from);
+        if (GET_PROTOCOL_MINOR(clientVersion) >= 2)
+            useBuildHook = readInt(from) != 0;
         startWork();
         stopWork();
         break;
@@ -492,7 +495,7 @@ static void processConnection()
         opCount++;
 
         try {
-            performOp(from, to, op);
+            performOp(clientVersion, from, to, op);
         } catch (Error & e) {
             stopWork(false, e.msg());
         }