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.
This commit is contained in:
Eelco Dolstra 2017-10-23 19:06:55 +02:00
parent f31c66d392
commit 863a45f1f3
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -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;