1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

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
This commit is contained in:
Eelco Dolstra 2016-07-27 17:47:18 +02:00
parent 2fad86f361
commit 3eb6217508
5 changed files with 13 additions and 5 deletions

View file

@ -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)))
{
}