nixos/postgresql-backup: do not enable assertions when module is disabled

This commit is contained in:
Sandro Jäckel
2025-03-03 22:46:30 +01:00
parent 8062f8a4e8
commit d7fbdf54e1

View File

@@ -152,7 +152,8 @@ in
};
config = lib.mkMerge [
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
assertions = [
{
@@ -167,16 +168,17 @@ in
message = "config.services.postgresqlBackup.compressionLevel must be set between 1 and 9 for gzip and 1 and 19 for zstd";
}
];
}
(lib.mkIf cfg.enable {
systemd.tmpfiles.rules = [
"d '${cfg.location}' 0700 postgres - - -"
];
})
(lib.mkIf (cfg.enable && cfg.backupAll) {
}
(lib.mkIf cfg.backupAll {
systemd.services.postgresqlBackup = postgresqlBackupService "all" "pg_dumpall ${cfg.pgdumpOptions}";
})
(lib.mkIf (cfg.enable && !cfg.backupAll) {
(lib.mkIf (!cfg.backupAll) {
systemd.services = lib.listToAttrs (
map (
db:
@@ -190,7 +192,8 @@ in
) cfg.databases
);
})
];
]
);
meta.maintainers = with lib.maintainers; [ Scrumplex ];
}