From c6e28fff4b9a9cecf9bcc8ba905de44f66c1d0d7 Mon Sep 17 00:00:00 2001 From: death916 Date: Thu, 11 Sep 2025 01:45:35 -0700 Subject: [PATCH] restic --- modules/nixos/laptop/restic.nix | 80 +++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 modules/nixos/laptop/restic.nix diff --git a/modules/nixos/laptop/restic.nix b/modules/nixos/laptop/restic.nix new file mode 100644 index 0000000..35474c9 --- /dev/null +++ b/modules/nixos/laptop/restic.nix @@ -0,0 +1,80 @@ +{ config, ... }: +{ + # Restic secrets / passwords + sops.secrets = { + }; + + services.restic.backups = { + laptop-backups = { + initialize = true; + paths = [ + "/etc" + "/srv" + "/var/log" + "/home/" + "/var/lib/" + "/root/" + "/storage" + ]; + repository = "s3:s3.us-west-000.backblazeb2.com"; + environmentFile = config.sops.secrets."restic/B2-Backblaze/environment".path; + timerConfig = { + OnCalendar = "weekly"; + Persistent = true; + }; + extraBackupArgs = [ + "--verbose" + "--exclude-caches" + ]; + pruneOpts = [ + "--keep-weekly 4" + "--keep-monthly 6" + "--keep-yearly 3" + ]; + }; + + home-folder = { + initialize = true; + paths = [ "/home/death916/Desktop" ]; + repository = "b2:nuc-server-B2-Docker:/"; + environmentFile = config.sops.secrets."restic/B2-Docker/environment".path; + passwordFile = config.sops.secrets."restic/B2-Docker/password".path; + timerConfig = { + OnCalendar = "daily"; + Persistent = true; + }; + extraBackupArgs = [ + "--verbose" + "--exclude-caches" + ]; + pruneOpts = [ + "--keep-daily 7" + "--keep-weekly 8" + "--keep-monthly 6" + "--keep-yearly 1" + ]; + }; + + B2-Photos = { + initialize = true; + paths = [ "/Storage/Media/Pictures" ]; + repository = "b2:nuc-server-B2-Photos:/"; + environmentFile = config.sops.secrets."restic/B2-Photos/environment".path; + passwordFile = config.sops.secrets."restic/B2-Photos/password".path; + timerConfig = { + OnCalendar = "weekly"; + Persistent = true; + }; + extraBackupArgs = [ + "--verbose" + "--exclude-caches" + ]; + pruneOpts = [ + "--keep-weekly 8" + "--keep-monthly 12" + "--keep-yearly 5" + ]; + }; + + }; +}