From 0aaf428fde038183adfb433dbbc8688b5ef0eb6c Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Sun, 26 Nov 2023 13:22:51 +0100 Subject: [PATCH] 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 --- nixos/modules/services/backup/postgresql-backup.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/backup/postgresql-backup.nix b/nixos/modules/services/backup/postgresql-backup.nix index d3c6f3104fc5..8941386bdefb 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}";