nixos/postgresql-backup: add pgdumpAllOptions

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu
2025-08-29 22:11:52 +02:00
parent 4a701da5c0
commit 82d2631e1c
2 changed files with 15 additions and 2 deletions

View File

@@ -124,7 +124,19 @@ in
type = lib.types.separatedString " "; type = lib.types.separatedString " ";
default = "-C"; default = "-C";
description = '' description = ''
Command line options for pg_dump or pg_dumpall. Command line options for pg_dump. This options is not used if
`config.services.postgresqlBackup.backupAll` is enabled. Note that
config.services.postgresqlBackup.backupAll is also active, when no
databases where specified.
'';
};
pgdumpAllOptions = lib.mkOption {
type = lib.types.separatedString " ";
default = "";
description = ''
Command line options for pg_dumpall. This options is not used if
`config.services.postgresqlBackup.backupAll` is disabled.
''; '';
}; };
@@ -175,7 +187,7 @@ in
} }
(lib.mkIf cfg.backupAll { (lib.mkIf cfg.backupAll {
systemd.services.postgresqlBackup = postgresqlBackupService "all" "pg_dumpall ${cfg.pgdumpOptions}"; systemd.services.postgresqlBackup = postgresqlBackupService "all" "pg_dumpall ${cfg.pgdumpAllOptions}";
}) })
(lib.mkIf (!cfg.backupAll) { (lib.mkIf (!cfg.backupAll) {

View File

@@ -66,6 +66,7 @@ let
enable = true; enable = true;
databases = lib.optional (!backupAll) "postgres"; databases = lib.optional (!backupAll) "postgres";
pgdumpOptions = "--restrict-key=ABCDEFGHIJKLMNOPQRSTUVWXYZ"; pgdumpOptions = "--restrict-key=ABCDEFGHIJKLMNOPQRSTUVWXYZ";
pgdumpAllOptions = "--restrict-key=ABCDEFGHIJKLMNOPQRSTUVWXYZ";
}; };
}; };