more efficient backups

This commit is contained in:
Cyryl Płotnicki 2023-12-27 15:28:14 +00:00
parent bfb9fbcfc5
commit a9953689d5
2 changed files with 39 additions and 39 deletions

View file

@ -3,49 +3,48 @@
pkgs,
...
}: let
extraArgs = [
"--exclude='.cache'"
"--exclude='.rustup'"
"--exclude='.cargo'"
"--exclude='.config/Element/Cache'"
"--exclude='.config/discord/Cache'"
];
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"
];
};
niceness = {
Nice = 19;
IOSchedulingClass = "idle";
};
in {
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;
pruneOpts = [
"--keep-hourly 25"
"--keep-daily 8"
"--keep-weekly 5"
"--keep-monthly 13"
"--keep-yearly 2"
];
};
restic.backups.home-to-bolty =
{
passwordFile = "/etc/nixos/secrets/restic-password-bolty";
repository = "rest:http://bolty:8000/";
}
// backupConfig;
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;
environmentFile = "/etc/nixos/secrets/b2-env";
pruneOpts = [
"--keep-hourly 25"
"--keep-daily 8"
"--keep-weekly 5"
"--keep-monthly 13"
"--keep-yearly 2"
];
};
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;
};
systemd.services.restic-backups-home-to-bolty.serviceConfig = niceness;

View file

@ -34,9 +34,7 @@ in rec {
'';
timerConfig = {OnCalendar = "daily";};
environmentFile = "${config.sops.secrets.restic-backups-b2-environment.path}";
extraBackupArgs = [
"--exclude='cache'"
];
exclude = ["cache"];
pruneOpts = [
"--keep-hourly 25"
"--keep-daily 8"
@ -44,6 +42,9 @@ in rec {
"--keep-monthly 13"
"--keep-yearly 2"
];
checkOpts = [
"--with-cache"
];
};
};