diffu/modules/nixos/restic.nix

49 lines
1 KiB
Nix
Raw Normal View History

2023-12-01 14:22:43 +00:00
{ config, pkgs, lib, ... }:
let
cfg = config.custom.restic;
in
{
options = {
custom.restic = {
2023-12-01 17:33:20 +00:00
enable = lib.mkEnableOption "restic";
2023-12-01 14:22:43 +00:00
repositoryFile = lib.mkOption {
type = lib.types.str;
default = "";
};
2023-12-01 17:33:20 +00:00
passwordFile = lib.mkOption {
2023-12-01 14:22:43 +00:00
type = lib.types.str;
default = "";
};
};
};
2024-07-30 03:31:27 +00:00
config = lib.mkIf cfg.enable {
services.restic.backups = {
2023-12-01 14:22:43 +00:00
remotebackup = {
repositoryFile = cfg.repositoryFile;
passwordFile = cfg.passwordFile;
paths = [
"/home"
"/var/lib"
];
exclude = [
"/home/*/.cache"
"/home/*/.cargo"
"/home/*/.local/share/Steam"
"/home/*/.local/share/flatpak"
];
timerConfig = {
OnCalendar = "00:05";
RandomizedDelaySec = "5h";
};
pruneOpts = [
"--keep-daily 7"
"--keep-weekly 5"
"--keep-monthly 12"
"--keep-yearly 75"
];
};
};
};
}