From 244a3f98261d3e4f3b728a75798ce3470bdd8594 Mon Sep 17 00:00:00 2001 From: Christine Elisabeth Koppel Date: Thu, 9 Apr 2026 18:21:26 +0300 Subject: [PATCH 1/4] Refactor ATM10 Minecraft server configuration by making it systemd instead, because of script bakedness. --- .../modules/system/minecraft.nix | 174 +++--------------- 1 file changed, 28 insertions(+), 146 deletions(-) diff --git a/nix-system-configs/modules/system/minecraft.nix b/nix-system-configs/modules/system/minecraft.nix index c120017..1f1b92f 100644 --- a/nix-system-configs/modules/system/minecraft.nix +++ b/nix-system-configs/modules/system/minecraft.nix @@ -7,10 +7,6 @@ choose = paths: builtins.head (builtins.filter (p: builtins.pathExists p) paths); # Domain and Cloudflare DDNS records configured here. Update this list to add/remove records. domain = "prg-radio.org"; - # Try to use the nix-minecraft helper if the overlay is present; otherwise - # fall back to a local path. If you use the fallback, ensure the path is an - # unpacked modpack directory with `mods` and `config` subdirectories. - modpack = /srv/minecraft/modpacks/atm10; in { options.local = { hostname = lib.mkOption { @@ -70,130 +66,6 @@ in { eula = true; openFirewall = true; - servers.all-the-mods-tss = { - enable = true; - autoStart = true; - restart = "always"; - - package = pkgs.neoforgeServers.neoforge-1_21_1-21_1_224; - - jvmOpts = lib.concatStringsSep " " [ - "-Xms4G" - "-Xmx45G" - "-XX:+UseG1GC" - "-XX:+ParallelRefProcEnabled" - "-XX:MaxGCPauseMillis=200" - "-XX:+UnlockExperimentalVMOptions" - "-XX:+DisableExplicitGC" - "-XX:+AlwaysPreTouch" - "-XX:G1NewSizePercent=30" - "-XX:G1MaxNewSizePercent=40" - "-XX:G1HeapRegionSize=8M" - "-XX:G1ReservePercent=20" - "-XX:G1HeapWastePercent=5" - "-XX:G1MixedGCCountTarget=4" - "-XX:InitiatingHeapOccupancyPercent=15" - "-XX:G1MixedGCLiveThresholdPercent=90" - "-XX:G1RSetUpdatingPauseTimePercent=5" - "-XX:SurvivorRatio=32" - "-XX:+PerfDisableSharedMem" - "-XX:MaxTenuringThreshold=1" - ]; - - serverProperties = { - server-port = 25566; - motd = "The Sub Server All the Mods 10"; - difficulty = "hard"; - gamemode = "survival"; - max-players = 64; - online-mode = true; - white-list = false; - spawn-protection = 0; - view-distance = 9; - simulation-distance = 3; - enforce-secure-profile = false; - enable-command-block = false; - enable-rcon = false; - require-resource-pack = false; - level-type = "minecraft:amplified"; - level-seed = "-2032795982907864146"; - - # Added properties (do not overwrite existing ones above) - accepts-transfers = false; - allow-flight = true; - allow-nether = true; - broadcast-console-to-ops = true; - broadcast-rcon-to-ops = true; - bug-report-link = ""; - enable-jmx-monitoring = false; - enable-query = false; - enable-status = true; - enforce-whitelist = false; - entity-broadcast-range-percentage = 100; - force-gamemode = false; - function-permission-level = 2; - generate-structures = true; - hardcore = false; - hide-online-players = false; - initial-disabled-packs = ""; - initial-enabled-packs = "vanilla"; - level-name = "world"; - log-ips = true; - max-chained-neighbor-updates = 1000000; - max-tick-time = 180000; - max-world-size = 29999984; - network-compression-threshold = 256; - op-permission-level = 4; - player-idle-timeout = 0; - prevent-proxy-connections = false; - pvp = true; - # dotted keys must be quoted - "query.port" = 25566; - rate-limit = 0; - "rcon.password" = ""; - "rcon.port" = 25575; - region-file-compression = "deflate"; - resource-pack = ""; - resource-pack-id = ""; - resource-pack-prompt = ""; - resource-pack-sha1 = ""; - server-ip = ""; - spawn-animals = true; - spawn-monsters = true; - spawn-npcs = true; - sync-chunk-writes = true; - text-filtering-config = ""; - use-native-transport = true; - # white-list, view-distance, simulation-distance, spawn-protection, etc. - # were kept above to avoid overwriting existing values. - }; - - # Grant operator privileges to the user with the given UUID. - # Update `name` to the player's Minecraft username if you know it. - operators = { - username1 = { - uuid = "5e52c4ba-9b1a-469b-8f68-b9d684eae31d"; - level = 4; # 4 = highest permission (operator) - bypassesPlayerLimit = true; - }; - }; - - symlinks = { - "mods" = "${modpack}/mods"; - "datapacks" = "${modpack}/datapacks"; - "user_jvm_args.txt" = "${modpack}/user_jvm_args.txt"; - }; - files = { - "config" = "${modpack}/config"; - "patchouli_books" = "${modpack}/patchouli_books"; - "defaultconfigs" = "${modpack}/defaultconfigs"; - "kubejs" = "${modpack}/kubejs"; - "local" = "${modpack}/local"; - ".mixin.out" = "${modpack}/.mixin.out"; - "dynamic-data-pack-cache" = "${modpack}/dynamic-data-pack-cache"; - }; - }; - servers.fabric-modded = { enable = true; autoStart = true; @@ -509,24 +381,6 @@ in { ); }; - # Ensure the other server unit also uses OpenJDK 21 - systemd.services."minecraft-server-all-the-mods-tss".environment = { - JAVA_HOME = lib.mkForce "${pkgs.openjdk21}"; - PATH = lib.mkForce ( - lib.makeBinPath [ - pkgs.openjdk21 - pkgs.git - pkgs.git-lfs - pkgs.coreutils - pkgs.findutils - pkgs.gnugrep - pkgs.gnused - pkgs.systemd - ] - + ":/run/current-system/sw/bin" - ); - }; - # The nix-minecraft module creates the `minecraft` user/group automatically. users.users.minecraftprg.extraGroups = ["minecraft"]; @@ -534,8 +388,36 @@ in { postgresql_jdbc git git-lfs + openjdk21 ]; + systemd.services.minecraft-atm10 = { + description = "All the Mods 10 Minecraft Server"; + after = ["network.target"]; + wantedBy = ["multi-user.target"]; + + serviceConfig = { + Type = "simple"; + User = "minecraft"; + Group = "minecraft"; + WorkingDirectory = "/srv/minecraft/atm10tss"; + ExecStart = "/srv/minecraft/atm10tss/run.sh"; + Restart = "on-failure"; + RestartSec = "10s"; + StandardOutput = "journal"; + StandardError = "journal"; + }; + }; + + # Optionally, ensure the user exists: + users.users.minecraft = { + isSystemUser = true; + home = "/srv/minecraft"; + group = "minecraft"; + }; + + users.groups.minecraft = {}; + system.stateVersion = "25.11"; }; } From 03a9eac24863c5b2f5466629d6d71ee80e870220 Mon Sep 17 00:00:00 2001 From: Christine Elisabeth Koppel Date: Thu, 9 Apr 2026 18:40:13 +0300 Subject: [PATCH 2/4] Fix the failed start. --- nix-system-configs/modules/system/minecraft.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nix-system-configs/modules/system/minecraft.nix b/nix-system-configs/modules/system/minecraft.nix index 1f1b92f..8d778f2 100644 --- a/nix-system-configs/modules/system/minecraft.nix +++ b/nix-system-configs/modules/system/minecraft.nix @@ -400,8 +400,9 @@ in { Type = "simple"; User = "minecraft"; Group = "minecraft"; + Environment = "PATH=${pkgs.coreutils}/bin:${pkgs.bash}/bin:/run/wrappers/bin:${pkgs.openjdk21}/bin"; WorkingDirectory = "/srv/minecraft/atm10tss"; - ExecStart = "/srv/minecraft/atm10tss/run.sh"; + ExecStart = "${pkgs.bash}/bin/bash /srv/minecraft/atm10tss/run.sh"; Restart = "on-failure"; RestartSec = "10s"; StandardOutput = "journal"; From 36507e313211240babb6db6810cd5e377d2863e8 Mon Sep 17 00:00:00 2001 From: Christine Elisabeth Koppel Date: Thu, 9 Apr 2026 19:19:00 +0300 Subject: [PATCH 3/4] Derp. --- nix-system-configs/modules/system/traefik.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nix-system-configs/modules/system/traefik.nix b/nix-system-configs/modules/system/traefik.nix index 9c7b9f4..2fe605b 100644 --- a/nix-system-configs/modules/system/traefik.nix +++ b/nix-system-configs/modules/system/traefik.nix @@ -600,6 +600,13 @@ in { service = "minecraft"; entryPoints = ["minecraft"]; }; + # TCP router for Minecraft Modded (plain TCP on 25566) + minecraft = { + # Use catch-all SNI rule because Minecraft clients don't use TLS/SNI + rule = "HostSNI(`*`)"; + service = "minecraft_modded"; + entryPoints = ["minecraft_modded"]; + }; # TCP router for Minecraft Bedrock (19132) minecraft-bedrock-tcp = { From 4d35e3ab65761b8aca2d77257e760017090b696c Mon Sep 17 00:00:00 2001 From: Christine Elisabeth Koppel Date: Thu, 9 Apr 2026 19:21:01 +0300 Subject: [PATCH 4/4] Derp. --- nix-system-configs/modules/system/traefik.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix-system-configs/modules/system/traefik.nix b/nix-system-configs/modules/system/traefik.nix index 2fe605b..af1e4de 100644 --- a/nix-system-configs/modules/system/traefik.nix +++ b/nix-system-configs/modules/system/traefik.nix @@ -601,7 +601,7 @@ in { entryPoints = ["minecraft"]; }; # TCP router for Minecraft Modded (plain TCP on 25566) - minecraft = { + minecraft_modded = { # Use catch-all SNI rule because Minecraft clients don't use TLS/SNI rule = "HostSNI(`*`)"; service = "minecraft_modded";