Skip to content

Commit

Permalink
nixos/postgresqlBackup: add --rsyncable to compression programs
Browse files Browse the repository at this point in the history
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 40c3d65)
  • Loading branch information
Scrumplex authored and rycee committed Dec 9, 2023
1 parent 3523f53 commit c7bc140
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nixos/modules/services/backup/postgresql-backup.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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}";
Expand Down

0 comments on commit c7bc140

Please sign in to comment.