NixOS

NixOS is a free and open source Linux distribution based on the Nix package manager. NixOS uses an immutable design and an atomic update model. Its use of a declarative configuration system allows reproducibility and portability.

NixOS is configured using composable modules, and relies on packages defined in the Nixpkgs project. Package recipes and configurations are written in the purpose-built "Nix language" that ships with the Nix package manager.

History
In 2003, Eelco Dolstra started Nix as a research project. Dolstra says that the purpose of the project was to achieve a system for correct software deployment. His influences included Eelco Visser, who had supervised his PhD at Utrecht University. In 2006, Armijn Hemel presented NixOS as the result of his Master's thesis at Utrecht.

In 2015, the NixOS Foundation was founded in the Netherlands, aiming to support projects like NixOS that implement the purely functional deployment model.

Release version history
NixOS publishes stable releases twice a year, around the end of May and the end of November.

Declarative configuration model
In NixOS, the entire operating system—including the kernel, applications, system packages, and configuration files—is built by the Nix package manager from a description in the Nix language. Building a new version will not overwrite previous versions.

A NixOS system is configured by writing a specification of the functionality that the user wants on their machine in a global configuration file (typically located in ). The following is a minimal specification of a machine running an SSH daemon:

After changing the specification file, the system can be updated using the  command. This does everything necessary to create the new version of the system, including downloading and installing packages, and generating configuration files.

Reliable and atomic upgrades
Since Nix files are pure and declarative, evaluating them will always produce the same result, regardless of what packages or configuration files are on the system.

NixOS has a transactional approach to configuration management, making configuration changes such as upgrades atomic. For example, if an upgrade to a new configuration is interrupted by power failure, the system will still be in a consistent state: it will either boot in the old or the new configuration.

Rollbacks
If, after a system update, the new configuration is undesirable, it can be rolled back using a special command. Every system configuration version automatically shows up in the system boot menu. If the new configuration crashes or does not boot properly, an older version can be selected. Rollbacks are lightweight operations that do not involve files being restored from copies.

Reproducible system configurations
NixOS's declarative configuration model makes it easy to reproduce a system configuration on another machine. Copying the configuration file to the target machine and running the system update command generates the same system configuration (kernel, applications, system services, and so on) except for parts of the system not managed by the package manager, such as user data.

Source-based model with binary cache
The Nix build language used by NixOS specifies how to build packages from source. This makes it easy to adapt the system to user needs. However, building from source being a slow process, the package manager automatically downloads pre-built binaries from a cache server when they are available. It is possible to disable the binary cache and force building from source by using  as an argument. This gives the flexibility of a source-based package management model, with the efficiency of a binary model.

Consistency
The Nix package manager ensures that the running system is consistent with the logical specification of the system, meaning that it will rebuild all packages that need to be rebuilt. For instance, if the kernel is changed, then the package manager will ensure that external kernel modules will be rebuilt. Similarly, when a library is updated, it ensures that all the system packages use the new version, even packages statically linked to it.

Multi-user package management
There is no need for special privileges to install software in NixOS. In addition to the system-wide profile, every user has a dedicated profile in which they can install packages. Nix also allows multiple versions of a package to coexist, so different users can have different versions of the same package installed in their respective profiles. If two users install the same version of a package, only one copy will be built or downloaded. Nix's security model ensures that this is secure, because only the users explicitly trusted by the system configuration are allowed to use build parameters that would allow them to control the content of a derivation's output (such as adding impurities to the sandbox, or using an untrusted substituter). Without those parameters, paths can only be substituted from a substituter trusted by the system, or a local sandboxed build which is implicitly trusted.

Implementation
NixOS is based on the Nix package manager, which stores all packages in isolation from each other in the package store.

Installed packages are identified by a cryptographic hash of all input used for their build. Changing the build instructions of a package modifies its hash, and that will result in a different package being installed in the package store. This system is also used to manage configuration files, ensuring that newer configurations do not overwrite older ones.

An implication of this is that NixOS does not follow the Filesystem Hierarchy Standard. The only exceptions are that a /bin/sh symlink is created to the version of bash in the Nix store (e.g. ), and while NixOS does have an /etc directory to keep system-wide configuration files, most files in that directory are symlinks to generated files in /nix/store, such as. Not using global directories such as /bin is part of what allows multiple versions of a package to coexist.

Reception
Jesse Smith, reviewing NixOS 15.09 for DistroWatch Weekly in 2015, wrote: "I very much like the way NixOS takes the worry out of upgrading packages by placing each change in its own "generation" and I found, from the end user's point of view, NixOS worked just the same as any other Linux distribution. Setting up NixOS is not for beginners, and I do not think NixOS is intended to be used as a general purpose desktop operating system. But what NixOS does do is give us a useful playground in which to examine the Nix package manager and I think this is very interesting technology which deserves further exploration and adoption by additional distributions."

A 2022 review of NixOS 21.11 "Porcupine" in Full Circle magazine concluded: "Overall NixOS Gnome 21.11 impresses as serious, neat and elegant. If you are a fan of the unmodified Gnome desktop, then you will find a lot to like here. The downside of this distribution is the steep learning curve for package management, including updates and the like. No matter which distribution you come from, you will have much to learn to be able to make Nix work well for you on the command-line."

NixOS 22.11 "Raccoon" reviewed by Liam Proven at The Register:

"Compared to reports of NixOS from just two or three years ago, we found it was very simple to get it installed and working. This suggests that the tools are maturing well and reaching a certain level of polish, but from a first-time perspective we have no prior baseline to compare against. This is very much not a traditional distro, or even a traditional Unix, but it works and we can see the appeal."

NixOS 23.11 "Tapir" reviewed by Jesse Smith at DistroWatch:

"NixOS is a rare gem in that I don't think I ran into any errors while I was using it. The distribution was stable, it worked well with my hardware, and I didn't run into a single issue while running it. I feel NixOS is well worth a try, especially if you're a system administrator and want to deploy (or maintain) identical distributions across multiple machines."