nixos/modules/homelab/restic.nix

31 lines
729 B
Nix
Raw Normal View History

2025-03-09 20:30:33 +01:00
{
pkgs,
config,
lib,
2025-03-09 20:30:33 +01:00
...
}:
lib.mkIf config.fireproof.homelab.enable {
2025-03-09 20:30:33 +01:00
environment.systemPackages = with pkgs; [
restic
];
age.secrets.restic-password.rekeyFile = ../../secrets/hosts/homelab/restic-password.age;
age.secrets.restic-env.rekeyFile = ../../secrets/hosts/homelab/restic-env.age;
2025-04-23 00:02:00 +02:00
services.restic.backups.homelab = {
2025-03-09 20:30:33 +01:00
repository = "b2:fireproof-backup";
2025-04-23 00:02:00 +02:00
timerConfig = {
OnCalendar = "daily";
Persistent = true;
};
2025-03-09 20:30:33 +01:00
passwordFile = "${config.age.secrets.restic-password.path}";
environmentFile = "${config.age.secrets.restic-env.path}";
2025-04-23 00:02:00 +02:00
pruneOpts = [
"--keep-daily 7"
"--keep-weekly 5"
"--keep-monthly 12"
"--keep-yearly 75"
];
2025-03-09 20:30:33 +01:00
};
}