about summary refs log tree commit diff
path: root/src/nix-daemon/nix-daemon.cc
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-12-02T17·13+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-12-02T17·14+0100
commitd1e3bf01bce7d8502610532077f6f55c3df4de2c (patch)
treebe09364c3f1ec59db565c5eabe13b62661c6d3e0 /src/nix-daemon/nix-daemon.cc
parent8063fc497ab78fa72962b93874fe25dcca2b55ed (diff)
daemon: Add 'buildMode' parameter to 'buildPaths' RPC
Diffstat (limited to 'src/nix-daemon/nix-daemon.cc')
-rw-r--r--src/nix-daemon/nix-daemon.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc
index e97d1dab17b2..c5e11afa1553 100644
--- a/src/nix-daemon/nix-daemon.cc
+++ b/src/nix-daemon/nix-daemon.cc
@@ -319,8 +319,17 @@ static void performOp(bool trusted, unsigned int clientVersion,
 
     case wopBuildPaths: {
         PathSet drvs = readStorePaths<PathSet>(from);
+        BuildMode mode = bmNormal;
+        if (GET_PROTOCOL_MINOR(clientVersion) >= 15) {
+            mode = (BuildMode)readInt(from);
+
+	    /* Repairing is not atomic, so disallowed for "untrusted"
+	       clients.  */
+            if (mode == bmRepair && !trusted)
+                throw Error("repairing is not supported when building through the Nix daemon");
+        }
         startWork();
-        store->buildPaths(drvs);
+        store->buildPaths(drvs, mode);
         stopWork();
         to << 1;
         break;