nixos-combined-flake/modules/home-manager/shell/borgmatic/default.nix

62 lines
1.3 KiB
Nix

{
lib,
config,
vars,
...
}:
let
commonExcludes = import ./excludes.nix;
in
lib.mkIf config.services.borgmatic.enable {
programs.borgmatic = {
enable = true;
backups = {
home = {
location = {
patterns = [
"R /home/${vars.username}"
] ++ commonExcludes;
repositories = [
{
"path" = "ssh://odie@svartalbenheim.odie.home.arpa/./borg-backup";
"label" = "svartalbenheim";
}
];
extraConfig = {
remote_path = "/usr/local/bin/borg";
};
excludeHomeManagerSymlinks = true;
};
retention = {
keepHourly = 24;
keepDaily = 60;
keepWeekly = 52;
keepMonthly = 24;
keepYearly = 10;
};
consistency.checks = [
{
name = "repository";
frequency = "2 weeks";
}
{
name = "archives";
frequency = "4 weeks";
}
{
name = "data";
frequency = "8 weeks";
}
{
name = "extract";
frequency = "8 weeks";
}
];
};
};
};
services.borgmatic = {
frequency = "Mon..Sun *:00:30";
};
}