diff options
| author | Franck Cuny <franck@fcuny.net> | 2025-11-27 13:29:39 -0800 |
|---|---|---|
| committer | Franck Cuny <franck@fcuny.net> | 2025-11-27 13:29:39 -0800 |
| commit | aa1d82481f315b714fa5e6cced6142e4925bd647 (patch) | |
| tree | 7106cab9420d8663b0e5cad441d275dc7dbc01dc /profiles/restic-backup.nix | |
| parent | configure rate limiting for nginx (diff) | |
| download | infra-aa1d82481f315b714fa5e6cced6142e4925bd647.tar.gz | |
backup to the synology nas
In addition to do a local backup, we also backup to the synology nas. We
don't configure what to backup in the profiles, but instead in the host
configuration.
Diffstat (limited to '')
| -rw-r--r-- | profiles/restic-backup.nix | 56 |
1 files changed, 34 insertions, 22 deletions
diff --git a/profiles/restic-backup.nix b/profiles/restic-backup.nix index a608415..976bbcf 100644 --- a/profiles/restic-backup.nix +++ b/profiles/restic-backup.nix @@ -1,33 +1,45 @@ { config, pkgs, ... }: { - age = { - secrets = { - restic-local-pw = { - file = ../secrets/restic-pw.age; - }; - }; + age.secrets = { + restic-local-pw.file = ../secrets/restic-pw.age; + restic-nas-smb-config.file = ../secrets/restic-nas-smb-config.age; }; environment.systemPackages = with pkgs; [ + rclone restic ]; - services.restic = { - backups = { - local = { - paths = [ ]; - passwordFile = config.age.secrets.restic-local-pw.path; - repository = "/data/backups/"; - initialize = true; - timerConfig.OnCalendar = "daily"; - timerConfig.RandomizedDelaySec = "5m"; - extraBackupArgs = [ ]; - pruneOpts = [ - "--keep-daily=7" - "--keep-weekly=4" - "--keep-monthly=12" - ]; - }; + services.restic.backups = { + local = { + paths = [ ]; + passwordFile = config.age.secrets.restic-local-pw.path; + repository = "/data/backups/"; + initialize = true; + timerConfig.OnCalendar = "daily"; + timerConfig.RandomizedDelaySec = "5m"; + extraBackupArgs = [ ]; + pruneOpts = [ + "--keep-daily=7" + "--keep-weekly=4" + "--keep-monthly=12" + ]; + }; + synology = { + paths = [ ]; + passwordFile = config.age.secrets.restic-local-pw.path; + repository = "rclone:synology:backups/${config.networking.hostName}"; + initialize = true; + timerConfig.OnCalendar = "daily"; + timerConfig.RandomizedDelaySec = "5m"; + extraBackupArgs = [ "--compression max" ]; + pruneOpts = [ + "--keep-daily=7" + "--keep-weekly=4" + "--keep-monthly=12" + "--compression max" + ]; + rcloneConfigFile = config.age.secrets.restic-nas-smb-config.path; }; }; } |
