about summary refs log tree commit diff
path: root/src/libstore/store-api.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-06-02T11·33+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-06-02T14·02+0200
commit812c0dfbe24c8fe93992f77abbf1e5a975ea42f4 (patch)
treed69bcc87ce446f270f6b01f7069655223d52a626 /src/libstore/store-api.cc
parentf2682e6e18a76ecbfb8a12c17e3a0ca15c084197 (diff)
Allow setting the state directory as a store parameter
E.g. "local?store=/tmp/store&state=/tmp/var".
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r--src/libstore/store-api.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index cea4b4b6ebcb..c6616a43d708 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -230,7 +230,7 @@ Path Store::computeStorePathForText(const string & name, const string & s,
 
 
 Store::Store(const Params & params)
-    : storeDir(settings.nixStore)
+    : storeDir(get(params, "store", settings.nixStore))
 {
 }
 
@@ -508,7 +508,8 @@ static RegisterStoreImplementation regStore([](
     else return 0;
 
     if (mode == mAuto) {
-        if (LocalStore::haveWriteAccess())
+        auto stateDir = get(params, "state", settings.nixStateDir);
+        if (access(stateDir.c_str(), R_OK | W_OK) == 0)
             mode = mLocal;
         else if (pathExists(settings.nixDaemonSocketFile))
             mode = mDaemon;