add option to backup to lumiose too
This commit is contained in:
@@ -41,6 +41,11 @@ in {
|
|||||||
default = true;
|
default = true;
|
||||||
description = "bool to control weather or not the repo is backed up offsite";
|
description = "bool to control weather or not the repo is backed up offsite";
|
||||||
};
|
};
|
||||||
|
homelab = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "bool to control weather or not the repo is backed up to homelab";
|
||||||
|
};
|
||||||
offsite_user = lib.mkOption {
|
offsite_user = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "lifeboat";
|
default = "lifeboat";
|
||||||
@@ -73,13 +78,21 @@ in {
|
|||||||
systemctl start mysql-backup.service
|
systemctl start mysql-backup.service
|
||||||
systemctl start $(systemctl list-unit-files 'postgresqlBackup-*.service' --no-legend --no-pager | cut -d' ' -f1)
|
systemctl start $(systemctl list-unit-files 'postgresqlBackup-*.service' --no-legend --no-pager | cut -d' ' -f1)
|
||||||
'';
|
'';
|
||||||
postHook = lib.mkIf cfg.offsite ''
|
postHook = lib.mkIf (cfg.offsite || cfg.homelab) ''
|
||||||
|
${lib.optionalString cfg.offsite ''
|
||||||
${pkgs.sshpass}/bin/sshpass -f ${sec."lifeboat_rsync".path} \
|
${pkgs.sshpass}/bin/sshpass -f ${sec."lifeboat_rsync".path} \
|
||||||
${pkgs.rsync}/bin/rsync -aHAX --partial --numeric-ids --info=progress2,name1,stats2 --delete \
|
${pkgs.rsync}/bin/rsync -aHAX --partial --numeric-ids --info=progress2,name1,stats2 --delete \
|
||||||
-e "ssh -o StrictHostKeyChecking=no" \
|
-e "ssh -o StrictHostKeyChecking=no" \
|
||||||
${toString cfg.backup_repo} \
|
${toString cfg.backup_repo} \
|
||||||
${cfg.offsite_user}@${cfg.offsite_target}::${cfg.offsite_dir}
|
${cfg.offsite_user}@${cfg.offsite_target}::${cfg.offsite_dir}
|
||||||
|
''}
|
||||||
|
${lib.optionalString cfg.homelab ''
|
||||||
|
${pkgs.rsync}/bin/rsync -aHAX --partial --numeric-ids --info=progress2,name1,stats2 --delete \
|
||||||
|
${toString cfg.backup_repo} \
|
||||||
|
blake@lumiose::/holocron/archives/servers/vaniville
|
||||||
|
''}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
extraArgs = ["--verbose" "--show-rc" "--umask" "0007"];
|
extraArgs = ["--verbose" "--show-rc" "--umask" "0007"];
|
||||||
extraCreateArgs = ["--list" "--stats" "--filter" "AME"];
|
extraCreateArgs = ["--list" "--stats" "--filter" "AME"];
|
||||||
prune.keep = {
|
prune.keep = {
|
||||||
|
|||||||
Reference in New Issue
Block a user