about summary refs log tree commit diff
path: root/src/nix-daemon/nix-daemon.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-09-03T10·56+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-09-03T10·56+0200
commit71a5161365f40699092e491bbff88473237fc432 (patch)
tree02d1303475e895283707e5548d4d93385730d222 /src/nix-daemon/nix-daemon.cc
parent6e06a18d1b45ab50f54f527570aeff40201090ff (diff)
Implement buildDerivation() via the daemon
Diffstat (limited to 'src/nix-daemon/nix-daemon.cc')
-rw-r--r--src/nix-daemon/nix-daemon.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc
index 199d3288f4d6..aaae691e9ee8 100644
--- a/src/nix-daemon/nix-daemon.cc
+++ b/src/nix-daemon/nix-daemon.cc
@@ -7,6 +7,7 @@
 #include "affinity.hh"
 #include "globals.hh"
 #include "monitor-fd.hh"
+#include "derivations.hh"
 
 #include <algorithm>
 
@@ -325,6 +326,20 @@ static void performOp(bool trusted, unsigned int clientVersion,
         break;
     }
 
+    case wopBuildDerivation: {
+        Path drvPath = readStorePath(from);
+        BasicDerivation drv;
+        from >> drv;
+        BuildMode buildMode = (BuildMode) readInt(from);
+        startWork();
+        if (!trusted)
+            throw Error("you are not privileged to build derivations");
+        auto res = store->buildDerivation(drvPath, drv, buildMode);
+        stopWork();
+        to << res.status << res.errorMsg;
+        break;
+    }
+
     case wopEnsurePath: {
         Path path = readStorePath(from);
         startWork();