NixOS is a Linux distribution with unique approach to package and configuration management. Built on top of the Nix package manager, it is completely declarative and makes upgrading systems reliable.

The Nix package manager uses cryptographic hashes in order to generate unique paths to the resources that it manages. From the config file(configuration.nix) it generates something that looks like this:

/nix/store/0cg52ncqn9lajgdy4njma3wk7lf3591d-systemd-212.tar

What are the benefits of NixOS?

Reproducible system configurations (immutable deployments)

You can copy a configuration from a machine to a similar machine and get the same system. This is ideal for making changes on test machines before applying changes on production machines or for deployments. There is a dedicated tool for reproducible deployments called NixOps.

Install multiple versions of applications

You can have multiple versions of the same application installed without any side effects.

Reliable upgrades

While the configuration remains the same, you can upgrade your system safely to always obtain the same result, as if it were a new, fresh installation.

Atomic upgrades

Changes in a configuration are made in a transactional way, thus they are atomic, and changes are only applied when the transaction is finished. For instance, if an upgrade is interrupted or fails, the previous state continues to work.

Freedom

You will have no fear of upgrading because in NixOS an upgrade will not break anything. You will not be afraid to upgrade because rollbacks are easy. If something doesn’t work you can always go back safely and reliably. Reliability is the key.

Rollbacks

You can always rollback to a previous state. This is possible because a new configuration never overwrites a previous one. Old installations and configurations are kept simultaneously on the disk. Rolling back to an old configuration is just updating of symbolic links.

Test changes safely

Thanks to the rollback capabilities and simultaneous configurations, NixOS allows you to test a configuration, and if doesn’t work just roll it back without fear that it will break anything.

Consistency

When a package or configuration changes, all the necessary packages or dependencies are rebuilt too. The same happens with the kernel and the modules . When a library is updated, all the packages that use it are linked to the new version.

A lot of time gets wasted investigating issues that are related to differences between environments. Example: QA team 1 has changed the Java version in test env 3 and this mysteriously breaks the testing of QA team 2. With NixOS this will be avoided because the cryptographic hashes would’ve detected the difference in the configurations.

Comments