Modules
Reusable system modules live under hosts/modules. A module is a reusable configuration fragment. It usually defines options, service wiring, and defaults that several machines can share.
This is where behavior that should apply to more than one machine belongs.
Module Areas
hosts/modules/confGeneral configuration helpers used by hosts.hosts/modules/darwinnix-darwin launchd and service modules.hosts/modules/exportersMonitoring-specific modules likenvme.hosts/modules/gamesGame server modules.hosts/modules/serversReusable NixOS services and self-hosted applications.
What To Look For
- A host should import a module because the behavior is reusable, not because the host file is getting crowded.
- Modules are where service defaults, option wiring, and systemd or launchd integration should live.
- The interesting read is usually one module plus one host that imports it.
Module Vs Package
- A package builds software.
- A module configures software or a subsystem.
- Many useful repo features involve both, a package to produce the binary, then a module to run and configure it.
Suggested Examples
hosts/modules/servers/minifluxng.nixhosts/modules/servers/obligator.nixhosts/modules/darwin/ollama.nixhosts/modules/exporters/nvme.nix
For one full package -> module -> host walkthrough, see Case Study: poglets.
Complete Inventory
For the full generated list, see Generated Module Index.