Service-specific upgrade procedures and notes.
When upgrading Nextcloud major versions, the database needs to be prepared:
-
Connect to host
ssh marulk
-
Connect to database
sudo su - postgres -c psql
-
Copy database (replace version numbers as needed)
CREATE DATABASE nextcloud30 WITH TEMPLATE nextcloud29;
-
Grant access
GRANT ALL PRIVILEGES ON DATABASE nextcloud30 to nextcloud;
-
Update
currentDatabaseinmodules/nixos/nextcloud/default.nix -
Rebuild and switch
nixos-rebuild switch --flake .#marulk
When upgrading NixOS versions (e.g., 24.11 to 25.05):
-
Update flake inputs in
flake.nix:nixpkgs.urlnixpkgs-stable.urlhome-manager.url(match release)stylix.url(match release)nixvim.url(match release)
-
Update flake lock
nix flake update
-
Check for breaking changes in release notes
-
Build and test
nix flake check nixos-rebuild build --flake .#<machine> -
Update
system.stateVersiononly for new installs (not existing machines)
Home Assistant upgrades are typically automatic, but major version changes may require:
- Backup the configuration
- Check release notes for breaking changes
- Rebuild the system
- Verify integrations still work
- Always run
nix flake checkbefore deploying - Test in a VM when possible:
nixos-rebuild build-vm --flake .#<machine> - Keep the previous generation available for rollback
- Check service logs after upgrade:
journalctl -u <service> -f