summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/backup/state.nix
blob: 1143708bff18bc4b2226da90cf8229e2f8b2670d (plain)
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
{ config, ... }:
# back up all state
let
  sec = toString <secrets>;
  sshkey = sec + "/borg.priv";
  phrase = sec + "/borg.pw";
in
{
  services.borgbackup.jobs.state = {
    repo = "borg-${config.krebs.build.host.name}@backup.makefu.r:.";
    paths = config.state;
    encryption = {
      mode = "repokey";
      passCommand = "cat ${phrase}";
    };
    environment.BORG_RSH = "ssh -i ${sshkey}";
    prune.keep =
    { daily = 7;
      weekly = 4;
      monthly = -1; # Keep at least one archive for each month
    };
    compression = "auto,lzma";
    startAt = "daily";
  };
}