1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

Allow setting the state directory as a store parameter

E.g. "local?store=/tmp/store&state=/tmp/var".
This commit is contained in:
Eelco Dolstra 2016-06-02 13:33:49 +02:00
parent f2682e6e18
commit 812c0dfbe2
13 changed files with 112 additions and 77 deletions

View file

@ -131,19 +131,23 @@ bool createUserEnv(EvalState & state, DrvInfos & elems,
state.store->buildPaths({topLevelDrv}, state.repair ? bmRepair : bmNormal);
/* Switch the current user environment to the output path. */
PathLocks lock;
lockProfile(lock, profile);
auto store2 = state.store.dynamic_pointer_cast<LocalFSStore>();
Path lockTokenCur = optimisticLockProfile(profile);
if (lockToken != lockTokenCur) {
printMsg(lvlError, format("profile %1% changed while we were busy; restarting") % profile);
return false;
if (store2) {
PathLocks lock;
lockProfile(lock, profile);
Path lockTokenCur = optimisticLockProfile(profile);
if (lockToken != lockTokenCur) {
printMsg(lvlError, format("profile %1% changed while we were busy; restarting") % profile);
return false;
}
debug(format("switching to new user environment"));
Path generation = createGeneration(ref<LocalFSStore>(store2), profile, topLevelOut);
switchLink(profile, generation);
}
debug(format("switching to new user environment"));
Path generation = createGeneration(state.store, profile, topLevelOut);
switchLink(profile, generation);
return true;
}