about summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2023-11-26 13:22:51 +0100
committerRobert Helgesson <robert@rycee.net>2023-12-09 12:06:59 +0100
commitc7bc140d4c164c32681f240c7a2cc440c97acc76 (patch)
tree2a4ce24706669f1287bbba6727907b7a4ca704e1 /nixos/modules
parent3523f53d05bc093a6cd260ed3d0ad98fd0a777d1 (diff)
nixos/postgresqlBackup: add --rsyncable to compression programs
The --rsyncable option changes the behavior of gzip/zstd so that the
resulting files can be incrementally backed up easily. Tools like Borg,
rsync and xdelta can make use their deduplication/diff mechanisms more
easily.

In my local testing, this resulted in a 2% size increase for backup
files.

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
(cherry picked from commit 40c3d65bdff49b818073d7c92cf0ec6d7fab2bba)
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/services/backup/postgresql-backup.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/nixos/modules/services/backup/postgresql-backup.nix b/nixos/modules/services/backup/postgresql-backup.nix
index d3c6f3104fc54..8941386bdefb0 100644
--- a/nixos/modules/services/backup/postgresql-backup.nix
+++ b/nixos/modules/services/backup/postgresql-backup.nix
@@ -17,8 +17,8 @@ let
 
       compressCmd = getAttr cfg.compression {
         "none" = "cat";
-        "gzip" = "${pkgs.gzip}/bin/gzip -c -${toString cfg.compressionLevel}";
-        "zstd" = "${pkgs.zstd}/bin/zstd -c -${toString cfg.compressionLevel}";
+        "gzip" = "${pkgs.gzip}/bin/gzip -c -${toString cfg.compressionLevel} --rsyncable";
+        "zstd" = "${pkgs.zstd}/bin/zstd -c -${toString cfg.compressionLevel} --rsyncable";
       };
 
       mkSqlPath = prefix: suffix: "${cfg.location}/${db}${prefix}.sql${suffix}";