Compare commits

...
2 Commits
Author SHA1 Message Date
blake 556adde3a3 add option to backup to lumiose too 2026-08-23 11:28:27 -05:00
blake 0cc81e1126 add option to backup to lumiose too 2026-08-23 11:27:59 -05:00
2 changed files with 18 additions and 4 deletions
+1
View File
@@ -45,6 +45,7 @@ in {
backups = {
enable = true;
databases = false;
homelab = true;
backup_repo = "/var/lib/backups/homelab";
offsite_dir = "lifeboat/vaniville/homelab";
};
+17 -4
View File
@@ -41,6 +41,11 @@ in {
default = true;
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 {
type = lib.types.str;
default = "lifeboat";
@@ -73,13 +78,21 @@ in {
systemctl start mysql-backup.service
systemctl start $(systemctl list-unit-files 'postgresqlBackup-*.service' --no-legend --no-pager | cut -d' ' -f1)
'';
postHook = lib.mkIf cfg.offsite ''
${pkgs.sshpass}/bin/sshpass -f ${sec."lifeboat_rsync".path} \
postHook = lib.mkIf (cfg.offsite || cfg.homelab) ''
${lib.optionalString 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" \
${toString cfg.backup_repo} \
${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 \
-e "ssh -o StrictHostKeyChecking=no" \
${toString cfg.backup_repo} \
${cfg.offsite_user}@${cfg.offsite_target}::${cfg.offsite_dir}
blake@lumiose::/holocron/archives/servers/vaniville
''}
'';
extraArgs = ["--verbose" "--show-rc" "--umask" "0007"];
extraCreateArgs = ["--list" "--stats" "--filter" "AME"];
prune.keep = {