Files
vmimages/modules/nixos/restic/default.nix
2025-12-04 20:53:37 +00:00

49 lines
1001 B
Nix

{
pkgs,
lib,
config,
...
}: {
options = {
custom.restic.enable = lib.mkEnableOption "restic";
};
config = lib.mkIf config.custom.restic.enable {
# Ensure the SOPS secret is defined
sops.secrets.restic_odroid3 = {
#sopsFile = ./secrets.yaml; # Adjust path to your secrets file
mode = "0400";
};
services.restic.backups.home_backup = {
initialize = true;
paths = ["/home"];
exclude = [
"/home/*/.cache"
"/home/*/keybase"
];
repository = "sftp:root@192.168.4.63:/mnt/Shares/_RESTIC_StuMiniWSLNIXOS";
passwordFile = config.sops.secrets.restic_odroid3.path;
pruneOpts = [
"--keep-daily 7"
"--keep-weekly 5"
"--keep-monthly 12"
"--keep-yearly 10"
];
checkOpts = ["--with-cache"];
timerConfig = {
OnBootSec = "3m";
OnCalendar = "daily";
Persistent = true;
};
};
};
}