nix profile upgrade: Always upgrade unlocked flakerefs

The "lockedRef" field is a misnomer, since it can be unlocked
(e.g. for a dirty Git workdir). In that case, `nix profile upgrade`
needs to assume that the package can have changed, and perform an
upgrade.
This commit is contained in:
Eelco Dolstra 2024-03-04 19:30:38 +01:00
parent eaa6c26189
commit 2306e96767

View File

@ -648,7 +648,9 @@ struct CmdProfileUpgrade : virtual SourceExprCommand, MixDefaultProfile, MixProf
assert(infop);
auto & info = *infop;
if (element.source->lockedRef == info.flake.lockedRef) continue;
if (info.flake.lockedRef.input.isLocked()
&& element.source->lockedRef == info.flake.lockedRef)
continue;
printInfo("upgrading '%s' from flake '%s' to '%s'",
element.source->attrPath, element.source->lockedRef, info.flake.lockedRef);