1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-04 23:51:47 +02:00

Merge pull request #12065 from NixOS/mergify/bp/2.25-maintenance/pr-12048

Fix `nix upgrade-nix` profile search (backport #12048)
This commit is contained in:
mergify[bot] 2024-12-15 21:24:09 +00:00 committed by GitHub
commit bb08cc7cc2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -73,7 +73,7 @@ ExecutablePath::findName(const OsString & exe, std::function<bool(const fs::path
for (auto & dir : directories) { for (auto & dir : directories) {
auto candidate = dir / exe; auto candidate = dir / exe;
if (isExecutable(candidate)) if (isExecutable(candidate))
return std::filesystem::canonical(candidate); return candidate.lexically_normal();
} }
return std::nullopt; return std::nullopt;

View file

@ -107,7 +107,7 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand
auto whereOpt = ExecutablePath::load().findName(OS_STR("nix-env")); auto whereOpt = ExecutablePath::load().findName(OS_STR("nix-env"));
if (!whereOpt) if (!whereOpt)
throw Error("couldn't figure out how Nix is installed, so I can't upgrade it"); throw Error("couldn't figure out how Nix is installed, so I can't upgrade it");
auto & where = *whereOpt; const auto & where = whereOpt->parent_path();
printInfo("found Nix in '%s'", where); printInfo("found Nix in '%s'", where);
@ -126,7 +126,7 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand
if (where.filename() != "bin" || if (where.filename() != "bin" ||
!hasSuffix(userEnv, "user-environment")) !hasSuffix(userEnv, "user-environment"))
throw Error("directory '%s' does not appear to be part of a Nix profile", where); throw Error("directory %s does not appear to be part of a Nix profile", where);
if (!store->isValidPath(store->parseStorePath(userEnv))) if (!store->isValidPath(store->parseStorePath(userEnv)))
throw Error("directory '%s' is not in the Nix store", userEnv); throw Error("directory '%s' is not in the Nix store", userEnv);