aboutsummaryrefslogtreecommitdiff
path: root/profiles/restic-backup.nix
blob: 976bbcfcfea77bf3e42f6e81340cc197defcca0e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{ config, pkgs, ... }:
{
  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"
      ];
    };
    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;
    };
  };
}