5.4 Nix build phases: enable, disable, and override them
Lesson 33 of 68 · 9:58
Up next in 5s…
About this lesson
Every stdenv.mkDerivation build runs through fixed phases: unpack, patch, configure, build, check, install, fixup, and two more. This lesson maps out all nine Nix build phases, which seven matter, which two you can forget, and how each one can be enabled, disabled, overridden, or extended. It also clears up a small mystery: why your tests silently never ran.
In this video
- All nine build phases in order, and what each one is responsible for
- The switches that turn phases off, and the one phase that is off by default
- Why
doCheckbreaks the naming pattern of the other flags, and a memory trick so you never mix it up - Live demo: the same package built with and without its test suite, and the one line that makes the difference
- Hooks like
postInstall: keeping the default behavior and running your own snippet around it
After this lesson
You can read the phase overrides in any nixpkgs package fluently, and you know exactly which switch to flip when a build does too much or too little.