nix.dev
nix.dev copied to clipboard
Expand and improve the Module System tutorial
Hey @NixOS/documentation-team
Observations I've already chatted with @fricklerhandwerk and @infinisil about improving the module system deep dive article. I've written quite a bit of material for a workshop I gave at NixCon NA this year and I it is worth migrating to nix.dev.
Problem The current module system deep dive is:
- long for a single lesson
- hard to maintain (changing a bit of code upstream requires many changes because of the use of code diffs)
- uses external APIs
Approaches As mentioned, I presented a workshop on the module system. To prepare for that, I created my own set of lessons and a website to host them (https://nixos-modules.nix.みんな/).
Each lesson is:
- minimal: Only 1 - 2 new concepts are introduced in each lesson
- hermetic: The example code in each lesson is stand-alone and does not require you to continue from another lesson
- verified to work: The infra for my site injects the code snippets and the output/results of each example into the lesson markdown at build time. If the lesson doesn't work, the site doesn't build. :)
- isolated from externals: All of the lessons use only Nix expressions and a small few use simple packages from nixpkgs. No external APIs or knowledge are necessary to read through the lessons. This limits the amount of new knowledge that is being shown to the user in each lesson and helps lower their mental load.
My plan for migration is as follows:
- We agree this is a good idea!
- Migrate the first lesson (https://nixos-modules.nix.みんな/lessons/a-basic-module/lesson/)
- We migrate the infra so that lessons are verified to work at build time. If this is something we want to take on.
- Migrate the remaining lessons.
- Modify the current deep dive. There is a lot of overlap between my lessons and the deep dive. If these lessons are migrated, we can cut back on the earlier sections of the deep dive and focus on the unique aspects of it.
- Add more lessons. What I have is not comprehensive and is just sufficient to get someone started on the module system. There is much more to explain and document.
Willing to help? Yes
Priorities
Add :+1: to issues you find important.