add more borg options for dbs and offsite

This commit is contained in:
2026-08-23 10:42:16 -05:00
parent e958a81b04
commit 9736a86d9e
2 changed files with 13 additions and 2 deletions
+1
View File
@@ -44,6 +44,7 @@ in {
};
backups = {
enable = true;
databases = false;
backup_repo = "/var/lib/backups/homelab";
offsite_dir = "/lifeboat/vaniville/homelab";
};
+12 -2
View File
@@ -26,11 +26,21 @@ in {
default = {};
description = "backup jobs, nested attribute sets should be <bak_name> = paths [<list_of_paths>]";
};
databases = lib.mkOption {
type = lib.types.bool;
default = true;
description = "if databases are present, runs dumps";
};
backup_repo = lib.mkOption {
type = lib.types.path;
default = "/holocron/archives/homelab";
description = "path to take daily backups to with borg!";
};
offsite = lib.mkOption {
type = lib.types.bool;
default = true;
description = "bool to control weather or not the repo is backed up offsite";
};
offsite_user = lib.mkOption {
type = lib.types.str;
default = "lifeboat";
@@ -59,11 +69,11 @@ in {
group = "archives";
encryption.mode = "repokey-blake2";
encryption.passCommand = "cat ${sec."borg_passwd".path}";
preHook = ''
preHook = lib.mkIf cfg.databases ''
systemctl start mysql-backup.service
systemctl start $(systemctl list-unit-files 'postgresqlBackup-*.service' --no-legend --no-pager | cut -d' ' -f1)
'';
postHook = ''
postHook = lib.mkIf cfg.offsite''
${pkgs.sshpass}/bin/sshpass -f ${sec."lifeboat_rsync".path} \
${pkgs.rsync}/bin/rsync -aHAX --partial --numeric-ids --info=progress2,name1,stats2 --delete \
-e "ssh -o StrictHostKeyChecking=no" \