From ea945371f41101aca0a863f52e7156dc4019657d Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 17 Nov 2025 18:45:43 -0800 Subject: configure backups correctly Set a reasonable retention policy, and drop the helper scripts, the module for restic already does it. --- profiles/restic-backup.nix | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/profiles/restic-backup.nix b/profiles/restic-backup.nix index 876641e..a608415 100644 --- a/profiles/restic-backup.nix +++ b/profiles/restic-backup.nix @@ -1,11 +1,4 @@ { config, pkgs, ... }: -let - restic-local = pkgs.writeShellScriptBin "restic-local" '' - export RESTIC_REPOSITORY="/data/backups/" - export RESTIC_PASSWORD_FILE="${config.age.secrets.restic-local-pw.path}" - exec ${pkgs.restic}/bin/restic "$@" - ''; -in { age = { secrets = { @@ -15,9 +8,8 @@ in }; }; - environment.systemPackages = [ - pkgs.restic - restic-local + environment.systemPackages = with pkgs; [ + restic ]; services.restic = { @@ -27,9 +19,14 @@ in passwordFile = config.age.secrets.restic-local-pw.path; repository = "/data/backups/"; initialize = true; - timerConfig.OnCalendar = "*-*-* *:00:00"; + timerConfig.OnCalendar = "daily"; timerConfig.RandomizedDelaySec = "5m"; extraBackupArgs = [ ]; + pruneOpts = [ + "--keep-daily=7" + "--keep-weekly=4" + "--keep-monthly=12" + ]; }; }; }; -- cgit v1.2.3