diff --git a/machines/elrond/configuration.nix b/machines/elrond/configuration.nix index d1db66b..c692320 100644 --- a/machines/elrond/configuration.nix +++ b/machines/elrond/configuration.nix @@ -9,6 +9,7 @@ ./hardware-configuration.nix ../../profiles/webhost.nix ../../profiles/base.nix + ../../services/gate.nix ./routes.nix ]; diff --git a/services/gate.nix b/services/gate.nix new file mode 100644 index 0000000..235be1f --- /dev/null +++ b/services/gate.nix @@ -0,0 +1,44 @@ +{ config, lib, pkgs, ... }: +let + mcPort = 25565; + configurationFile = '' + config: + lite: + enabled: true + routes: + - host: mc.256.no + backend: 100.84.215.84:25565 + ''; + file = pkgs.writeText "gate.yaml" configurationFile; +in +{ + + networking.firewall.allowedTCPPorts = [ mcPort]; + networking.firewall.allowedUDPPorts = [ mcPort]; + + users.users.gate = { + isSystemUser = true; + description = "Gate Minecraft Proxy User"; + home = "/var/lib/gate"; + createHome = true; + group = "gate"; + }; + + users.groups.gate = { + }; + + systemd.services."gate" = { + after = [ "network.target" ]; + wants = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + + serviceConfig = { + ExecStart = "${pkgs.gate}/bin/gate -c ${file}"; + User = "gate"; + Group = "gate"; + Restart = "on-failure"; + ProtectKernelModules = true; + NoNewPrivileges = true; + }; + }; +} diff --git a/services/mc.nix b/services/mc.nix index 9fce8f7..427de2d 100644 --- a/services/mc.nix +++ b/services/mc.nix @@ -1,8 +1,5 @@ { config, pkgs, lib, ... }: { - environment.systemPackages = [ - pkgs.ollama - ]; services.minecraft-server = { enable = true;