summary refs log tree commit diff
path: root/nixos/tests/postgresql-wal-receiver.nix
diff options
context:
space:
mode:
authorAaron Andersen <aaron@fosslib.net>2020-08-01 10:02:14 -0400
committerAaron Andersen <aaron@fosslib.net>2020-08-26 17:06:48 -0400
commit2a4426560813b702a302dadbe53e684d1ab03f47 (patch)
treee81163fad7da7e1ea5dd066b12ed356549d15a4f /nixos/tests/postgresql-wal-receiver.nix
parent5bd2c3719a5af1a4a8d430e5e33ba3092bdb9f7e (diff)
downloadnixpkgs-2a4426560813b702a302dadbe53e684d1ab03f47.tar
nixpkgs-2a4426560813b702a302dadbe53e684d1ab03f47.tar.gz
nixpkgs-2a4426560813b702a302dadbe53e684d1ab03f47.tar.bz2
nixpkgs-2a4426560813b702a302dadbe53e684d1ab03f47.tar.lz
nixpkgs-2a4426560813b702a302dadbe53e684d1ab03f47.tar.xz
nixpkgs-2a4426560813b702a302dadbe53e684d1ab03f47.tar.zst
nixpkgs-2a4426560813b702a302dadbe53e684d1ab03f47.zip
nixos/postgresql: replace extraConfig option with settings option
Diffstat (limited to 'nixos/tests/postgresql-wal-receiver.nix')
-rw-r--r--nixos/tests/postgresql-wal-receiver.nix24
1 files changed, 12 insertions, 12 deletions
diff --git a/nixos/tests/postgresql-wal-receiver.nix b/nixos/tests/postgresql-wal-receiver.nix
index 3be95187fe2..432b46234f9 100644
--- a/nixos/tests/postgresql-wal-receiver.nix
+++ b/nixos/tests/postgresql-wal-receiver.nix
@@ -14,13 +14,10 @@ let
         baseBackupDir = "/tmp/pg_basebackup";
         walBackupDir = "/tmp/pg_wal";
         atLeast12 = lib.versionAtLeast pkg.version "12.0";
-        restoreCommand = ''
-          restore_command = 'cp ${walBackupDir}/%f %p'
-        '';
 
         recoveryFile = if atLeast12
             then pkgs.writeTextDir "recovery.signal" ""
-            else pkgs.writeTextDir "recovery.conf" "${restoreCommand}";
+            else pkgs.writeTextDir "recovery.conf" "restore_command = 'cp ${walBackupDir}/%f %p'";
 
       in {
         name = "postgresql-wal-receiver-${postgresqlPackage}";
@@ -30,14 +27,17 @@ let
           services.postgresql = {
             package = pkg;
             enable = true;
-            extraConfig = ''
-              wal_level = archive # alias for replica on pg >= 9.6
-              max_wal_senders = 10
-              max_replication_slots = 10
-            '' + lib.optionalString atLeast12 ''
-              ${restoreCommand}
-              recovery_end_command = 'touch recovery.done'
-            '';
+            settings = lib.mkMerge [
+              {
+                wal_level = "archive"; # alias for replica on pg >= 9.6
+                max_wal_senders = 10;
+                max_replication_slots = 10;
+              }
+              (lib.mkIf atLeast12 {
+                restore_command = "cp ${walBackupDir}/%f %p";
+                recovery_end_command = "touch recovery.done";
+              })
+            ];
             authentication = ''
               host replication ${replicationUser} all trust
             '';