Nix-env is Slow af

Whenever i tried to search a program using:
nix-env -qaP package_name it always take a lot of time to return an ouput and i mean a LOT for instance i’ve never seen the ouput of the above command it always take like 3 or 4 minutes so i do Ctrl + c, is this a bug?

Kind of? It’s expected behavior because it evaluates all of nixpkgs in order to do the search, and it’s bad behavior because it’s super slow.

Though, in my experience it’s only like 10sec slow, not like 4min. Even my rpi 4, which seems bottlenecked by the SD card’s read speed, finishes nix-env -qaP firefox in 1min14sec.

1 Like

I think nix-env is unusable for quick search if you don’t have an exact match. If you do, you can do nix-env -qaA nixpkgs.foobar, but that’s almost useless IMO.

nix search was faster, but since 2.4 I think it forces usage of flakes which might not be what you’re looking for.

1 Like