nix.dev
nix.dev copied to clipboard
Build phases (with `mkDerivation`)
Project description
A Nix build goes through several phases, many of which are handled for you automatically if you're using nixpkgs-provided builders. However, it's common to want to customize a particular build phase or write your own logic for a particular phase if you aren't using a builder. This tutorial should focus on common build phases, when each one occurs, and how you might customize each one to accomplish certain tasks. This tutorial could also show that builders implement these phases differently to accommodate their different use cases.
Steps
- [ ] Submit a PR with an outline for the tutorial
- [ ] Submit a PR with a draft of the tutorial
Considerations
This is a broad topic that can go in many different directions, so special attention should be given to making sure that this is a tutorial and not an explanation. In other words, the user should be working on a specific task that puts them in contact with these topics, this document shouldn't be a general discussion of phases.
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/2023-06-19-tutorial-series-call-for-feedback-1/29377/1
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/2023-06-22-learning-journey-working-group-meeting-notes-14/29490/3
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/2023-06-22-documentation-team-meeting-notes-57/29500/1
A more specific direction for this tutorial would be to show how you use the phases to build up a simplified version of a particular builder as a means of showing how to leverage derivation phases to solve your own problems.
It would be nice to include postgresqlTestHook
, which improves the default checkPhase
.
(not essential, but I like to think that a cool feature like that could get someone excited about Nix)
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/2023-06-29-documentation-team-meeting-notes-59/29848/1
This was one of my personal learning outcomes from going through the nix-pills tutorial.
Would it be better to update that tutorial under new nix conventions - nix flakes
and perhaps nix command
equivalents?