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.
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.
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.
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.
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.