nixos/system/services/minecraft.nix
Evie Litherland-Smith 3dc4432406 Update minecraft sevver to 1.21
Fetch pinned version of nixpkgs-unstable to get newer papermcServer
versions

Remove bedrock.xenia.me.uk since it doesn't actually handle the port
redirection anyway...
2024-07-28 10:53:42 +01:00

43 lines
1.3 KiB
Nix

{
config,
pkgs,
...
}: {
nixpkgs.overlays = [
# Fetch papermc v1.21 from unstable branch of nixpkgs
(final: prev: let
pinnedPkgs = import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/03a94c776f261b78b95de0971a94dea0199b4cd8.tar.gz";
sha256 = "0vngf4g468qd5fqch85nzyvn7bpa6p2i6rdmzc6ws2653x868w3g";
}) {inherit (pkgs) system;};
in {
inherit (pinnedPkgs) papermc papermcServers;
})
];
services.minecraft-server = {
enable = true;
package = pkgs.papermcServers.papermc-1_21;
eula = true;
openFirewall = true;
declarative = true;
jvmOpts = "-Xmx4G -Xms4G";
whitelist = {
"pixelifytica" = "b1848d60-4ddd-4fa4-a328-fb269910b6ae";
"HomeInTheClouds" = "d49f0aee-f217-477b-9516-9d5906f7fc87";
};
serverProperties = {
server-port = 25565;
difficulty = "easy";
gamemode = "survival";
force-gamemode = true;
max-players = 10;
# level-seed = 238902389203;
motd = "NixOS Minecraft server!";
white-list = true;
};
};
# Caddy forwarding
services.caddy.virtualHosts."craft.xenia.me.uk".extraConfig = "reverse_proxy http://localhost:${toString config.services.minecraft-server.serverProperties.server-port}";
}