Skip to content

Trimmed module lists

NixOS evaluates about 1,900 base modules for every host, used or not. A host with trimmedModules = true in the reference fleet evaluates only the ones it needs: about 400.

The list is the closure of a learned core and the options the host defines. It filters module-list.nix itself, so the order and the inline entries stay. The host passes it to nixosSystem as baseModules.

Reference fleet: web-1, app-2 toplevelCPUThunksGC total
full list11.4 s14.57 M1.03 GB
trimmed list10.5 s13.21 M0.94 GB
  • modlist-same-drv: each trimmed toplevel has the same drvPath as the full build.
  • modlist-negative: the list without nginx fails for a host that runs nginx, and the same list with nginx builds.
  • cost.sh: the trimmed eval uses at most 95% of the thunks.
Contribute Community Sponsor