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 = [
|
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";
|
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 = [
|
systemd.tmpfiles.rules = [
|
||||||
"d '${cfg.location}' 0700 postgres - - -"
|
"d '${cfg.location}' 0700 postgres - - -"
|
||||||
];
|
];
|
||||||
})
|
}
|
||||||
(lib.mkIf (cfg.enable && cfg.backupAll) {
|
|
||||||
|
(lib.mkIf cfg.backupAll {
|
||||||
systemd.services.postgresqlBackup = postgresqlBackupService "all" "pg_dumpall ${cfg.pgdumpOptions}";
|
systemd.services.postgresqlBackup = postgresqlBackupService "all" "pg_dumpall ${cfg.pgdumpOptions}";
|
||||||
})
|
})
|
||||||
(lib.mkIf (cfg.enable && !cfg.backupAll) {
|
|
||||||
|
(lib.mkIf (!cfg.backupAll) {
|
||||||
systemd.services = lib.listToAttrs (
|
systemd.services = lib.listToAttrs (
|
||||||
map (
|
map (
|
||||||
db:
|
db:
|
||||||
@@ -190,7 +192,8 @@ in
|
|||||||
) cfg.databases
|
) cfg.databases
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
];
|
]
|
||||||
|
);
|
||||||
|
|
||||||
meta.maintainers = with lib.maintainers; [ Scrumplex ];
|
meta.maintainers = with lib.maintainers; [ Scrumplex ];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user