Hubert's Blog
Perspective is worth 80 IQ points.
(updated )

Learning NixOS Module System

Let me try to summarise what I learnt in today’s deep dive into NixOS Module System:

  1. config holds the whole system config
  2. a specific config.a is an option with a type
  3. that config.a is declared by one and only one module
  4. any module depending on that one can set config.a
  5. its type decides how it is merged if set by several modules
  6. evaluating config.a means evaluating its merged definition. Every reference it has on other options needs to be resolved as well in the process. It’s highly recursive.
  7. it’s because Nix is lazy that it is so efficient and convenient
  8. sometimes tweaking the merge strategy is necessary, for this we have properties
  9. some modules are imported by default, i.e. always there
  10. the DSL is implemented in a module.nix
  11. the type system is implemented in types.nix