From 394fa4799a0f0239f13e6cf7ecefadbd0f6c9188 Mon Sep 17 00:00:00 2001 From: notohh Date: Sun, 31 Dec 2023 09:24:32 -0500 Subject: [PATCH] sora: init restic --- hosts/sora/services/default.nix | 1 + hosts/sora/services/restic.nix | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 hosts/sora/services/restic.nix diff --git a/hosts/sora/services/default.nix b/hosts/sora/services/default.nix index 90f2765..04a02fe 100644 --- a/hosts/sora/services/default.nix +++ b/hosts/sora/services/default.nix @@ -4,6 +4,7 @@ ./uptimekuma.nix ./ntfy-sh.nix ./tailscale.nix + ./restic.nix ./factorio.nix # ./minecraft.nix # ./foundryvtt.nix diff --git a/hosts/sora/services/restic.nix b/hosts/sora/services/restic.nix new file mode 100644 index 0000000..9803932 --- /dev/null +++ b/hosts/sora/services/restic.nix @@ -0,0 +1,35 @@ +{ + pkgs, + config, + ... +}: { + sops.secrets = { + restic-repo-pwd-sora = {}; + sora-b2 = {}; + }; + environment.systemPackages = [pkgs.restic]; + services.restic = { + backups = { + sora = { + user = "root"; + paths = [ + "/var/lib/uptime-kuma" + "/var/lib/ntfy-sh" + ]; + pruneOpts = [ + "--keep-daily=8" + "--keep-weekly=6" + "--keep-monthly=5" + ]; + repository = "b2:sora-b2"; + initialize = true; + passwordFile = config.sops.secrets.restic-repo-pwd-sora.path; + environmentFile = config.sops.secrets.sora-b2.path; + timerConfig = { + OnCalendar = "daily"; + Persistent = true; + }; + }; + }; + }; +}