NIXOS
Geek out with NixOS
Mats Tage Axelsson shows you how easy it is to use NixOS and the challenges of installing new applications. All 100,000 packages.
OUR EXPERT
Mats Tage Axelsson is still searching for that elusive ideal way to run his computer and reach OS nirvana. Changing all aspects of his system, he may soon succeed.
QUICK TIP
Try NixPackage Managerfirst – you can create all the files needed for a fully-fledged NixOS system to rock your world. The files hardly differ at all when you eventually migrate.
Distributions pop up like mushrooms in autumn, with most being new spins of the main ones: Debian, Ubuntu and Red Hat. The major differences are the package manager, choice of desktop and default software. Maintainers aim new spins at specific users – Kali Linux for security professionals springs to mind.
These distros all deliver binary programs, a practice that means they are not optimised. Instead, they work on all the platforms you choose. Others have a recipe approach, where the system describes how to compile your package for the current system. Gentoo and Arch use this approach. They both require effort to install; well worth it, according to their most fervent users.
You can spend your entire life arguing which approach is better and get nowhere. It all depends on your needs. The same goes for NixOS. All they provide are recipes to compile your packages and the system compiles the package on install by default. However, most users will probably use the cache stores, where it can pick a suitable binary. The big difference for NixOS is that you have atomic upgrades and rollbacks. In short, you can go back to where you were with a reboot and choose an older generation.
Choosing a distribution comes down to what you are doing. Nowadays, casual users can pick up Ubuntu and stick with it. The reason is obvious: it is well known and has simple tools to help you choose your apps. It does have one quirk, though: while it uses the Debian APT system for package management, it also defaults to using Snaps for many parts of the system and you can also choose a Flatpak or an AppImage. This isn’t necessarily bad, but it is a mess.
What is NixOS?
In short, NixOS uses the Nix Package Manager to handle packages. The most interesting part is not that it uses its own scripting language to achieve this. What is fascinating is that when installed, all binaries sit in a store, separate from the structure defined by the Linux Standard Base. Your /usr, /var, /opt and so on.
Once you use the Nix Package Manager, you have to learn how to handle generations to help you save disk space.
With the experimental feature ‘commands’, you can run any shell with a single command, compiled and installed on the fly.
NixOS instead links any binaries out of the store into the directories required. It is so clever that you can have several versions of the same applications and even libraries installed in parallel. This takes care of dependency hell but comes with its own challenges – namely, each application might install the same package as another. And you end up with a lot of copies of binaries – bit-identical copies.