]> Git — Sourcephile - sourcephile-nix.git/blob - machines/mermet/sanoid.nix
nix: add a GC root for each machine
[sourcephile-nix.git] / machines / mermet / sanoid.nix
1 { pkgs, lib, config, ... }:
2 let
3 inherit (config.users) users;
4 in
5 {
6 system.activationScripts.backup = ''
7 ${pkgs.zfs}/bin/zfs allow -u ${users.backup.name} bookmark,hold,send rpool
8 ${pkgs.zfs}/bin/zfs allow -u ${users.backup.name} receive,create,mount,rollback rpool/backup
9 '';
10 services.sanoid = {
11 enable = true;
12 templates = {
13 local = {
14 autosnap = true;
15 autoprune = true;
16 monthly = 3;
17 };
18 remote = {
19 autosnap = false;
20 autoprune = true;
21 monthly = 3;
22 };
23 };
24 extraArgs = [
25 "--verbose"
26 #"--debug"
27 ];
28 datasets = {
29 "rpool/var/git" = {
30 use_template = [ "local" ];
31 daily = 7;
32 };
33 "rpool/var/mail" = {
34 use_template = [ "local" ];
35 hourly = 12;
36 daily = 7;
37 };
38 "rpool/var/public-inbox" = {
39 use_template = [ "local" ];
40 daily = 7;
41 };
42 "rpool/var/www" = {
43 use_template = [ "local" ];
44 daily = 7;
45 };
46 "rpool/var/redis" = {
47 use_template = [ "local" ];
48 hourly = 0;
49 daily = 7;
50 };
51 "rpool/home/julm/mail" = {
52 use_template = [ "local" ];
53 hourly = 12;
54 daily = 7;
55 };
56 "rpool/home/julm/log" = {
57 use_template = [ "local" ];
58 hourly = 12;
59 daily = 7;
60 monthly = 1;
61 };
62 "rpool/backup/losurdo/home/julm/work" = {
63 use_template = [ "remote" ];
64 daily = 31;
65 };
66 "rpool/backup/losurdo/var/postgresql" = {
67 use_template = [ "remote" ];
68 daily = 31;
69 };
70 };
71 };
72 }