diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-07-27T15·47+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-08-10T16·05+0200 |
commit | 3eb621750848e0e6b30e5a79f76afbb096bb6c8a (patch) | |
tree | b14f6440f4704f1041c4b0712f5f7bc29884f742 /src/libstore/local-fs-store.cc | |
parent | 2fad86f361d5f6a4896a0364e313f61384945111 (diff) |
Add a "root" parameter to local stores
This makes it easier to create a diverted store, i.e. NIX_REMOTE="local?root=/tmp/root" instead of NIX_REMOTE="local?real=/tmp/root/nix/store&state=/tmp/root/nix/var/nix" NIX_LOG_DIR=/tmp/root/nix/var/log
Diffstat (limited to 'src/libstore/local-fs-store.cc')
-rw-r--r-- | src/libstore/local-fs-store.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libstore/local-fs-store.cc b/src/libstore/local-fs-store.cc index b1b9dc29e40d..c6ed8f746c69 100644 --- a/src/libstore/local-fs-store.cc +++ b/src/libstore/local-fs-store.cc @@ -7,7 +7,9 @@ namespace nix { LocalFSStore::LocalFSStore(const Params & params) : Store(params) - , stateDir(get(params, "state", settings.nixStateDir)) + , rootDir(get(params, "root")) + , stateDir(canonPath(get(params, "state", rootDir != "" ? rootDir + "/nix/var/nix" : settings.nixStateDir))) + , logDir(canonPath(get(params, "log", rootDir != "" ? rootDir + "/nix/var/log/nix" : settings.nixLogDir))) { } |