Files
nix-config/home/borgmatic.nix
2026-02-12 23:39:31 +01:00

64 lines
1.6 KiB
Nix

{ hostname
, username
, pkgs
, ...
}: {
home.packages = with pkgs; [
libnotify
];
programs.borgmatic = {
enable = true;
package = pkgs.borgmatic;
backups.default = {
location = {
repositories = [
{
label = "duke";
path = "ssh://borg@duke.veltnet:2222/home/borg/backups/${hostname}-${username}";
}
];
excludeHomeManagerSymlinks = true;
patterns = [
#TODO: home.homeDirectory might be usable here
"R /home/${username}/Documents"
"R /home/${username}/.ssh"
"- /home/${username}/Documents/SteamLibrary"
"- /home/${username}/Documents/PrismLauncher instances"
"- /home/${username}/Documents/.Trash-1000"
"- /home/${username}/Documents/VMs/Data"
"- **/node_modules"
"- **/.git"
"- **/.cache"
"- **/*build"
"- **/target"
"- **/.venv"
"- **/venv"
"- **/.gradle"
"- **/out"
"- **/dist"
"- **/.pio"
];
};
retention.keepWeekly = 2;
storage.extraConfig.ssh_command = "ssh -i /home/${username}/.ssh/id_ed25519_borg";
#FIXME: consistency checks!!!
};
};
systemd.user.services.borgmatic = {
Unit.Description = "Create a backup using borgmatic";
Service.ExecStart = "${pkgs.borgmatic}/bin/borgmatic create --stats";
};
systemd.user.timers.borgmatic = {
Unit.Description = "Create weekly backups using borgmatic";
Timer = {
OnCalendar = "Weekly";
Persistent = true;
};
Install.WantedBy = [ "timers.target" ];
};
}