NixOS is a Linux distro that builds on a purely functional package manager: Nix. Nix stores packages at the directory /nix/store as values in a functional programming language. E.g.,
Where b6gv… is a cryptographic hash of the package’s build dependency graph.
This comes with a couple of advantages:
When installing NixOS, the entire distro (kernel, apps, configs, etc) is built from a configuration file by the Nix package manager. This means that with one command,
you can build your whole system on a new machine.
The Nix installer creates a single-user installation by default, so to run a multi-user installation we include a daemon that manages the store and with better isolation for local builds,
sudo curl -L https://nixos.org/nix/install | sh -s -- --daemon
If you want to undo a nix-env operation there are several nice ways to interact with the package manager,
nix-env --list-generations nix-env --rollback nix-env --switch-generation 43
nix-env operations such as upgrades (-u) and uninstall (-e) never actually delete packages from the system. All they do is to create a new user environment that no longer contains symlinks to the “deleted” packages. To delete non-current generations of your profile,
nix-env --delete-generations old nix-env --delete-generations 10 11 14
After removing appropriate old generations you can run the garbage collector,
There is a command to run all above in one,
After trying out Nix, I think that the package manager is interesting and it’s great that you can specify and build your entire system from it. The reproducibility is fantastic. However, the flexibility in using the system with other packages, binaries, etc, is not very good.