feat(rpi4): update restic backup config
This commit is contained in:
parent
50753334b4
commit
72a4fb4fbc
|
@ -1,11 +1,39 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
{
|
let
|
||||||
services.restic.backups.rpi4 = {
|
resticConfig = args@{ name, extraPruneOpts ? [ ], ... }:
|
||||||
|
assert !hasAnyAttr [
|
||||||
|
"initialize"
|
||||||
|
"repository"
|
||||||
|
"s3CredentialsFile"
|
||||||
|
"passwordFile"
|
||||||
|
"pruneOpts"
|
||||||
|
] args;
|
||||||
|
args // {
|
||||||
initialize = true;
|
initialize = true;
|
||||||
repository = "b2:felschr-rpi4-backup:/";
|
repository = "b2:felschr-rpi4-backup:/${name}";
|
||||||
s3CredentialsFile = "/etc/nixos/secrets/restic/b2";
|
s3CredentialsFile = "/etc/nixos/secrets/restic/b2";
|
||||||
passwordFile = "/etc/nixos/secrets/restic/password";
|
passwordFile = "/etc/nixos/secrets/restic/password";
|
||||||
|
timerConfig = if (args ? timerConfig) then
|
||||||
|
args.timerConfig
|
||||||
|
else {
|
||||||
|
OnCalendar = "daily";
|
||||||
|
};
|
||||||
|
pruneOpts = [
|
||||||
|
"--keep-daily 7"
|
||||||
|
"--keep-weekly 4"
|
||||||
|
"--keep-monthly 3"
|
||||||
|
"--keep-yearly 1"
|
||||||
|
] ++ extraPruneOpts;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
services.restic.backups.full = resticConfig {
|
||||||
|
name = "full";
|
||||||
|
paths = [ "/home" "/var" "/etc" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
services.restic.backups.data = resticConfig {
|
||||||
|
name = "data";
|
||||||
paths = [
|
paths = [
|
||||||
"/etc/nixos"
|
"/etc/nixos"
|
||||||
"/home/felschr/.config/syncthing"
|
"/home/felschr/.config/syncthing"
|
||||||
|
@ -19,12 +47,6 @@
|
||||||
"/var/lib/owntracks-recorder"
|
"/var/lib/owntracks-recorder"
|
||||||
];
|
];
|
||||||
timerConfig = { OnCalendar = "hourly"; };
|
timerConfig = { OnCalendar = "hourly"; };
|
||||||
pruneOpts = [
|
extraPruneOpts = [ "--keep-hourly 24" ];
|
||||||
"--keep-hourly 24"
|
|
||||||
"--keep-daily 7"
|
|
||||||
"--keep-weekly 4"
|
|
||||||
"--keep-monthly 3"
|
|
||||||
"--keep-yearly 1"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue