nixos/colony: Add rsync job for borgthin

This commit is contained in:
Jack O'Sullivan 2023-10-31 17:11:20 +00:00
parent 230a9d81cf
commit baf605fbe2
2 changed files with 110 additions and 5 deletions

View File

@ -92,6 +92,10 @@ in
}; };
}; };
programs.ssh.knownHostsFiles = [
lib.my.sshKeyFiles.rsyncNet
];
services = { services = {
fstrim = lib.my.colony.fstrimConfig; fstrim = lib.my.colony.fstrimConfig;
lvm = { lvm = {
@ -125,15 +129,33 @@ in
]; ];
systemd = { systemd = {
services = {
"serial-getty@ttyS0".enable = true;
"serial-getty@ttyS1".enable = true;
};
tmpfiles.rules = [ tmpfiles.rules = [
"d /var/log/smartd 0755 root root" "d /var/log/smartd 0755 root root"
]; ];
services = {
"serial-getty@ttyS0".enable = true;
"serial-getty@ttyS1".enable = true;
borgthin-rsync = {
description = "rsync borgthin backups to rsync.net";
serviceConfig = {
Type = "oneshot";
# Only run when no other process is using CPU or disk
CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle";
};
script = ''
${pkgs.rsync}/bin/rsync -av --delete --delete-after \
-e "${pkgs.openssh}/bin/ssh -i ${config.age.secrets."colony/rsync.key".path}" \
/mnt/backup/main/ zh2855@zh2855.rsync.net:borg/colony/
'';
wantedBy = [ "borgthin-job-main.service" ];
after = [ "borgthin-job-main.service" ];
};
};
network = { network = {
links = { links = {
"10-wan0" = { "10-wan0" = {
@ -275,6 +297,7 @@ in
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPIijqzAWF6OxKr4aeCa1TAc5xGn4rdIjVTt0wAPU6uY"; key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPIijqzAWF6OxKr4aeCa1TAc5xGn4rdIjVTt0wAPU6uY";
files = { files = {
"colony/borg-pass.txt" = {}; "colony/borg-pass.txt" = {};
"colony/rsync.key" = {};
}; };
}; };

View File

@ -0,0 +1,82 @@
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+I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