about summary refs log tree commit diff
path: root/src/build-remote
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-10-23T17·06+0200
committerEelco Dolstra <edolstra@gmail.com>2017-10-23T18·50+0200
commit863a45f1f3ac3ac5db6afcf906aa2c485418d9ac (patch)
treeb8d53559e70491a82a12a8f36d4ad32a0746b726 /src/build-remote
parentf31c66d392340ce0024fffadf1f3c1a3c9114f46 (diff)
build-remote: Put current load under the store state directory
Fixes the error

  error: opening lock file '/nix/var/nix/current-load/main-lock': Permission denied

when using a chroot store.
Diffstat (limited to 'src/build-remote')
-rw-r--r--src/build-remote/build-remote.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/build-remote/build-remote.cc b/src/build-remote/build-remote.cc
index 4b7a24d03e9a..ea002cdccabb 100644
--- a/src/build-remote/build-remote.cc
+++ b/src/build-remote/build-remote.cc
@@ -16,6 +16,7 @@
 #include "serialise.hh"
 #include "store-api.hh"
 #include "derivations.hh"
+#include "local-store.hh"
 
 using namespace nix;
 using std::cin;
@@ -48,7 +49,7 @@ int main (int argc, char * * argv)
         if (argc != 6)
             throw UsageError("called without required arguments");
 
-        auto store = openStore();
+        auto store = openStore().cast<LocalStore>();
 
         auto localSystem = argv[1];
         settings.maxSilentTime = std::stoll(argv[2]);
@@ -58,7 +59,7 @@ int main (int argc, char * * argv)
 
         /* It would be more appropriate to use $XDG_RUNTIME_DIR, since
            that gets cleared on reboot, but it wouldn't work on macOS. */
-        currentLoad = settings.nixStateDir + "/current-load";
+        currentLoad = store->stateDir + "/current-load";
 
         std::shared_ptr<Store> sshStore;
         AutoCloseFD bestSlotLock;