diff --git a/modules/homelab/system/backups/default.nix b/modules/homelab/system/backups/default.nix index 99e8d24..14eb5ec 100644 --- a/modules/homelab/system/backups/default.nix +++ b/modules/homelab/system/backups/default.nix @@ -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 = {