🔧 socrates: port forward for minecraft

This commit is contained in:
James Walker 2022-10-10 21:54:45 -04:00
parent d4df0f75b5
commit 84244a77d9
Signed by: walkah
GPG Key ID: 3C127179D6086E93
4 changed files with 34 additions and 18 deletions

View File

@ -7,11 +7,11 @@
]
},
"locked": {
"lastModified": 1664210064,
"narHash": "sha256-df6nKVZe/yAhmJ9csirTPahc0dldwm3HBhCVNA6qWr0=",
"lastModified": 1665392861,
"narHash": "sha256-bCd8fYJMAb0LzabsiXl4nxECDoz483bJOCa2hjox7N0=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "02d2551c927b7d65ded1b3c7cd13da5cc7ae3fcf",
"rev": "ef56fd8979b5f4e800c4716f62076e00600b1172",
"type": "github"
},
"original": {
@ -110,11 +110,11 @@
"utils": "utils_2"
},
"locked": {
"lastModified": 1665098471,
"narHash": "sha256-sNy1nfNg/p/q7JqsJtEOWbV3m5i5M89FzAJwbIn6W2Y=",
"lastModified": 1665271265,
"narHash": "sha256-4Nn0T5YoR3bBLFnPy6Tkc8zzmzMTBjSGZq05c5hKhEI=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "be2cade373d96b469e5f4bb22c40cac87cf5a6f0",
"rev": "e1f1160284198a68ea8c7fffbbb1436f99e46ef9",
"type": "github"
},
"original": {
@ -125,11 +125,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1665040200,
"narHash": "sha256-glqL6yj3aUm40y92inzRmowGt9aIrUrpBX7eBAMic4I=",
"lastModified": 1665321371,
"narHash": "sha256-0SO6MTW0bX6lxZmz1AZW/Xmk+hnTd7/hp1vF7Tp7jg0=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "47fd70289491c1f0c0d9a1f44fb5a9e2801120c9",
"rev": "236ba4df714131059945d7754c0aa3fbe9d2f74c",
"type": "github"
},
"original": {
@ -157,11 +157,11 @@
},
"nixpkgs-22_05": {
"locked": {
"lastModified": 1664201777,
"narHash": "sha256-cUW9DqELUNi1jNMwVSbfq4yl5YGyOfeu+UHUUImbby0=",
"lastModified": 1665279158,
"narHash": "sha256-TpbWNzoJ5RaZ302dzvjY2o//WxtOJuYT3CnDj5N69Hs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "00f877f4927b6f7d7b75731b5a1e2ae7324eaf14",
"rev": "b3783bcfb8ec54e0de26feccfc6cc36b8e202ed5",
"type": "github"
},
"original": {
@ -189,11 +189,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1665056165,
"narHash": "sha256-2C7VfNphJa0FxPoT+suMOmUDVrQ5RIE+NKfDWqElvE4=",
"lastModified": 1665296151,
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "27a89ba43b0fb735ce867e8ab3d2442f8cc61dad",
"rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
"type": "github"
},
"original": {
@ -224,11 +224,11 @@
"nixpkgs-22_05": "nixpkgs-22_05"
},
"locked": {
"lastModified": 1664204020,
"narHash": "sha256-LAey3hr8b9EAt3n304Wt9Vm4uQFd8pSRtLX8leuYFDs=",
"lastModified": 1665289655,
"narHash": "sha256-j1Q9mNBhbzeJykhObiXwEGres9qvP4vH7gxdJ+ihkLI=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "912f9ff41fd9353dec1f783170793699789fe9aa",
"rev": "0ce0449e6404c4ff9d1b7bd657794ae5ca54deb3",
"type": "github"
},
"original": {

View File

@ -11,6 +11,7 @@
../../modules/home-assistant/nginx.nix
../../modules/ipfs/gateway.nix
../../modules/matrix/nginx.nix
../../modules/minecraft/proxy.nix
../../modules/pleroma/nginx.nix
];

View File

@ -8,6 +8,7 @@
# see here for more info: https://minecraft.gamepedia.com/Server.properties#server.properties
serverProperties = {
server-port = 25565;
enable-query = true;
gamemode = "survival";
motd = "Vanilla Survival";
max-players = 20;

View File

@ -0,0 +1,14 @@
{ config, lib, pkgs, ... }:
let
dest_ip = "100.111.208.75";
in
{
boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
networking.firewall.allowedTCPPorts = [ 25565 ];
networking.firewall.extraCommands = ''
IPTABLES=${pkgs.iptables}/bin/iptables
"$IPTABLES" -t nat -A PREROUTING -p tcp --dport 25565 -j DNAT --to-destination ${dest_ip}:25565
"$IPTABLES" -t nat -A POSTROUTING -j MASQUERADE
'';
}