nixos/modules/ccqcraft.nix

48 lines
1.2 KiB
Nix

{pkgs, ...}: let
ports = {
minecraft = 25565;
rcon = 24738;
voicechat = 24454;
dynmap = 8123;
};
in {
virtualisation.docker.enable = true;
users.users.ccqcraft = {
isNormalUser = true;
extraGroups = ["docker"];
hashedPassword = "$6$D69mzkGZAitfCQOL$oL/7SmSqGwRhZgyiOEgp6N5NkZ/NpdzggomtPFa4XB33Kb3aZMBiLWQS3VSHZhRo2y9mPgXy3mFPSvtvCzoKz/";
};
environment.systemPackages = with pkgs; [
git
docker-compose
megatools
unzip
];
networking.firewall = {
allowedTCPPorts = [ports.minecraft ports.rcon];
allowedUDPPorts = [
# Port used for Voicechat plugin
ports.voicechat
];
};
# Expose dynmap map through nginx
services.nginx.virtualHosts."map.ccqcraft.de" = {
serverAliases = ["ccqcraft.de"];
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://[::1]:${builtins.toString ports.dynmap}";
#proxyWebsockets = true; # needed if you need to use WebSocket
#extraConfig =
# required when the target is also TLS server with multiple hosts
#"proxy_ssl_server_name on;" +
# required when the server wants to use HTTP Authentication
#"proxy_pass_header Authorization;";
};
};
}