Last updated 1 min read

What Makes NixOS So Good

#NixOS

The OS configuration is an imperative process, that requires a sequence of steps to get to a finish. It's never a one-and-done kind of task, either because of a failure or a hardware upgrade. Inevitably you will have to repeat the setup process again.

The truth is you will never remember all the setup details, including numerous workarounds that were applied to make exactly your configuration function as intended. To address this you must either document everything like crazy or automate the process.

Automation tools, like Ansible, Puppet, and Chef can help, but they share a common pitfall: they all try to force an imperative process into a declarative form that doesn't fit perfectly.

The root cause is that the system doesn't have a concept of an explicit state.

When you attempt to align the system with a declarative config you either get to the desired state or fail without the ability to roll back to an intermediate state. This lack of explicit state also makes it impossible to use diffs or caching to streamline processes. This inefficiency leads to wasted time and effort because every setup process is a configuration from scratch.

What makes NixOS so good is that it's declarative by design and has an explicit state defined by its config file(s). With NixOS, any system change is made by modifying the configuration file(s). Updates are fast and every change is applied atomically, ensuring the system never gets into an inconsistent state. It either succeeds or rolls back.