{ pkgs, lib, config, ... }: let backup_new_path = "/mnt/raid/backup/hoyer/new/"; restic_repo = "/mnt/backup/restic-repo"; in { services.restic.backups.hoyer_new = { repository = restic_repo; passwordFile = config.sops.secrets.backup-pw.path; timerConfig = { OnCalendar = "daily"; FixedRandomDelay = true; RandomizedDelaySec = "4h"; Persistent = true; }; paths = [ backup_new_path ]; pruneOpts = [ "-g host,paths" "--keep-daily 7" "--keep-weekly 4" "--keep-monthly 3" "--keep-yearly 1" ]; backupPrepareCommand = '' HOME=/root ${pkgs.rsync}/bin/rsync -e "${pkgs.openssh}/bin/ssh" --exclude-from /root/excludelist --no-specials --no-devices --numeric-ids --delete-after --partial -axz backup@mx.surfsite.org:/{etc,var,home,root} ${backup_new_path} ''; }; services.restic.backups.self = { repository = restic_repo; #repository = "s3:nas2a6e8f.myqnapcloud.com:8081/backup"; passwordFile = config.sops.secrets.backup-pw.path; timerConfig = { OnCalendar = "daily"; FixedRandomDelay = true; RandomizedDelaySec = "4h"; Persistent = true; }; paths = [ "/etc" "/var" "/home" "/root" "/persist" config.services.samba.shares.Qmultimedia.path ]; extraBackupArgs = let ignorePatterns = [ "/mnt/raid/backup" "/mnt/backup" "/mnt/snap" "/var/cache" "/home/*/.local/share/Trash" "/home/*/.cache" "/home/*/Downloads" "/home/*/.npm" "/home/*/.local/share/containers" ".cache" ".tmp" ".log" ".Trash" ]; ignoreFile = builtins.toFile "ignore" (lib.foldl (a: b: a + "\n" + b) "" ignorePatterns); in [ "--exclude-file=${ignoreFile}" ]; pruneOpts = [ "-g host,paths" "--keep-daily 7" "--keep-weekly 4" "--keep-monthly 3" "--keep-yearly 1" ]; }; }