-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrclone.nix
55 lines (51 loc) · 1.41 KB
/
rclone.nix
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{
config,
lib,
pkgs,
...
}:
{
imports = [ ];
# Automated rclone sync to b2
# TODO: handle config/secrets via nix
# volsync
systemd.services."rclone-backup-volsync" = {
description = "Rclone backup volsync";
script = ''
# rclone should use /home/nix/.config/rclone/rclone.conf by default
${pkgs.rclone}/bin/rclone --config /home/nix/.config/rclone/rclone.conf --transfers 50 --fast-list sync /mnt/ssdtank/s3/volsync b2:billimek-volsync
'';
serviceConfig = {
Type = "oneshot";
User = "root";
};
};
systemd.timers."rclone-backup-volsync" = {
description = "Rclone backup timer volsync";
timerConfig = {
OnCalendar = "4:00:00";
Persistent = true;
};
wantedBy = [ "timers.target" ];
};
# postgres
systemd.services."rclone-backup-postgres" = {
description = "Rclone backup postgres";
script = ''
# rclone should use /home/nix/.config/rclone/rclone.conf by default
${pkgs.rclone}/bin/rclone --config /home/nix/.config/rclone/rclone.conf --transfers 50 --fast-list sync /mnt/ssdtank/s3/postgresql b2:billimek-postgres
'';
serviceConfig = {
Type = "oneshot";
User = "root";
};
};
systemd.timers."rclone-backup-postgres" = {
description = "Rclone backup timer postgres";
timerConfig = {
OnCalendar = "6:00:00";
Persistent = true;
};
wantedBy = [ "timers.target" ];
};
}