v1
This commit is contained in:
parent
62df62c3aa
commit
db11846811
27 changed files with 887 additions and 64 deletions
48
hm-modules/borgmatic.nix
Normal file
48
hm-modules/borgmatic.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
osConfig,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.xyno.borgmatic;
|
||||
in
|
||||
{
|
||||
options.xyno.borgmatic.enable = lib.mkOption { default = false; };
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.borgmatic = {
|
||||
enable = true;
|
||||
backups.system =
|
||||
let
|
||||
notify = "${pkgs.libnotify}/bin/notify-send";
|
||||
in
|
||||
{
|
||||
location.sourceDirectories = [ "/home" "/var" ];
|
||||
location.repositories = [ { path = "ssh://ragon@ds9//backups/${osConfig.networking.hostName}"; } ];
|
||||
location.extraConfig.exclude_if_present = [ ".nobackup" ];
|
||||
storage.encryptionPasscommand = "${pkgs.libsecret}/bin/secret-tool lookup borg-repository system";
|
||||
location.extraConfig.before_backup = [
|
||||
"${notify} -u low -a borgmatic borgmatic \"starting backup\" -t 10000"
|
||||
];
|
||||
location.extraConfig.after_backup = [
|
||||
"${notify} -u low -a borgmatic borgmatic \"finished backup\" -t 10000"
|
||||
];
|
||||
location.extraConfig.on_error = [
|
||||
"${notify} -u critical -a borgmatic borgmatic \"backup failed<br>maybe unlock keepass\""
|
||||
];
|
||||
location.extraConfig.ssh_command = "ssh -o IdentityAgent=/run/user/1000/ssh-agent";
|
||||
location.extraConfig.one_file_system = true;
|
||||
retention = {
|
||||
keepHourly = 24;
|
||||
keepDaily = 7;
|
||||
keepWeekly = 4;
|
||||
keepMonthly = 12;
|
||||
keepYearly = 2;
|
||||
};
|
||||
};
|
||||
};
|
||||
services.borgmatic.enable = true;
|
||||
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue