From df31a3da358857eff2e6e9bb07e310ea4f8b1191 Mon Sep 17 00:00:00 2001 From: schweby Date: Fri, 16 Apr 2021 22:18:20 +0200 Subject: [PATCH] hainich/minecraft: get server.jar via sources.json --- hosts/hainich/services/minecraft.nix | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/hosts/hainich/services/minecraft.nix b/hosts/hainich/services/minecraft.nix index b00fc2f..3bd05ed 100644 --- a/hosts/hainich/services/minecraft.nix +++ b/hosts/hainich/services/minecraft.nix @@ -1,21 +1,19 @@ {pkgs, lib, config, ...}: + +let + sources = import ../../../nix/sources.nix; +in { nixpkgs.config.allowUnfree = true; networking.firewall.allowedTCPPorts = [ 25565 ]; services.minecraft-server = { - package = let - version = "1.16.5-592"; - url = "https://papermc.io/api/v2/projects/paper/versions/1.16.5/builds/592/downloads/paper-1.16.5-592.jar"; - sha256 = "039w44c7png9ppg8w2287mm0aavqdsvg9cdf50p2faa2bs586j9i"; - in (pkgs.minecraft-server.overrideAttrs (old: rec { - name = "minecraft-server-${version}"; - inherit version; - src = pkgs.fetchurl { - inherit url sha256; - }; - })); enable = true; + package = (pkgs.minecraft-server.overrideAttrs (old: rec { + version = "${sources.papermc.rev}-${sources.papermc.version}"; + name = "papermc-${version}"; + src = sources.papermc.outPath; + })); declarative = true; eula = true; jvmOpts = "-Xmx1536M -Xms512M -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 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true";