]> Git — Sourcephile - sourcephile-nix.git/blob - hosts/losurdo/syncoid.nix
mermet: radicle: fix publicKey old config name
[sourcephile-nix.git] / hosts / losurdo / syncoid.nix
1 { lib, config, inputs, hostName, ... }:
2 let
3 inherit (config) networking;
4 inherit (config.services) syncoid;
5 inherit (config.users) groups;
6 losurdo2das1 = path: conf: lib.mapAttrs (_n: v: lib.recursiveUpdate v conf) {
7 "${hostName}/${path}2das1" = {
8 source = "${hostName}/${path}";
9 target = "das1/julm/backup/losurdo/${path}";
10 sendOptions = "raw";
11 recursive = true;
12 };
13 };
14 mermet2losurdo = path: conf: lib.mapAttrs (_n: v: lib.recursiveUpdate v conf) {
15 "backup@mermet.${networking.domain}:rpool/${path}" = {
16 target = "${hostName}/backup/mermet/${path}";
17 sendOptions = "raw";
18 recursive = true;
19 };
20 "${hostName}/backup/mermet/${path}" = {
21 target = "das1/julm/backup/mermet/${path}";
22 sendOptions = "raw";
23 recursive = true;
24 };
25 };
26 in
27 {
28 networking.nftables.ruleset = ''
29 table inet filter {
30 chain output-net {
31 skuid @nixos-syncoid-uids \
32 meta l4proto tcp \
33 counter accept \
34 comment "syncoid: SSH"
35 }
36 }
37 '';
38 systemd.tmpfiles.rules = [
39 "z /dev/zfs 0660 - disk -"
40 ];
41 services.syncoid = {
42 enable = true;
43 nftables.enable = true;
44 interval = "*-*-* *:05:00";
45 #interval = "*:0/1";
46 sshKey = "sshKey:${syncoid/sshKey.cred}";
47 commonArgs = [
48 #"--debug"
49 "--no-sync-snap"
50 "--create-bookmark"
51 #"--no-privilege-elevation"
52 #"--no-stream"
53 #"--preserve-recordsize"
54 #"--preserve-properties"
55 ];
56 service = {
57 serviceConfig.Group = groups."disk".name;
58 };
59 commands = {
60 "${hostName}/home/julm/work" = {
61 sendOptions = "raw";
62 target = "backup@mermet.${networking.domain}:rpool/backup/${hostName}/home/julm/work";
63 };
64 }
65 // mermet2losurdo "var" {
66 extraArgs = [
67 "--skip-parent"
68 "--exclude=rpool/var/cache"
69 "--exclude=rpool/var/lib/nginx"
70 "--exclude=rpool/var/log"
71 "--exclude=rpool/var/tmp"
72 ];
73 }
74 // mermet2losurdo "home/julm/mail" { }
75 // mermet2losurdo "home/julm/log" { }
76 // losurdo2das1 "home/julm/work" { }
77 // losurdo2das1 "var/sftp" { }
78 // losurdo2das1 "var/git" { }
79 ;
80 };
81 }