From abfc0442562ea30d13d76694ae14d3fa31c3873d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Schr=C3=B6ter?= Date: Fri, 26 Aug 2022 16:25:39 +0200 Subject: [PATCH] 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. --- services/restic/home-pc.nix | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/services/restic/home-pc.nix b/services/restic/home-pc.nix index c33c004..6ff7832 100644 --- a/services/restic/home-pc.nix +++ b/services/restic/home-pc.nix @@ -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 - ''; }; }