fix(restic): fix ~/dev backups

Previously, since we created a new copy of ~/dev prior to every backup
run, we caused new ctimes to be set every time which lead to many
changed files on every backup run.
This change removes the deletion of ~/dev-backup after backups and
ensures deleted files get removed from ~/dev-backup as well.
This change should also drastically reduce download bandwidth during prunes.
This commit is contained in:
Felix Schröter 2022-08-26 16:25:39 +02:00
parent ab95f0f47d
commit abfc044256
Signed by: felschr
GPG key ID: 671E39E6744C807D

View file

@ -93,18 +93,19 @@ in {
extraPruneOpts = [ "--keep-last 4" ];
};
# extra handling for dev folder to respect .gitignore files:
# Extra handling for dev folder to respect .gitignore files.
# Do not delete `~/dev-backup` since this leads to changing ctimes
# which would cause otherwise unchanged files to be backed up again.
# Since `--link-dest` is used, file contents won't be duplicated on disk.
systemd.services."restic-backups-full" = {
preStart = ''
rm -rf /home/felschr/dev-backup
${pkgs.rsync}/bin/rsync -a \
${pkgs.rsync}/bin/rsync \
-a --delete \
--filter=':- .gitignore' \
--exclude 'nixpkgs' \
--link-dest=/home/felschr/dev \
/home/felschr/dev/ /home/felschr/dev-backup
'';
postStart = ''
rm -rf /home/felschr/dev-backup
'';
};
}