Nix evaluate a whole bunch of files on start up

Hello,

I’ve just installed and start to use nixpkg in my existing os.

However, one thing that frustrates me is that on startup, the first command I execute with nix-env, it will evaluate a whole bunch of files. It seems like it is evaluting all the packages.

This is just one line that I’ve seen by running nix-env -qa vscode --verbose:

evaluating file ‘/nix/store/q5k2man0mvd83nyvlf6r41nyw2c1rfqp-nixpkgs-21.11pre300283.f930ea227ce/nixpkgs/pkgs/tools/security/zzuf/default.nix’

Is there anything I’ve miss configured? All that I’ve touched is that I added two substituters.

Thanks.

This is expected behavior for nix-env, nix-env -qa will evaluate every package.

If you do nix-env -A then it will avoid trying to do the “fuzzy” search, and just do the package itself.

However, a lot of nix-env behavior isn’t what I would consider to be “idiomatic nix”. I would look into home-manager if you’re on another distro.

1 Like

Hello jonringer,

May I ask how to use the -A? I’ve checked the manual and it says that -A specifies an attribute, and I tried with like nix-env -qa -A nixpkgs vscode, and it didn’t seem to have any impact.

And I also ran nix-env -i git for example, it also ran a lot of evaluation, less than the nix-env -qa, but there are packages such as yarn or python, which seems a bit weird for me.

Using the home manager will obviously simplify a lot of things, but I’m just thinking maybe nix can be a complement for those fixed release distro, say debian, such that I can have a robust desktop environment, but have all the development tools at the latest version.

Thanks.

you could do nix-env -iA nixpkgs.git (first part needs to be the channel), I’m not sure what other commands also accept -A as I never use nix-env myself.

Thank you for your help.

I’ll give it a try.

I use nix-env because it is the “main commands” described in the manual. Though I wonder why there’s no description of the nix command.

most likely as it’s still not currently stable.