fix(restic): fix restic path handling
Generating a list of paths for restic to backup introduces some issues: - restic matches incremental backups by paths, changing paths cause new backups - logs and a lot of restic commands print all the paths, which makes it basically unusable Thus I've reverted to using static `paths` and excluding patterns via the `--exclude-file` argument. To reduce files to backup from `~/dev`, a preStart job was added to the systemd service: It clones the directory via `rsync` with `.gitignore` files being respected.
This commit is contained in:
parent
3a0c9a91e8
commit
7799ef1131
2 changed files with 24 additions and 21 deletions
|
@ -14,7 +14,6 @@ in {
|
|||
|
||||
services.restic.backups.full = resticLib.resticConfig {
|
||||
name = "home-pc";
|
||||
ripgrep = true;
|
||||
paths = [ "/etc/nixos" "/var/lib" "/home" ];
|
||||
ignorePatterns = [
|
||||
"/var/lib/systemd"
|
||||
|
@ -40,8 +39,23 @@ in {
|
|||
"/home/felschr/media"
|
||||
"/home/felschr/sync"
|
||||
"/home/felschr/keybase"
|
||||
"/home/felschr/dev" # backup ~/dev-backup instead
|
||||
];
|
||||
timerConfig.OnCalendar = "0/4:00:00";
|
||||
extraPruneOpts = [ "--keep-last 6" ];
|
||||
};
|
||||
|
||||
# extra handling for dev folder to respect .gitignore files:
|
||||
systemd.services."restic-backups-full" = {
|
||||
preStart = ''
|
||||
rm -rf /home/felschr/dev-backup
|
||||
${pkgs.rsync}/bin/rsync -a \
|
||||
--filter=':- .gitignore' \
|
||||
--exclude 'nixpkgs' \
|
||||
/home/felschr/dev/* /home/felschr/dev-backup
|
||||
'';
|
||||
postStart = ''
|
||||
rm -rf /home/felschr/dev-backup
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue