87 lines
3.2 KiB
Nix
87 lines
3.2 KiB
Nix
{ config, pkgs, ... }:
|
|
|
|
{
|
|
sops.secrets."minecraft/storage-box-key" = {
|
|
sopsFile = ../../../../sus/neuro-minecraft.yaml;
|
|
owner = "minecraft-map-import-wowMineMap";
|
|
group = "minecraft-map-import-wowMineMap";
|
|
mode = "0400";
|
|
};
|
|
|
|
services.minecraft-world-imports.wowMineMap = {
|
|
enable = true;
|
|
serverName = "wowMineMap";
|
|
remoteHost = "u664722.your-storagebox.de";
|
|
remoteUser = "u664722";
|
|
remotePath = "minecraft/map/versions/wowmine-20261114T223938Z-winter-biomes.tar.gz";
|
|
archiveName = "wowmine-20261114T223938Z-winter-biomes.tar.gz";
|
|
cacheDir = "/var/lib/minecraft-maps";
|
|
archiveSha256 = "d1afd169b16b7b50a57c47da46245e93285b46b6c833bfd08941d07d0341b208";
|
|
sshKeyFile = config.sops.secrets."minecraft/storage-box-key".path;
|
|
worldName = "world";
|
|
hostPublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5EB5p/5Hp3hGW1oHok+PIOH9Pbn7cnUiGmUEBrCVjnAw+HrKyN8bYVV0dIGllswYXwkG/+bgiBlE6IVIBAq+JwVWu1Sss3KarHY3OvFJUXZoZyRRg/Gc/+LRCE7lyKpwWQ70dbelGRyyJFH36eNv6ySXoUYtGkwlU5IVaHPApOxe4LHPZa/qhSRbPo2hwoh0orCtgejRebNtW5nlx00DNFgsvn8Svz2cIYLxsPVzKgUxs8Zxsxgn+Q/UvR7uq4AbAhyBMLxv7DjJ1pc7PJocuTno2Rw9uMZi1gkjbnmiOh6TTXIEWbnroyIhwc8555uto9melEUmWNQ+C+PwAK+MPw==";
|
|
};
|
|
|
|
systemd.services.minecraft-world-reset-wowMineMap = {
|
|
description = "Reset wowmine to the pinned source map";
|
|
path = [ pkgs.coreutils pkgs.systemd ];
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
TimeoutStartSec = "45min";
|
|
};
|
|
script = let
|
|
source = config.services.minecraft-world-imports.wowMineMap;
|
|
in ''
|
|
set -eu
|
|
printf '%s %s\n' \
|
|
'${source.archiveSha256}' \
|
|
'${source.cacheDir}/${source.archiveName}' | sha256sum -c -
|
|
systemctl stop minecraft-server-wowMineMap.service minecraft-world-import-wowMineMap.service
|
|
rm -rf -- '${config.services.minecraft-servers.dataDir}/wowMineMap/${source.worldName}'
|
|
systemctl start minecraft-server-wowMineMap.service
|
|
'';
|
|
};
|
|
|
|
sops.secrets."minecraft/rcon-password" = {
|
|
sopsFile = ../../../../sus/neuro-minecraft.yaml;
|
|
owner = "minecraft";
|
|
group = "minecraft";
|
|
mode = "0400";
|
|
restartUnits = [ "minecraft-server-wowMineMap.service" ];
|
|
};
|
|
|
|
# The module's automatic firewall would also expose RCON.
|
|
networking.firewall.allowedTCPPorts = [ 35565 ];
|
|
networking.firewall.allowedUDPPorts = [ 36565 ];
|
|
services.minecraft-servers.servers.wowMineMap = {
|
|
openFirewall = false;
|
|
extraStartPre = ''
|
|
chmod 600 server.properties
|
|
{
|
|
printf '\nrcon.password='
|
|
cat ${config.sops.secrets."minecraft/rcon-password".path}
|
|
printf '\n'
|
|
} >> server.properties
|
|
'';
|
|
enable = true;
|
|
jvmOpts = "-Xmx24G -Xms2G";
|
|
# wowmine client and server use the same pinned NeoForge.
|
|
package = pkgs.minecraftServers.neoforge-1_21_1.override (
|
|
builtins.fromJSON (builtins.readFile ./neoforge-21.1.250.json)
|
|
);
|
|
|
|
serverProperties = {
|
|
server-port = 35565;
|
|
difficulty = "hard";
|
|
online-mode = false;
|
|
enable-rcon = true;
|
|
enable-command-block = true;
|
|
"rcon.port" = 25575;
|
|
view-distance = 32;
|
|
simulation-distance = 32;
|
|
level-name = "world";
|
|
pause-when-empty-seconds = 0;
|
|
};
|
|
};
|
|
}
|