{ config, pkgs, ... }: { services.restic.backups = let snapshotDir = "/srv/snapshots"; homeDir = "${snapshotDir}/home"; boxUser = "u384702-sub1"; in { storagebox = { initialize = true; backupPrepareCommand = '' [ -d /srv/snapshots/home ] && ${pkgs.btrfs-progs}/bin/btrfs subvolume delete /srv/snapshots/home; ${pkgs.btrfs-progs}/bin/btrfs subvolume snapshot -r /home /srv/snapshots/home; [ -d /srv/snapshots/srv ] && ${pkgs.btrfs-progs}/bin/btrfs subvolume delete /srv/snapshots/srv; ${pkgs.btrfs-progs}/bin/btrfs subvolume snapshot -r /srv /srv/snapshots/srv; ''; paths = [ snapshotDir ]; exclude = [ "${homeDir}/sils/.cache" "${homeDir}/sils/bulk" "${homeDir}/sils/downloads" ]; extraBackupArgs = [ "--verbose" # Spam log ]; passwordFile = config.age.secrets.resticpass.path; extraOptions = [ "rclone.program='ssh -p 23 ${boxUser}@${boxUser}.your-storagebox.de -i ${config.age.secrets.resticssh.path}'" ]; repository = "rclone: "; # There is only one repository served timerConfig = { Requires = "network-online.target"; OnActiveSec = "30m"; OnUnitInactiveSec = "2h"; Persistent = true; }; }; storagebox-admin = { passwordFile = config.age.secrets.resticpass.path; extraOptions = [ "rclone.program='ssh -p 23 ${boxUser}@${boxUser}.your-storagebox.de'" ]; repository = "rclone: "; # There is only one repository served timerConfig = {}; }; }; }