Today I write about the process of upgrading NixOS from 18.09 (Jellyfish) to 19.03 (Koi), as well as my thoughts on operating system updates in general.

In general, I’ve found that upgrading an operating system to be a very laborious task. Picture the scene. You get a notification on your system saying that a new update is available. It then asks you when you want to schedule that update. You’re obviously busy (playing a game or doing some work) and you say “remind me later”. When later comes around, you’re still busy and at this point you wish that you can just ignore this update forever.

If it’s not the “postpone system update forever” situation, then it’s the actual “updating the system” issue. You run the system update tool, it takes forever to install everything, then it decides to reboot a couple times. If you’re on Windows, it’ll display messages that make you question whether updating was a good idea in the first place:

Updating can be a stressful process. You have to sit and do nothing for a good 30 minutes or so while it updates and you hope there isn’t a power failure while your system updates or everything goes horribly wrong. So what’s the best way to go about updating an entire operating system?

## Updating NixOS

Some time near the end of March, NixOS released their 19.03 version update (from the previous version 18.09 - Don’t you love these consistent easy to follow version numbers?), which included a bunch of fancy new features, in particular it adds the Pantheon desktop environment (which is used primarily by the elementary OS linux distro); Google’s OS login system (lets you log into your computer using a Google account); as well as a new stable channel for the Nix package manager.

Updating from NixOS version 18.09 to version 19.03 is a breeze. The procedure is as follows:

1. Add the NixOS 19.03 channel to your list of installed Nix channels

sudo nix-channel --add https://nixos.org/channels/nixos-19.03 nixos

2. Update the nix-channel

 sudo nix-channel --update

3. Rebuild the system, applying the upgrades

 sudo nixos-rebuild switch --upgrade


And that’s it. That’s the entire system update complete. The system rebuild takes place, downloads the new updates and applies them right then and there using the Nix package manager. But hold up, surely you can’t use the system whilst it’s updating, right? Well, NixOS uses the package manager Nix. Nix is pure. This means that installing a new update will not cause a conflict with the current installed system, meaning all old versions of programs do not interact with the new versions of programs.

Okay, so if the new and old programs don’t conflict, what about a power failure? Well, Nix has you covered again. Each operation that is handled by Nix is atomic, meaning that when a package is updated, there is no point in time where files from an old version and new version are “mixed together”. This also means that if a single package failed to update when upgrading NixOS (say, due to a power failure mid-update), NixOS will just continue updating from where it left off (Unlike say, Windows updates where it reverts the entire system update process if something went wrong during the update)

In conclusion, I personally like the system updating system that NixOS provides for its users - it allows the system to be in use during the updating process, updating is “crash-proof” and overall, it’s easy and simple. Compared to the years of using Windows’ updating system which is annoying (endless nagging), workflow-interrupting (restarting the operating system when you least expect it and you can’t use the computer while it is updating) and not 100% reliable (if the update fails, it reverts the whole update), I believe that NixOS’ updating system is superior.

Written on April 21, 2019