Skip to content

"nix profile" allows installing duplicate packages #5587

@dtzWill

Description

@dtzWill

Describe the bug

The "nix profile" command allows installing duplicate packages, which isn't what I expected (nix-env would reject this).

It does seem to check for conflicting binaries/files among different packages (two versions of bash, for example).

This bug is about having duplicate identical installation items, which at least seems unlikely to be intentional and easy enough to check for (I'm seeing some profile-related bits having custom operator <'s that look likely to be useful for catching at least these trivially duplicate entries?).

Steps To Reproduce

  1. nix profile install --profile ~/test-profile nixpkgs#bash
  2. nix profile install --profile ~/test-profile nixpkgs#bash
  3. nix profile list --profile ~/test-profile
  4. Observe duplicates in output:
0 flake:nixpkgs#legacyPackages.x86_64-linux.bash github:NixOS/nixpkgs/80e6ae766ae5d928da056dee74b747660f6c1178#legacyPackages.x86_64-linux.bash /nix/store/svxmj4xahyjqq4lciisvgi1fwl5bxpdd-bash-5.1-p8
1 flake:nixpkgs#legacyPackages.x86_64-linux.bash github:NixOS/nixpkgs/80e6ae766ae5d928da056dee74b747660f6c1178#legacyPackages.x86_64-linux.bash /nix/store/svxmj4xahyjqq4lciisvgi1fwl5bxpdd-bash-5.1-p8

Expected behavior

Reject attempt to install duplicate package. Or silently keeping the first, so one can install same items repeatedly without worrying about what's already installed.

nix-env --version output

nix-env (Nix) 2.5pre20211007_844dd90

EDIT: updated after testing conflict handling among different packages

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions