From 733b867f4782afa795848135a83e97a5cafaf16a Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Wed, 26 Apr 2023 00:24:54 +0100 Subject: [PATCH] games: split minecraft out into its own folder for manageability --- applications/games.nix | 88 ++------------------------------ applications/games/minecraft.nix | 76 +++++++++++++++++++++++++++ machines/optimus.nix | 2 - 3 files changed, 79 insertions(+), 87 deletions(-) create mode 100644 applications/games/minecraft.nix diff --git a/applications/games.nix b/applications/games.nix index 85cc8e2..47601e3 100644 --- a/applications/games.nix +++ b/applications/games.nix @@ -1,87 +1,5 @@ { ... }: { - imports = []; - - /* - backups = [ - "/etc/silver_satisfactory/config/" - "/etc/silver_valheim/config/" - ]; - */ - - # since this is going to be pulled into a machiene that has skynet_dns we dont need to import it above - # gonna use it to create sub-subdomains for each game server - skynet_dns.records = { - external = []; - cname = [ - # create a sub-subdomain for each game - "compsoc_classic.minecraft.games CNAME games" - "compsoc_test.minecraft.games CNAME games" - ]; - }; - - # arion is one way to use docker on nixos - virtualisation.arion = { - backend = "docker"; - projects = { - - # this is basically one single docker-compose file - minecraft.settings = { - docker-compose.raw.networks.default.name = "minecraft"; - - services = { - mc_proxy = { - service = { - image = "ghcr.io/haveachin/infrared:1.3.3"; - environment = { - INFRARED_CONFIG_PATH = "/configs"; - }; - - volumes = [ "/etc/games/minecraft/proxy:/configs" ]; - ports = [ - "25565:25565/tcp" - ]; - - expose = [ - "25565" - ]; - }; - }; - - mc_compsoc = { - 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" ]; - }; - }; - - mc_compsoc2 = { - 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" ]; - }; - - }; - - }; - }; - - # next game here - - }; - }; + imports = [ + ./games/minecraft.nix + ]; } \ No newline at end of file diff --git a/applications/games/minecraft.nix b/applications/games/minecraft.nix new file mode 100644 index 0000000..37f65df --- /dev/null +++ b/applications/games/minecraft.nix @@ -0,0 +1,76 @@ +{ + + 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 = [ 25565 ]; + + # arion is one way to use docker on nixos + virtualisation.arion = { + backend = "docker"; + projects = { + + # this is basically one single docker-compose file + minecraft.settings = { + docker-compose.raw.networks.default.name = "minecraft"; + + services = { + mc_proxy = { + service = { + image = "ghcr.io/haveachin/infrared:1.3.3"; + environment = { + INFRARED_CONFIG_PATH = "/configs"; + }; + + volumes = [ "/etc/games/minecraft/proxy:/configs" ]; + ports = [ + "25565:25565/tcp" + ]; + + expose = [ + "25565" + ]; + }; + }; + + mc_compsoc = { + 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" ]; + }; + }; + + mc_compsoc2 = { + 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" ]; + }; + + }; + + }; + }; + }; + }; +} \ No newline at end of file diff --git a/machines/optimus.nix b/machines/optimus.nix index 50db3a9..b10be16 100644 --- a/machines/optimus.nix +++ b/machines/optimus.nix @@ -50,6 +50,4 @@ in { ]; }; - networking.firewall.allowedTCPPorts = [ 25565 ]; - }