]> Git — Sourcephile - sourcephile-nix.git/blob - hosts/losurdo/syncoid.nix
mermet: miniflux: enable DynamicUser=
[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 = lib.mkBefore ''
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 interval = "*-*-* *:05:00";
44 #interval = "*:0/1";
45 sshKey = "sshKey:${syncoid/sshKey.cred}";
46 commonArgs = [
47 #"--debug"
48 "--no-sync-snap"
49 "--create-bookmark"
50 #"--no-privilege-elevation"
51 #"--no-stream"
52 #"--preserve-recordsize"
53 #"--preserve-properties"
54 ];
55 service = {
56 serviceConfig.Group = groups."disk".name;
57 };
58 commands = {
59 "${hostName}/home/julm/work" = {
60 sendOptions = "raw";
61 target = "backup@mermet.${networking.domain}:rpool/backup/${hostName}/home/julm/work";
62 };
63 }
64 // mermet2losurdo "var" {
65 extraArgs = [
66 "--skip-parent"
67 "--exclude=rpool/var/cache"
68 "--exclude=rpool/var/lib/nginx"
69 "--exclude=rpool/var/log"
70 "--exclude=rpool/var/tmp"
71 ];
72 }
73 // mermet2losurdo "home/julm/mail" { }
74 // mermet2losurdo "home/julm/log" { }
75 // losurdo2das1 "home/julm/work" { }
76 // losurdo2das1 "var/sftp" { }
77 // losurdo2das1 "var/git" { }
78 ;
79 };
80 }