diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index eb33020e0..ed5d53cbc 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -1532,7 +1532,7 @@ static int main_nix_env(int argc, char * * argv) globals.profile = getEnv("NIX_PROFILE").value_or(""); if (globals.profile == "") { - globals.profile = ensureDefaultProfile(); + globals.profile = getDefaultProfile(); } op(globals, std::move(opFlags), std::move(opArgs)); diff --git a/src/nix-env/user-env.cc b/src/nix-env/user-env.cc index f0131a458..70a1fe903 100644 --- a/src/nix-env/user-env.cc +++ b/src/nix-env/user-env.cc @@ -20,6 +20,7 @@ bool createUserEnv(EvalState & state, DrvInfos & elems, const Path & profile, bool keepDerivations, 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 exist already. */ std::vector drvsToBuild; @@ -131,10 +132,11 @@ bool createUserEnv(EvalState & state, DrvInfos & elems, state.repair ? bmRepair : bmNormal); /* Switch the current user environment to the output path. */ - auto store2 = state.store.dynamic_pointer_cast(); + auto localStore = state.store.dynamic_pointer_cast(); - if (store2) { + if (localStore) { PathLocks lock; + debug("locking profile %s", profile); lockProfile(lock, profile); Path lockTokenCur = optimisticLockProfile(profile); @@ -144,7 +146,7 @@ bool createUserEnv(EvalState & state, DrvInfos & elems, } debug("switching to new user environment"); - Path generation = createGeneration(*store2, profile, topLevelOut); + Path generation = createGeneration(*localStore, profile, topLevelOut); switchLink(profile, generation); }