diff options
author | Robert Hensing <robert@roberthensing.nl> | 2021-06-04 17:28:20 +0200 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2021-06-04 17:49:53 +0200 |
commit | c586e42763e0f093d16b4b655759cb340171ad42 (patch) | |
tree | ddc85c0896844fbf22e4af10e198212ecf74a1e0 /nixos | |
parent | c7b3272ca9541392c73525967a5bffd2f08965d2 (diff) | |
download | nixpkgs-c586e42763e0f093d16b4b655759cb340171ad42.tar nixpkgs-c586e42763e0f093d16b4b655759cb340171ad42.tar.gz nixpkgs-c586e42763e0f093d16b4b655759cb340171ad42.tar.bz2 nixpkgs-c586e42763e0f093d16b4b655759cb340171ad42.tar.lz nixpkgs-c586e42763e0f093d16b4b655759cb340171ad42.tar.xz nixpkgs-c586e42763e0f093d16b4b655759cb340171ad42.tar.zst nixpkgs-c586e42763e0f093d16b4b655759cb340171ad42.zip |
nixos/postgresqlBackup: Use PATH for readability
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/backup/postgresql-backup.nix | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/nixos/modules/services/backup/postgresql-backup.nix b/nixos/modules/services/backup/postgresql-backup.nix index 9da2d522a68..8857335a6e5 100644 --- a/nixos/modules/services/backup/postgresql-backup.nix +++ b/nixos/modules/services/backup/postgresql-backup.nix @@ -14,15 +14,17 @@ let requires = [ "postgresql.service" ]; + path = [ pkgs.coreutils pkgs.gzip config.services.postgresql.package ]; + script = '' umask 0077 # ensure backup is only readable by postgres user if [ -e ${cfg.location}/${db}.sql.gz ]; then - ${pkgs.coreutils}/bin/mv ${cfg.location}/${db}.sql.gz ${cfg.location}/${db}.prev.sql.gz + mv ${cfg.location}/${db}.sql.gz ${cfg.location}/${db}.prev.sql.gz fi ${dumpCmd} | \ - ${pkgs.gzip}/bin/gzip -c > ${cfg.location}/${db}.sql.gz + gzip -c > ${cfg.location}/${db}.sql.gz ''; serviceConfig = { @@ -113,12 +115,12 @@ in { }) (mkIf (cfg.enable && cfg.backupAll) { systemd.services.postgresqlBackup = - postgresqlBackupService "all" "${config.services.postgresql.package}/bin/pg_dumpall"; + postgresqlBackupService "all" "pg_dumpall"; }) (mkIf (cfg.enable && !cfg.backupAll) { systemd.services = listToAttrs (map (db: let - cmd = "${config.services.postgresql.package}/bin/pg_dump ${cfg.pgdumpOptions} ${db}"; + cmd = "pg_dump ${cfg.pgdumpOptions} ${db}"; in { name = "postgresqlBackup-${db}"; value = postgresqlBackupService db cmd; |