Upgrading Postgresql on NixOS
I fail to remember this every time, so I'm putting it here forever!
Update new and old path / version values as needed.
install -d -m 0700 -o postgres -g postgres "/var/lib/postgresql/17"
sudo -u postgres /nix/store/infd8iz1j1n8shfvcgf6cdqcavynaya3-postgresql-and-plugins-17.5/bin/initdb -D /var/lib/postgresql/17
sudo -u postgres /nix/store/infd8iz1j1n8shfvcgf6cdqcavynaya3-postgresql-and-plugins-17.5/bin/pg_upgrade -b /nix/store/9rl8l079qbn42a69f26qrq1hm9zs8jj6-postgresql-and-plugins-16.9/bin -B /nix/store/infd8iz1j1n8shfvcgf6cdqcavynaya3-postgresql-and-plugins-17.5/bin -d /var/lib/postgresql/16 -D /var/lib/postgresql/17