Updating with `nix-env --update` is printing messages about packages installed by other users

At work, we recently got a new development server for miscellaneous tasks (building containers with CI, running models, data pipelines—really anything the devs want to use it for).

We thought it might be elegant to use nix for per-user software installation to avoid the need for global software installation and generally reduce the need for people to use root.

Recently, we noticed that when running nix-env --upgrade, we each get messages related to packages which have nothing to do with us:

$ nix-env --upgrade
evaluation warning: The package set `androidndkPkgs_23b` has been renamed to `androidndkPkgs_23`.
evaluation warning: cudaPackages.cudaFlags is deprecated, use cudaPackages.flags instead
evaluation warning: cudaPackages.cudaVersion is deprecated, use cudaPackages.cudaMajorMinorVersion instead
evaluation warning: CUDA versions older than 12.0 will be removed in Nixpkgs 25.05; see the 24.11 release notes for more information
evaluation warning: cudaPackages.cudaFlags is deprecated, use cudaPackages.flags instead
evaluation warning: cudaPackages.cudaVersion is deprecated, use cudaPackages.cudaMajorMinorVersion instead
evaluation warning: CUDA versions older than 12.0 will be removed in Nixpkgs 25.05; see the 24.11 release notes for more information
evaluation warning: 'f3d' now build with egl support by default, so `f3d_egl` is deprecated, consider using 'f3d' instead.
evaluation warning: 'f3d' now build with egl support by default, so `f3d_egl` is deprecated, consider using 'f3d' instead.

I didn’t install any of these packages, but I assume others are using them.

What is happening here? I don’t want to automatically update packages installed by other users.

system is Ubuntu 24.04.3
nix is 2.30.2

Simply: don’t use nix-env. https://stop-using-nix-env.privatevoid.net/

In this case, the problem with nix-env is that it’s evaluating every single attribute in nixpkgs (which is why nix-env is so slow) and then spitting out eval warnings for attributes that have those warnings. It does not matter what you have installed, you will get those warnings.

Also, upgrading with nix-env has a risk of just “upgrading” you to the wrong package since it uses pname NOT attribute name. There is no way to prevent this with nix-env --upgrade because nix-env profiles simply do not store the attribute name information.

3 Likes

For the record, @waffle8946 is saying your assumption is false; nix-env just evaluates (but does not build or install) every package in nixpkgs, regardless of whether anyone is using it.

2 Likes

It’s not totally clear from the link you posted what the alternative should be for per-user package installation on a multi-users system.

The same happends for me when I use nix search nixpkgs <search term>. Is there also a better alternative for that?

The “Alternatives” heading covers that. Ideally you largely use nix-shell, or if you must permanently install applications only to $PATH you can use nix profile.

However, for your specific use case home-manager is probably the best option, which it mentions under “declarative” management.

That should really not be happening, nix does not evaluate anything when you use nix search, so those warnings should be impossible. Can you share your exact command, nix configuration and output?

Nope, I’ve just never looked too closely at that command’s exact output, warnings are indeed interspersed with it.

Of course nix evaluates stuff, otherwise there was nothing to search.

The only viable alternative to nix search nixpkgs is sadly the website.

1 Like

Ah, huh, I assumed it used just the attrset keys, like e.g. nix info. But no, it apparently lists versions and descriptions as well, for which full eval is necessary.

1 Like

Third party tools cover this usecase better for searching nixpkgs specifically.