FAQ: Difference between revisions

imported>Samueldr
imported>Samueldr
m Why not use nix-env -i foo?: Use the new page
Line 25: Line 25:
This helps ensure purity of builds: on other distributions, the result of building a piece of software may depend on which other software you have installed. Nix attempts to avoid this to the greatest degree possible, which allows builds of a piece of software to be identical (in the ideal case) no matter where they're built, by requiring all dependencies to be declared.
This helps ensure purity of builds: on other distributions, the result of building a piece of software may depend on which other software you have installed. Nix attempts to avoid this to the greatest degree possible, which allows builds of a piece of software to be identical (in the ideal case) no matter where they're built, by requiring all dependencies to be declared.


== Why not use nix-env -i foo? ==
{{:FAQ/nix-env -iA}}
 
<code>nix-env -i foo</code> is slower and tends to be less precise than <code>nix-env -f '<nixpkgs>' -iA foo</code>. This is because it will evaluate all of nixpkgs searching for packages with the name foo, and install the one [https://nixos.org/nix/manual/#description-1 determined to be the latest] (which may not even be the one that you want). Meanwhile, with <code>-A</code>, 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.


== How to keep build-time dependencies around / be able to rebuild while being offline? ==
== How to keep build-time dependencies around / be able to rebuild while being offline? ==