From 82d2631e1c03e7bc8507e786bdb0e34b61c0d968 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Fri, 29 Aug 2025 22:11:52 +0200 Subject: [PATCH] nixos/postgresql-backup: add pgdumpAllOptions Signed-off-by: Sefa Eyeoglu --- .../services/backup/postgresql-backup.nix | 16 ++++++++++++++-- nixos/tests/postgresql/postgresql.nix | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/backup/postgresql-backup.nix b/nixos/modules/services/backup/postgresql-backup.nix index b05435b4db36..fb2c90f8b2e0 100644 --- a/nixos/modules/services/backup/postgresql-backup.nix +++ b/nixos/modules/services/backup/postgresql-backup.nix @@ -124,7 +124,19 @@ in type = lib.types.separatedString " "; default = "-C"; 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 { - systemd.services.postgresqlBackup = postgresqlBackupService "all" "pg_dumpall ${cfg.pgdumpOptions}"; + systemd.services.postgresqlBackup = postgresqlBackupService "all" "pg_dumpall ${cfg.pgdumpAllOptions}"; }) (lib.mkIf (!cfg.backupAll) { diff --git a/nixos/tests/postgresql/postgresql.nix b/nixos/tests/postgresql/postgresql.nix index a1ea9b8a9028..ce3fb640ae92 100644 --- a/nixos/tests/postgresql/postgresql.nix +++ b/nixos/tests/postgresql/postgresql.nix @@ -66,6 +66,7 @@ let enable = true; databases = lib.optional (!backupAll) "postgres"; pgdumpOptions = "--restrict-key=ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + pgdumpAllOptions = "--restrict-key=ABCDEFGHIJKLMNOPQRSTUVWXYZ"; }; };