FAQ/Why not use nix-env -i foo?

From NixOS Wiki
Revision as of 04:16, 7 January 2018 by imported>Samueldr (Samueldr moved page FAQ/nix-env -iA to FAQ/Why not use nix-env -i foo?: Fixes the title for the page...)

{{#tweekihide:firstHeading}}

Why not use nix-env -i foo?

nix-env -i foo is slower and tends to be less precise than nix-env -f '<nixpkgs>' -iA foo. This is because it will evaluate all of nixpkgs searching for packages with the name foo, and install the one determined to be the latest (which may not even be the one that you want). Meanwhile, with -A, nix-env will evaluate only the given attribute in nixpkgs. This will be significantly faster, consume significantly less memory, and more likely to get you what you want.