about summary refs log tree commit diff
path: root/nixos/modules/services/backup/postgresql-backup.nix
diff options
context:
space:
mode:
authorAaron Andersen <aaron@fosslib.net>2019-02-24 09:01:07 -0500
committerAaron Andersen <aaron@fosslib.net>2019-04-13 07:00:57 -0400
commit7b2be9b328a469e3c31c5ff518bb9377d0d8c7ce (patch)
tree7859a698ff15d13e1a29f8a916fa17625fed432f /nixos/modules/services/backup/postgresql-backup.nix
parent64fdacc5809e0560ad5149f92576e5eebaafc16a (diff)
downloadnixlib-7b2be9b328a469e3c31c5ff518bb9377d0d8c7ce.tar
nixlib-7b2be9b328a469e3c31c5ff518bb9377d0d8c7ce.tar.gz
nixlib-7b2be9b328a469e3c31c5ff518bb9377d0d8c7ce.tar.bz2
nixlib-7b2be9b328a469e3c31c5ff518bb9377d0d8c7ce.tar.lz
nixlib-7b2be9b328a469e3c31c5ff518bb9377d0d8c7ce.tar.xz
nixlib-7b2be9b328a469e3c31c5ff518bb9377d0d8c7ce.tar.zst
nixlib-7b2be9b328a469e3c31c5ff518bb9377d0d8c7ce.zip
nixos/postgresqlBackup: replace deprecated usage of PermissionsStartOnly
see https://github.com/NixOS/nixpkgs/issues/53852
Diffstat (limited to 'nixos/modules/services/backup/postgresql-backup.nix')
-rw-r--r--nixos/modules/services/backup/postgresql-backup.nix11
1 files changed, 5 insertions, 6 deletions
diff --git a/nixos/modules/services/backup/postgresql-backup.nix b/nixos/modules/services/backup/postgresql-backup.nix
index 11efa47ec5b2..17b410a97f3e 100644
--- a/nixos/modules/services/backup/postgresql-backup.nix
+++ b/nixos/modules/services/backup/postgresql-backup.nix
@@ -14,11 +14,6 @@ let
 
       requires = [ "postgresql.service" ];
 
-      preStart = ''
-        mkdir -m 0700 -p ${cfg.location}
-        chown postgres ${cfg.location}
-      '';
-
       script = ''
         umask 0077 # ensure backup is only readable by postgres user
 
@@ -32,7 +27,6 @@ let
 
       serviceConfig = {
         Type = "oneshot";
-        PermissionsStartOnly = "true";
         User = "postgres";
       };
 
@@ -107,6 +101,11 @@ in {
         message = "config.services.postgresqlBackup.backupAll cannot be used together with config.services.postgresqlBackup.databases";
       }];
     }
+    (mkIf cfg.enable {
+      systemd.tmpfiles.rules = [
+        "d '${cfg.location}' 0700 postgres - - -"
+      ];
+    })
     (mkIf (cfg.enable && cfg.backupAll) {
       systemd.services.postgresqlBackup =
         postgresqlBackupService "all" "${config.services.postgresql.package}/bin/pg_dumpall";