diff --git a/hosts/idols-aquamarine/restic.nix b/hosts/idols-aquamarine/restic.nix index b3e70033..5f881b24 100644 --- a/hosts/idols-aquamarine/restic.nix +++ b/hosts/idols-aquamarine/restic.nix @@ -5,77 +5,83 @@ let rcloneConfigFile = "/etc/agenix/rclone-conf-for-restic-backup"; in { + # DISABLED: this backup has never worked. It needs three agenix secrets that + # do not exist in nix-secrets yet (`restic-password`, `ssh-key-for-restic-backup`, + # and an rclone config with the `smb-downloads` remote; the existing + # `rclone.conf` secret is only defined for the desktop secret set). Re-enable + # once the secrets are provisioned. + # # https://github.com/NixOS/nixpkgs/blob/nixos-26.05/nixos/modules/services/backup/restic.nix - services.restic.backups = { - homelab-backup = { - inherit passwordFile; - initialize = true; # Initialize the repository if it doesn't exist. - repository = "rclone:smb-downloads:/Downloads/kubevirt-backup/"; # backup to a rclone remote + /* + services.restic.backups = { + homelab-backup = { + inherit passwordFile; + initialize = true; # Initialize the repository if it doesn't exist. + repository = "rclone:smb-downloads:/Downloads/kubevirt-backup/"; # backup to a rclone remote - # rclone related - # rcloneOptions = { - # bwlimit = "100M"; # Limit the bandwidth used by rclone. - # }; - inherit rcloneConfigFile; + # rclone related + # rcloneOptions = { + # bwlimit = "100M"; # Limit the bandwidth used by rclone. + # }; + inherit rcloneConfigFile; - # Which local paths to backup, in addition to ones specified via `dynamicFilesFrom`. - paths = [ - "/tmp/restic-backup-temp" - ]; - # - # A script that produces a list of files to back up. The - # results of this command are given to the '--files-from' - # option. The result is merged with paths specified via `paths`. - # dynamicFilesFrom = "find /home/matt/git -type d -name .git"; - # - # Patterns to exclude when backing up. See - # https://restic.readthedocs.io/en/latest/040_backup.html#excluding-files - # for details on syntax. - exclude = [ ]; + # Which local paths to backup, in addition to ones specified via `dynamicFilesFrom`. + paths = [ + "/tmp/restic-backup-temp" + ]; + # + # A script that produces a list of files to back up. The + # results of this command are given to the '--files-from' + # option. The result is merged with paths specified via `paths`. + # dynamicFilesFrom = "find /home/matt/git -type d -name .git"; + # + # Patterns to exclude when backing up. See + # https://restic.readthedocs.io/en/latest/040_backup.html#excluding-files + # for details on syntax. + exclude = [ ]; - # A script that must run before starting the backup process. - backupPrepareCommand = '' - ${pkgs.nushell}/bin/nu -c ' - let kubevirt_nodes = [ - "kubevirt-shoryu" - "kubevirt-shushou" - "kubevirt-youko" - ] + # A script that must run before starting the backup process. + backupPrepareCommand = '' + ${pkgs.nushell}/bin/nu -c ' + let kubevirt_nodes = [ + "kubevirt-shoryu" + "kubevirt-shushou" + "kubevirt-youko" + ] - kubevirt_nodes | each {|it| - rsync -avz \ - -e "ssh -i ${sshKeyPath}" \ - $"($it):/perissitent/" $"/tmp/restic-backup-temp/($it)" - } - ' - ''; - # A script that must run after finishing the backup process. - backupCleanupCommand = "rm -rf /tmp/restic-backup-temp"; + kubevirt_nodes | each {|it| + ^${pkgs.rsync}/bin/rsync -avz -e $"ssh -i ${sshKeyPath}" $"($it):/persistent/" $"/tmp/restic-backup-temp/($it)" + } + ' + ''; + # A script that must run after finishing the backup process. + backupCleanupCommand = "rm -rf /tmp/restic-backup-temp"; - # Extra extended options to be passed to the restic --option flag. - # extraOptions = []; + # Extra extended options to be passed to the restic --option flag. + # extraOptions = []; - # Extra arguments passed to restic backup. - # extraBackupArgs = [ - # "--exclude-file=/etc/restic/excludes-list" - # ]; + # Extra arguments passed to restic backup. + # extraBackupArgs = [ + # "--exclude-file=/etc/restic/excludes-list" + # ]; - # repository = "/mnt/backup-hdd"; # backup to a local directory - # When to run the backup. See {manpage}`systemd.timer(5)` for details. - timerConfig = { - OnCalendar = "01:30"; - RandomizedDelaySec = "1h"; + # repository = "/mnt/backup-hdd"; # backup to a local directory + # When to run the backup. See {manpage}`systemd.timer(5)` for details. + timerConfig = { + OnCalendar = "01:30"; + RandomizedDelaySec = "1h"; + }; + # A list of options (--keep-* et al.) for 'restic forget --prune', + # to automatically prune old snapshots. + # The 'forget' command is run *after* the 'backup' command, so + # keep that in mind when constructing the --keep-* options. + pruneOpts = [ + "--keep-daily 3" + "--keep-weekly 3" + "--keep-monthly 3" + "--keep-yearly 3" + ]; }; - # A list of options (--keep-* et al.) for 'restic forget --prune', - # to automatically prune old snapshots. - # The 'forget' command is run *after* the 'backup' command, so - # keep that in mind when constructing the --keep-* options. - pruneOpts = [ - "--keep-daily 3" - "--keep-weekly 3" - "--keep-monthly 3" - "--keep-yearly 3" - ]; }; - }; + */ }