tiny cleanup in user-env.cc

Change-Id: I05a619284974342767eb770f8b876bf697b9ae95
This commit is contained in:
Qyriad 2024-05-11 20:13:50 -06:00
parent 7f35e7e704
commit ef8ff58802
2 changed files with 6 additions and 4 deletions

View file

@ -1532,7 +1532,7 @@ static int main_nix_env(int argc, char * * argv)
globals.profile = getEnv("NIX_PROFILE").value_or(""); globals.profile = getEnv("NIX_PROFILE").value_or("");
if (globals.profile == "") { if (globals.profile == "") {
globals.profile = ensureDefaultProfile(); globals.profile = getDefaultProfile();
} }
op(globals, std::move(opFlags), std::move(opArgs)); op(globals, std::move(opFlags), std::move(opArgs));

View file

@ -20,6 +20,7 @@ bool createUserEnv(EvalState & state, DrvInfos & elems,
const Path & profile, bool keepDerivations, const Path & profile, bool keepDerivations,
const std::string & lockToken) const std::string & lockToken)
{ {
debug("asked to create a user env %s for %u drvs", profile, elems.size());
/* Build the components in the user environment, if they don't /* Build the components in the user environment, if they don't
exist already. */ exist already. */
std::vector<StorePathWithOutputs> drvsToBuild; std::vector<StorePathWithOutputs> drvsToBuild;
@ -131,10 +132,11 @@ bool createUserEnv(EvalState & state, DrvInfos & elems,
state.repair ? bmRepair : bmNormal); state.repair ? bmRepair : bmNormal);
/* Switch the current user environment to the output path. */ /* Switch the current user environment to the output path. */
auto store2 = state.store.dynamic_pointer_cast<LocalFSStore>(); auto localStore = state.store.dynamic_pointer_cast<LocalFSStore>();
if (store2) { if (localStore) {
PathLocks lock; PathLocks lock;
debug("locking profile %s", profile);
lockProfile(lock, profile); lockProfile(lock, profile);
Path lockTokenCur = optimisticLockProfile(profile); Path lockTokenCur = optimisticLockProfile(profile);
@ -144,7 +146,7 @@ bool createUserEnv(EvalState & state, DrvInfos & elems,
} }
debug("switching to new user environment"); debug("switching to new user environment");
Path generation = createGeneration(*store2, profile, topLevelOut); Path generation = createGeneration(*localStore, profile, topLevelOut);
switchLink(profile, generation); switchLink(profile, generation);
} }