I'm using Nix on Ubuntu to have more modern versions of some packages, one of them being git. When I'm run nix-env -u, this is what happens:

% nix-env -u --dry-run '*'
(dry run; not doing anything)
upgrading `git-' to `git-1.9.0-full'

This is not what I want - I prefer the plain version git-1.9.0 over the -full version. I know I can manually upgrade to the plain version with nix-env -i git-1.9.0, but is there a way to make nix-env -u to do what I want?


Before I go and answer this one, I'd like to explain how naming of packages works in Nix.

The name you are referring to is derivation name, that is not unique (multiple packages compiled in different ways can be git-1.9.0).

If you want to reference a package in unique way, attribute set name is the way.

To print out attribute set name while querying (note -P:

nix-env -qaP | grep git

To update a package by unique name:

nix-env -uA git

In your case, this is a result of the fact that both packages are called git-version. Nix resolves which one is picked up by priority. To lower priority for the one currrent one, set:

nix-env --set-flag priority 10 git
nix-env -u

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.