puter/system/vessel/backup.nix

32 lines
729 B
Nix
Raw Normal View History

2023-09-29 18:39:08 +00:00
{
pkgs,
lib,
...
}: {
2023-09-17 11:31:20 +00:00
systemd.timers.local-backup = {
description = "Local rsync Backup";
wantedBy = ["timers.target"];
timerConfig = {
OnCalendar = "*-*-* 00:00:00";
Persistent = true;
Unit = "rsync-backup.service";
};
};
systemd.services.local-backup = {
description = "Local rsync Backup";
serviceConfig = {
Type = "oneshot";
2023-09-29 18:39:08 +00:00
ExecStart = ''${lib.getExe pkgs.rsync} --verbose --verbose --archive --update --delete /srv/storage/ /srv/backup/'';
2023-09-17 11:31:20 +00:00
User = "root";
Group = "root";
};
};
fileSystems."/srv/backup" = {
device = "/dev/disk/by-label/backup";
fsType = "btrfs";
options = ["subvol=main" "compress=zstd" "noatime"];
};
}