add more borg options for dbs and offsite
This commit is contained in:
@@ -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" \
|
||||
|
||||
Reference in New Issue
Block a user