nixos-config/configs/workhorse/borg.nix

31 lines
691 B
Nix
Raw Normal View History

2020-09-01 23:43:03 +02:00
{ lib, config, pkgs, ... }: {
services.borgbackup.repos = {
default = {
quota = "100G";
allowSubRepos = true;
2020-09-04 00:49:35 +02:00
authorizedKeys = [
(lib.fileContents <common_secrets/backup/ssh_rsa.pub>)
(lib.fileContents <assets/ssh/card_rsa.pub>)
2020-09-01 23:43:03 +02:00
];
};
};
# mirror backup folder to /media
systemd.services.borg-mirror-to-media = {
enable = true;
script = ''
${pkgs.rsync}/bin/rsync -a \
/var/lib/borgbackup/ \
/media/borg-backup-mirror \
--delete-after
'';
};
systemd.timers.borg-mirror-to-media = {
enable = true;
timerConfig.OnCalendar = "daily";
wantedBy = [ "multi-user.target" ];
};
2020-09-01 23:43:03 +02:00
}