Realisation is the process whereby a Nix derivation is transformed into a package. While a derivation is essentially a plan for a package, realisation is the build process turns that plan into an actual output directory full of content.
When you run
nix build to build a package, the Nix CLI first looks at the
derivation function for the function and transforms it into an intermediate
.drv file, which is essentially a formal representation of the
.drv files are stored in the Nix store with a hashed path, such as
/nix/store/m2nb4d0pfydr8bq5ww1yqbrkvvf18zbl-perl-5.36.0.drv, which ensures that any change in a
derivation function results in a new
.drv file with a new path.
The CLI then uses the
.drv file as the blueprint for the actual build process, which always builds the package's entire dependency tree.
Once Nix has built a
.drv file for the derivation, it uses the encoded instructions in the file to actually build the package in a sandboxed environment, which essentially means that realisation doesn't rely on or affect any global state on your machine, such as configuration files in
Everything required for the build process is drawn from:
git command is invoked in the build logic, rather than a "global" Git at a path like