Updating to a new version of NixOS

nix ops

published 2024-01-10 21:52

updated 2024-01-10 22:12

Run sheet

  • Read through the release page and note:
    • Backwards incompatibilities
    • New services
    • Borrowed services that have been merged now
    • Deprecated packages
  • run nix flake lock --update-input nixpkgs once before cutting over to the new release number
  • redeploy all systems on current version number to ensure they're still operational
  • Apply any changes necessary before the backwards incompatibilities kick in
    • Upgrade postgresql versions
    • Change any config definitions
  • cut over to the new release version
  • deploy new instances of all machines

I like to go in this order:

curve -> box -> cube -> helix -> lituus

= Upgrading to 23.11 =

I've been "tracking" NixOS releases since 21.05, so this isn't my first rodeo, but this time around has been particularly annoying. This is the start of a checklist for future upgrades.

In particular postgres_11 has been sunset, and two of my servers are currently running postgres 11 😨

Anyways, luckily I'd had to deal with this before and already had a script to upgrade postgres versions on NixOS (God I love that this random throw away script I got from god knows continues to exist in my repo, it's really saving me a lot of headache. I've forgotten so much of what I had learnt, and my workflows continue to save me.)


Upgrade Complete

Optimizer statistics are not transferred by pg_upgrade. Once you start the new server, consider running: /nix/store/k9gp00h6yda1hmyg9zm78rrn57cghpv2-postgresql-15.4/bin/vacuumdb --all --analyze-in-stages }}}