From 6b85b9523c859fdbedccb1211f52fc9d25132d4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Sat, 21 Aug 2021 00:20:20 +0100 Subject: [PATCH 1/6] minecraft: Enable command blocks to fix ice and fire ores --- .../services/configs/minecraft/voor-kia/server.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/services/configs/minecraft/voor-kia/server.properties b/configuration/services/configs/minecraft/voor-kia/server.properties index 1c5787e..84a8cd5 100644 --- a/configuration/services/configs/minecraft/voor-kia/server.properties +++ b/configuration/services/configs/minecraft/voor-kia/server.properties @@ -5,7 +5,7 @@ allow-nether=true broadcast-console-to-ops=true broadcast-rcon-to-ops=true difficulty=normal -enable-command-block=false +enable-command-block=true enable-jmx-monitoring=false enable-query=false enable-rcon=false From b7d0d7521c4cbabb11b72434bcc03105e40ee6b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Tue, 24 Aug 2021 00:02:47 +0100 Subject: [PATCH 2/6] flake.lock: Update Flake input changes: * Updated 'flake-utils': 'github:numtide/flake-utils/7d706970d94bc5559077eb1a6600afddcd25a7c8' -> 'github:numtide/flake-utils/997f7efcb746a9c140ce1f13c72263189225f482' * Updated 'nixos-hardware': 'github:nixos/nixos-hardware/fccbee72df707c3fb074854668deee6e1ff02351' -> 'github:nixos/nixos-hardware/de40acde6c056a7c5f3c9ad4dca0c172fa35d207' * Updated 'nixpkgs': 'github:nixos/nixpkgs/5de44c15758465f8ddf84d541ba300b48e56eda4' -> 'github:nixos/nixpkgs/a1007637cea374bd1bafd754cfd5388894c49129' --- flake.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index b2d4187..ee275c8 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "flake-utils": { "locked": { - "lastModified": 1622445595, - "narHash": "sha256-m+JRe6Wc5OZ/mKw2bB3+Tl0ZbtyxxxfnAWln8Q5qs+Y=", + "lastModified": 1629481132, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", "owner": "numtide", "repo": "flake-utils", - "rev": "7d706970d94bc5559077eb1a6600afddcd25a7c8", + "rev": "997f7efcb746a9c140ce1f13c72263189225f482", "type": "github" }, "original": { @@ -37,11 +37,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1623143341, - "narHash": "sha256-a8NjpJVvJkb3ehu/KP1OaWwlRexom2D7lQEH5uCO9yA=", + "lastModified": 1629744693, + "narHash": "sha256-guZxgF5v8Avqpdu5M/F3ygZ4f67Y6ruS7y2kA5yUhZE=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "fccbee72df707c3fb074854668deee6e1ff02351", + "rev": "de40acde6c056a7c5f3c9ad4dca0c172fa35d207", "type": "github" }, "original": { @@ -53,11 +53,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1622922048, - "narHash": "sha256-nTyKxe0n7l/4HSmYaIN+63WQrvHrTJY6drSwP7bMqhU=", + "lastModified": 1629379628, + "narHash": "sha256-dI8wpEo7wIVWoTUk2oyWFUnlVHNKLs+ren1TqITN1mI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5de44c15758465f8ddf84d541ba300b48e56eda4", + "rev": "a1007637cea374bd1bafd754cfd5388894c49129", "type": "github" }, "original": { From 64057828cb5ad6f35bd53be690f30c46d85280a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Tue, 24 Aug 2021 00:31:35 +0100 Subject: [PATCH 3/6] minecraft: Fix forge server curl command --- pkgs/minecraft/forge-server.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/minecraft/forge-server.nix b/pkgs/minecraft/forge-server.nix index 22df91f..2dea39a 100644 --- a/pkgs/minecraft/forge-server.nix +++ b/pkgs/minecraft/forge-server.nix @@ -7,6 +7,7 @@ let mirror = "https://files.minecraftforge.net/maven/net/minecraftforge/forge"; src = fetchurl { url = "${mirror}/${version}/forge-${version}-installer.jar"; + curlOpts = "--globoff"; # Forge doesn't seem to like newer shas sha1 = "e97821e5431bdcaa46e12048769922e2cdb5e2e1"; }; From 4fe3b8b22b43d4f2be8e60ac8561ec13707dfdb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Wed, 25 Aug 2021 19:45:15 +0100 Subject: [PATCH 4/6] minecraft: Fix ridiculous CPU usage Tapes over https://bugs.mojang.com/browse/MC-183518, which schedules things completely stupidly on Linux starting with 1.14. --- configuration/default.nix | 2 ++ configuration/services/minecraft.nix | 1 + 2 files changed, 3 insertions(+) diff --git a/configuration/default.nix b/configuration/default.nix index a12aceb..683b144 100644 --- a/configuration/default.nix +++ b/configuration/default.nix @@ -20,6 +20,8 @@ trustedUsers = [ "@wheel" ]; }; + boot.kernelParams = [ "highres=off" "nohz=off" ]; + networking = { hostName = "tlaternet"; diff --git a/configuration/services/minecraft.nix b/configuration/services/minecraft.nix index 9b77c09..826ecd9 100644 --- a/configuration/services/minecraft.nix +++ b/configuration/services/minecraft.nix @@ -90,6 +90,7 @@ in { }; }; + extraOptions = [ "--cpu-quota=90000" ]; autoStart = false; ports = [ "25565:25565" ]; volumes = [ From 6bc37ebdae3fe3e54455aefcad659f5759997033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Fri, 27 Aug 2021 18:09:43 +0100 Subject: [PATCH 5/6] minecraft: Limit to a single core instead of limiting the quota Minecraft is anyway supposed to be single-threaded, so if it goes beyond one core something is very wrong. --- configuration/services/minecraft.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/services/minecraft.nix b/configuration/services/minecraft.nix index 826ecd9..af5c75f 100644 --- a/configuration/services/minecraft.nix +++ b/configuration/services/minecraft.nix @@ -90,7 +90,7 @@ in { }; }; - extraOptions = [ "--cpu-quota=90000" ]; + extraOptions = [ "--cpus=1.0" ]; autoStart = false; ports = [ "25565:25565" ]; volumes = [ From a66eac3b17ee54faddb577c9d84c4eaae7478452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Fri, 27 Aug 2021 18:10:19 +0100 Subject: [PATCH 6/6] minecraft: Add automatic restart scheduling This starts/stops the server at 2 pm and 4 am respectively. This should hopefully fix some of the issues caused by shoddy programming. --- configuration/services/minecraft.nix | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/configuration/services/minecraft.nix b/configuration/services/minecraft.nix index af5c75f..bf8f58f 100644 --- a/configuration/services/minecraft.nix +++ b/configuration/services/minecraft.nix @@ -102,4 +102,31 @@ in { "${whitelist}:/var/lib/minecraft/whitelist.json:ro" ]; }; + + systemd.timers.podman-minecraft-voor-kia-off = { + description = "Turns off the minecraft server every day at 4 am"; + wantedBy = [ "podman-minecraft-voor-kia.service" ]; + timerConfig = { + Unit = "podman-minecraft-voor-kia-starter@stop.service"; + OnCalendar = "04:00:00"; + }; + }; + + systemd.timers.podman-minecraft-voor-kia-on = { + description = "Turns on the minecraft server every day at 2 pm"; + wantedBy = [ "podman-minecraft-voor-kia.service" ]; + timerConfig = { + Unit = "podman-minecraft-voor-kia-starter@start.service"; + OnCalendar = "14:00:00"; + }; + }; + + systemd.services."podman-minecraft-voor-kia-starter@" = { + description = "Unit to stop/start the minecraft server"; + serviceConfig = { + ExecStart = + "${pkgs.systemd}/bin/systemctl %i podman-minecraft-voor-kia.service"; + Type = "oneshot"; + }; + }; }