nixos/postgresql-backup: do not enable assertions when module is disabled
This commit is contained in:
@@ -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 ];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user