diff --git a/modules/gameservers/minecraft_modded/default.nix b/modules/gameservers/minecraft_modded/default.nix index 607a249..e497640 100644 --- a/modules/gameservers/minecraft_modded/default.nix +++ b/modules/gameservers/minecraft_modded/default.nix @@ -49,6 +49,21 @@ in { default = "/holocron/archives/gameservers/minecraft/modded"; description = "path to take hourly backups to with borg!"; }; + offsite_user = lib.mkOption { + type = lib.types.str; + default = "lifeboat"; + description = "user to connect to offsite host with"; + }; + offsite_target = lib.mkOption { + type = lib.types.str; + default = "lifeboat.holocron.blue"; + description = "ip or domain for offsite backups"; + }; + offsite_dir = lib.mkOption { + type = lib.types.str; + default = "lifeboat/holocron/archives/gameservers"; + description = "path to rsync offsite backups to"; + }; }; config = lib.mkIf cfg.enable { @@ -140,6 +155,13 @@ in { ); compression = "auto,zstd"; #preHook = "systemctl start mysql-backup.service"; + postHook = '' + ${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} + ''; startAt = "*-*-* *:00:00"; group = "archives"; encryption.mode = "repokey-blake2";