dotfiles/nixos/backups.nix

53 lines
1.1 KiB
Nix
Raw Normal View History

2022-12-19 09:09:08 +00:00
{
config,
pkgs,
...
}: let
2023-12-27 15:28:14 +00:00
backupConfig = {
paths = ["/home"];
exclude = [
"/home/*/Videos"
".cache"
".rustup"
".cargo"
".config/Element/Cache"
".config/discord/Cache"
];
timerConfig = {OnCalendar = "hourly";};
pruneOpts = [
"--keep-hourly 25"
"--keep-daily 8"
"--keep-weekly 5"
"--keep-monthly 13"
"--keep-yearly 2"
];
checkOpts = [
"--with-cache"
];
};
2022-07-17 15:53:44 +01:00
niceness = {
Nice = 19;
IOSchedulingClass = "idle";
};
2022-03-10 12:25:23 +00:00
in {
2021-11-22 19:32:26 +00:00
services = {
2023-12-27 15:28:14 +00:00
restic.backups.home-to-bolty =
{
passwordFile = "/etc/nixos/secrets/restic-password-bolty";
repository = "rest:http://bolty:8000/";
}
// backupConfig;
2020-06-04 17:51:26 +01:00
2023-12-27 15:28:14 +00:00
restic.backups.home-to-b2 =
{
passwordFile = "/etc/nixos/secrets/restic-password-b2";
repository = "b2:cyplo-restic-${config.networking.hostName}:/";
environmentFile = "/etc/nixos/secrets/b2-env";
}
// backupConfig;
2021-11-22 19:32:26 +00:00
};
2022-07-17 15:53:44 +01:00
systemd.services.restic-backups-home-to-bolty.serviceConfig = niceness;
systemd.services.restic-backups-home-to-b2.serviceConfig = niceness;
2021-11-22 19:32:26 +00:00
}