This article will introduce NixOS, a not well known Linux distro, but which nevertheless holds some interesting and modern features in its core.

The most important are:

  • Atomic upgrades and installations
  • Possibility to rollback to a previous configuration
  • Configuration based on a functional language


NixOS is a Linux distribution based on the functional package management system called Nix which aims to solve the common issues that makes traditional Linux systems hard to maintain for modern applications and requirements.

  1. Atomic upgrade and installations
    The main feature of the NixOS system is that packages are not installed in the common directories, according to the Filesystem Hierarchy Standard, but inside /nix/store/ in its own subfolder with a name starting with a hash code and followed by the software name. There, all relative dependences and configuration files are kept.
    By making un upgrade, be it a system or an application one, you never overwrite any pre-existing file or create problems in some other application; as a matter of fact you can have several versions of the same software, for instance different versions of HTTP Apache, along with their dependences, without having to implement a container solution – which by the way is supported in NixOS.

  2. Possibility to rollback to a previous configuration
    It is the most important characteristic of this system to make possible rolling back to a previous state of configuration without the need to pre-arrange any snapshot through software or hardware solution; of course the only preconditions are no corrupted boot loader and no hardware issues.

  3. Configuration based on a functional language
    True an idempotent, functional language we can configure the system by editing files with the nix extension and then apply the configuration. As already mentioned, once the configuration is applied it is possible to rollback to a previous one and not only, also to transfer the configuration to another NixOS system, apply it and obtain the same results. The goal is also to free the administrator from directly editing system configuration files.

Configuration examples

  1. Adding additional features
    Let’s say we want to install the KDE desktop manager, in this case we don’t need to use any command to download and install the relative package, like commonly in Linux, we can just edit the main configuration file configuration.nix in this way: NixOS reconfiguration

    This to enable the needed feature, then we have to run the:

    # nixos-rebuild switch

    Now, if this is the second main configuration change after installation, when we reboot next we will encounter the following screen if we choose not to load the default configutation:

    All configurations at boot
    Therefore if we wish we can boot the previous configuration.
    NOTE: we haven’t updated any kernel here and yet we can choose to revert to a previous configuration.

    1. Enabling a service
      Through the below configuration file we can enable or disable a service, for instance we wish to disable the Firewall (iptables):
      rebuilding configuration

      This is similar to Anybody who has some exposure to Puppet or similar system management tools might have noticed that in this case it is easier to apply the desired configuration.

  2. Installing a specific package
    We can of course install any desired package, from the Nix Packages collection (Nixpkgs) which is a set of over 40‚ÄČ000 packages.

    The command is

    # nix-env --install <package_name>;

    And no, we don’t have any rpm or deb package here.

    NixOS – installing a package

  3. Further configuration on packages
    For example, we want gcc to not be upgraded, in this case we need to issue the command:

    # nix-env --set-flag keep true gcc

  4. Rolling back to a previous configuraton
    We have found something we don’t like after applying a system configuration, no problem, we can rollback the change by typing the below (and pressing ENTER of course).:

    # nixos-rebuild switch --rollback


NixOS is a pure functional Linux distribution and different fromt the mainstream ones and it’s especially conceived to overcome the challenges posed by modern applications and systems complexities; certainly it deserves a try.