Operating System
The substrate. Packages, services, boot, networking, generations, rollback.
The principle: minimal and declarative
The operating system exists to deliver the intelligence interface and keep the machine running. It should do exactly what is needed, be fully reproducible, and stay out of the way.
The test is simple: anything a person interacts with directly belongs one layer up. If a decision about the substrate is visible in daily use, the substrate is doing too much.
NixOS as the instantiation
Packages are declared in expressions rather than installed. The system is a generation — a single, atomic, reversible snapshot of the entire machine. One command updates everything. A user-level configuration manager extends the same model to the home directory.
Three properties follow, and they are the reason this layer is worth being strict about:
- Reproducible. The same inputs produce the same system, by construction. A machine can be reconstructed from the configuration alone.
- Reversible. Every rebuild creates a generation, and every generation is a rollback target. A declarative system you cannot back out of is just a slower imperative one.
- Stable by intent. The layer changes when the interface above needs it to — not because a distribution decided to reorganize its package set.
The honest counterweight
NixOS moves the difficulty rather than removing it. Instead of debugging a machine's accumulated state, you debug a configuration language, and its error messages are worse.
The trade is still worth it, for one reason: configuration errors are reproducible and accumulated state is not. A machine that breaks the same way twice can be fixed once.
What the substrate must not hold
State that nobody declared. The failure this layer exists to prevent is the ordinary one — a quick fix applied at 2am, a service enabled by hand, a config file edited in place — where the machine's real behaviour drifts away from any written description of it.
The discipline that prevents it is unglamorous: if a change is worth making, it is worth making in the configuration, even when the imperative version would take thirty seconds.