From 9e284cee3f2192983a01b9a5497fc1ea272619f8 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 25 Nov 2021 01:08:31 +0200 Subject: [PATCH] VEGAS: quick-and-dirty minecraft server --- hosts/VEGAS/system.nix | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/hosts/VEGAS/system.nix b/hosts/VEGAS/system.nix index b7e455d..7754052 100644 --- a/hosts/VEGAS/system.nix +++ b/hosts/VEGAS/system.nix @@ -71,4 +71,34 @@ "systemd-journald@.socket" "systemd-journald-varlink@.socket" ]; + + nixpkgs.config.allowUnfree = true; + services.minecraft-server = let + modpack = fetchTarball { + url = "https://bafybeiar4mnqvbwkb4glerj6yibccgscbff7nzeojf6px3oapxn7f7hymq.ipfs.privatevoid.net/modpack.tar.gz"; + sha256 = "sha256:1iqd6mlknbq4r3iqpfsibp8h2kknaaqkqarnw03z2s61ivsqq7lc"; + }; + in { + enable = true; + eula = true; + openFirewall = true; + package = pkgs.minecraft-server.overrideAttrs (_: { + version = "forge-1.12.2"; + src = "${modpack}/forge-1.12.2-14.23.5.2796-universal.jar"; # HACK + }); + }; + systemd.services.minecraft-server.path = [ pkgs.jre8 ]; + systemd.services.minecraft-server.serviceConfig = { + ExecStart = lib.mkForce "/var/lib/minecraft/start.sh"; + }; + + users.users.minecraft.group = "minecraft-sftp"; + users.groups.minecraft-sftp = {}; + services.openssh.extraConfig = '' + Match Group minecraft-sftp + ChrootDirectory /srv/minecraft-cc-sftp + ForceCommand internal-sftp -u 0002 + AllowTcpForwarding no + X11Forwarding no + ''; }