git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/postgresqlBackup: Use PATH for readability
commitc586e42763e0f093d16b4b655759cb340171ad42 authorRobert Hensing <robert@roberthensing.nl> dateFri 4 Jun 2021, 17:28 (5 years ago) parentc7b3272
1 file changed+6−4
nixos/modules/services/backup/postgresql-backup.nix+6−4
nixos/modules/services/backup/postgresql-backup.nix+6−4
@@ -14,15 +14,17 @@ let
1414
1515 requires = [ "postgresql.service" ];
1616
17+ path = [ pkgs.coreutils pkgs.gzip config.services.postgresql.package ];
18+
1719 script = ''
1820 umask 0077 # ensure backup is only readable by postgres user
1921
2022 if [ -e ${cfg.location}/${db}.sql.gz ]; then
21− ${pkgs.coreutils}/bin/mv ${cfg.location}/${db}.sql.gz ${cfg.location}/${db}.prev.sql.gz
23+ mv ${cfg.location}/${db}.sql.gz ${cfg.location}/${db}.prev.sql.gz
2224 fi
2325
2426 ${dumpCmd} | \
25− ${pkgs.gzip}/bin/gzip -c > ${cfg.location}/${db}.sql.gz
27+ gzip -c > ${cfg.location}/${db}.sql.gz
2628 '';
2729
2830 serviceConfig = {
@@ -113,12 +115,12 @@ in {
113115 })
114116 (mkIf (cfg.enable && cfg.backupAll) {
115117 systemd.services.postgresqlBackup =
116− postgresqlBackupService "all" "${config.services.postgresql.package}/bin/pg_dumpall";
118+ postgresqlBackupService "all" "pg_dumpall";
117119 })
118120 (mkIf (cfg.enable && !cfg.backupAll) {
119121 systemd.services = listToAttrs (map (db:
120122 let
121− cmd = "${config.services.postgresql.package}/bin/pg_dump ${cfg.pgdumpOptions} ${db}";
123+ cmd = "pg_dump ${cfg.pgdumpOptions} ${db}";
122124 in {
123125 name = "postgresqlBackup-${db}";
124126 value = postgresqlBackupService db cmd;