summaryrefslogtreecommitdiff
path: root/hosts/apocalypse/backup.nix
blob: 3529024c3d4c35bf8628d75f4416cd2176e1b0d3 (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
26
27
28
29
30
31
{ config, lib, pkgs, modulesPath, ...}:
{
  environment.systemPackages = with pkgs; [
    btrbk
    lz4
  ];
  
  services.btrbk = {
  extraPackages = with pkgs; [ lz4 ];
  instances."remote_vault" = {
    onCalendar = "weekly";
    settings = {
      snapshot_preserve_min = "1w"; 
      snapshot_preserve = "2w";
      target_preserve_min = "1w"; 
      target_preserve = "4w";
      ssh_identity = "/etc/vault_key"; # NOTE: must be readable by user/group btrbk
      ssh_user = "vaultmanager";
      stream_compress = "lz4";
      volume."/btrfs_root" = {
        target = "ssh://10.127.9.1/vault/backups/apocalypse";
        subvolume = { 
          "@root" = { 
            snapshot_create = "ondemand";
          };  
        };
      };
    };
  };
};
}