From 39336740e135161cff9fcbacf4316c6f67629894 Mon Sep 17 00:00:00 2001 From: blake Date: Sat, 18 Oct 2025 18:18:03 -0500 Subject: [PATCH] ensure postgres backups exist --- modules/homelab/backups/default.nix | 2 +- modules/homelab/immich/default.nix | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/homelab/backups/default.nix b/modules/homelab/backups/default.nix index 6f0c2b2..a68de50 100644 --- a/modules/homelab/backups/default.nix +++ b/modules/homelab/backups/default.nix @@ -54,7 +54,7 @@ in { databases = config.services.mysql.ensureDatabases; # set to all databases defined in esure databases }; # postgresql backups currently immich is the only user - services.postgresqlBackup = lib.mkIf config.services.postgresql.enable { + services.postgresqlBackup = lib.mkIf (config.services.postgresql.ensureDatabases != []) { enable = true; location = "/var/backup/postgresql"; compression = "zstd"; # optional: "xz", "zstd", "none" diff --git a/modules/homelab/immich/default.nix b/modules/homelab/immich/default.nix index 482c187..182cc3a 100644 --- a/modules/homelab/immich/default.nix +++ b/modules/homelab/immich/default.nix @@ -115,7 +115,9 @@ in { ]; # add postgresql database that is automatically created to the backup list - services.postgresqlBackup.databases = ["immich"]; # set to all databases defined in esure databases + #services.postgresqlBackup.databases = ["immich"]; # set to all databases defined in esure databases + + services.postgresql.ensureDatabases = [service]; # set to all databases defined in esure databases # add to backups homelab.backups.baks = {