New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check for existing store path in nix profile #4524
base: master
Are you sure you want to change the base?
Check for existing store path in nix profile #4524
Conversation
Previously, nix profile allowed you to install if they had the same store path. For instance, you could do: $ nix profile install github:nixos/nixpkgs#hello $ nix profile install nixpkgs#hello This leads to duplication since multiple elements are the same path. It could also cause issues when upgrading when two elements have the same store path at one point, but then diverge later, leading to conflicts. The new error message looks like: error: Cannot install 'github:nixos/nixpkgs#hello' when its store path (/nix/store/lwl497mzqp0k7cfhh51c948nkagc3bbr-hello-2.10) is already installed through 'github:nixos/nixpkgs#legacyPackages.x86_64-linux.hello'
src/nix/profile.cc
Outdated
@@ -260,11 +273,14 @@ struct CmdProfileInstall : InstallablesCommand, MixDefaultProfile | |||
|
|||
std::visit(overloaded { | |||
[&](BuildableOpaque bo) { | |||
checkForExistingPath(*installable, bo.path); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, but why a blank line only here and not around 283 as well?
Maybe it's better to check this in |
Yeah that sounds fine. It's a little bit less clear what the user should do in that case, but at least it's better than the original error message. It's kind of an unusual scenario to have two paths installed in a profile that point to different store paths then converge to one store path in a |
I marked this as stale due to inactivity. → More info |
I recall some recent changes had something to do with this? |
This is covered by #10090 |
Previously, nix profile allowed you to install if they had the same
store path.
For instance, you could do:
$ nix profile install github:nixos/nixpkgs#hello
$ nix profile install nixpkgs#hello
This leads to duplication since multiple elements are the same path.
It could also cause issues when upgrading when two elements have the
same store path at one point, but then diverge later, leading to
conflicts.
The new error message looks like:
error: Cannot install 'github:nixos/nixpkgs#hello' when its store path (/nix/store/lwl497mzqp0k7cfhh51c948nkagc3bbr-hello-2.10) is already installed through 'github:nixos/nixpkgs#legacyPackages.x86_64-linux.hello'