diff --git a/loadedskypotato/configuration.nix b/loadedskypotato/configuration.nix index 82b97a1..99c7f75 100644 --- a/loadedskypotato/configuration.nix +++ b/loadedskypotato/configuration.nix @@ -123,17 +123,6 @@ in }; }; - services.nginx.streamConfig = '' - server { - listen 25565 reuseport; - proxy_pass 10.100.0.2:25565; - } - server { - listen 25566 reuseport; - proxy_pass 10.100.0.2:25566; - } - ''; - services.dnsmasq = { enable = true; settings = { @@ -158,10 +147,6 @@ in usePredictableInterfaceNames = false; useDHCP = false; firewall = { - allowedTCPPorts = [ - 25565 # minecraft survival - 25566 # minecraft creative - ]; allowedUDPPorts = [ 51820 # wireguard ]; diff --git a/minecraft/minecraft-servers.nix b/minecraft/minecraft-servers.nix index a3eb097..f55e538 100644 --- a/minecraft/minecraft-servers.nix +++ b/minecraft/minecraft-servers.nix @@ -108,5 +108,28 @@ in cobblemonPort ]; }) + + (lib.mkIf (config.networking.hostName == "loadedskypotato") { + services.nginx.streamConfig = '' + server { + listen ${survivalPort} reuseport; + proxy_pass 10.100.0.2:${survivalPort}; + } + server { + listen ${creativePort} reuseport; + proxy_pass 10.100.0.2:${creativePort}; + } + server { + listen ${cobblemonPort} reuseport; + proxy_pass 10.100.0.2:${cobblemonPort}; + } + ''; + + networking.firewall.allowedTCPPorts = [ + survivalPort + creativePort + cobblemonPort + ]; + }) ]; }