From f0dd9523415267de8be5910f07462bcd088c508f Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Mon, 17 Feb 2025 01:13:04 -0600 Subject: [PATCH] fleshed out restic stuff --- nixos/services/restic.nix | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/nixos/services/restic.nix b/nixos/services/restic.nix index fbc4547..92f1400 100644 --- a/nixos/services/restic.nix +++ b/nixos/services/restic.nix @@ -2,19 +2,41 @@ { sops.secrets."restic_password" = { }; + environment.systemPackages = with pkgs; [ + restic + (pkgs.writeShellScriptBin "restic-backup" "sudo systemctl start restic-backups-localBackup.service") + (pkgs.writeShellScriptBin "restic-backup-check" "sudo journalctl -b -u restic-backups-localBackup.service") + ]; + + environment.variables = { + RESTIC_REPOSITORY = "/mnt/restic/appdaemon"; + RESTIC_PASSWORD = "${builtins.readFile config.sops.secrets."restic_password".path}"; + }; + services.restic.backups = { - localbackup = { + localBackup = { repository = "/mnt/restic/appdaemon"; passwordFile = config.sops.secrets."restic_password".path; initialize = true; + timerConfig = { + OnCalendar = "03:00"; + RandomizedDelaySec = "2h"; + Persistent = true; + }; paths = [ "/home" + "/conf" + "/etc/nixos" ]; exclude = [ ".cache" - ".vscode-server" + ".vscode*" ".devenv" ".venv" + "build" + "dist" + "__pycache__" + "*.egg-info" ]; }; };