Update to (somewhat?) dendritic pattern
Heavily inspired by https://github.com/Doc-Steve/dendritic-design-with-flake-parts. > Atomic commits? Never heard of them!
This commit is contained in:
67
modules/services/borgmatic.nix
Normal file
67
modules/services/borgmatic.nix
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
flake.modules.homeManager.borgmatic =
|
||||
{ config
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
hostname = config.networking.hostname;
|
||||
username = config.home.username;
|
||||
in
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
libnotify
|
||||
];
|
||||
|
||||
programs.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" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user