dotfiles/nixos/backups.nix

38 lines
1 KiB
Nix
Raw Normal View History

2020-06-04 17:51:26 +01:00
{ config, pkgs, ... }:
2020-07-12 08:53:40 +01:00
let
2022-04-18 16:45:19 +01:00
extraArgs = [
"--exclude='.cache'"
"--exclude='.rustup'"
"--exclude='.cargo'"
"--exclude='.config/Element/Cache'"
"--exclude='.config/discord/Cache'"
];
2022-07-17 15:53:44 +01:00
niceness = {
Nice = 19;
IOSchedulingClass = "idle";
};
2022-03-10 12:25:23 +00:00
in {
2020-06-04 17:51:26 +01:00
2021-11-22 19:32:26 +00:00
services = {
restic.backups.home-to-bolty = {
passwordFile = "/etc/nixos/secrets/restic-password-bolty";
paths = [ "/home" ];
repository = "rest:http://bolty:8000/";
timerConfig = { OnCalendar = "hourly"; };
extraBackupArgs = extraArgs;
};
2020-06-04 17:51:26 +01:00
2021-11-22 19:32:26 +00:00
restic.backups.home-to-b2 = {
passwordFile = "/etc/nixos/secrets/restic-password-b2";
paths = [ "/home" ];
repository = "b2:cyplo-restic-${config.networking.hostName}:/";
timerConfig = { OnCalendar = "hourly"; };
extraBackupArgs = extraArgs;
2021-12-04 09:20:11 +00:00
environmentFile = "/etc/nixos/secrets/b2-env";
2020-06-04 17:51:26 +01:00
};
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
}