added minecraft proxy

This commit is contained in:
Adrian Gunnar Lauterer 2024-06-05 10:39:24 +02:00 committed by Adrian G L
parent 97ab291ffa
commit 2c424fc40a
3 changed files with 45 additions and 3 deletions

View File

@ -9,6 +9,7 @@
./hardware-configuration.nix
../../profiles/webhost.nix
../../profiles/base.nix
../../services/gate.nix
./routes.nix
];

44
services/gate.nix Normal file
View File

@ -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;
};
};
}

View File

@ -1,8 +1,5 @@
{ config, pkgs, lib, ... }:
{
environment.systemPackages = [
pkgs.ollama
];
services.minecraft-server = {
enable = true;