nixos/system/services/minecraft.nix

35 lines
945 B
Nix

{
config,
pkgs,
...
}: {
services.minecraft-server = {
enable = true;
package = pkgs.papermcServers.papermc-1_20_4;
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}";
"bedrock.xenia.me.uk".extraConfig = "reverse_proxy http://localhost:19132";
};
}