nixos/applications/games/minecraft.nix

72 lines
1.9 KiB
Nix
Raw Normal View History

{
skynet_dns.records = {
external = [];
cname = [
# create a sub-subdomain for each game
"compsoc_classic.minecraft.games CNAME games"
"compsoc_test.minecraft.games CNAME games"
];
};
networking.firewall.allowedTCPPorts = [
# for the proxy
25565
# the servers
20000
20001
];
# arion is one way to use docker on nixos
# see https://gitlab.com/c2842/computer_society/nixos/-/blob/733b867f4782afa795848135a83e97a5cafaf16a/applications/games/minecraft.nix
# for an example of a single compose file with multiple services
virtualisation.arion = {
backend = "docker";
projects = {
minecraft_proxy.settings.services.mc_proxy.service = {
2023-04-26 01:18:21 +00:00
image = "itzg/mc-router:1.18.0";
ports = [ "25565:25565/tcp" ];
expose = [ "25565" ];
command = [
"--mapping=compsoc_classic.minecraft.games.skynet.ie=172.17.0.1:20000,compsoc_test.minecraft.games.skynet.ie=172.17.0.1:20001"
];
};
minecraft_compsoc_classic.settings.services.compsoc_classic.service = {
image = "nimmis/spigot:latest";
# setting these here as they arent special
environment = {
# this is what it last ran on
SPIGOT_VER="1.18.2";
EULA="true";
};
# where the config files are stored
volumes = [ "/etc/games/minecraft/compsoc/test/config:/minecraft" ];
ports = [
"20000:25565/tcp"
];
};
minecraft_compsoc_test.settings.services.compsoc_test.service = {
image = "nimmis/spigot:latest";
environment = {
# this is what it last ran on
SPIGOT_VER="1.18.2";
EULA="true";
};
# where the config files are stored
volumes = [ "/etc/games/minecraft/compsoc/test2/config:/minecraft" ];
ports = [
"20001:25565/tcp"
];
};
};
};
}