-
Notifications
You must be signed in to change notification settings - Fork 0
/
project-zomboid-server.nix
58 lines (51 loc) · 1.47 KB
/
project-zomboid-server.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{ config, pkgs, lib, ... }:
let
steam-app = "380870";
ports = import ./misc/service-ports.nix;
in {
users.users.project-zomboid = {
isSystemUser = true;
home = "/var/lib/project-zomboid";
createHome = true;
homeMode = "750";
group = config.users.groups.project-zomboid.name;
};
users.groups.project-zomboid = {};
systemd.services.project-zomboid = {
wantedBy = [ "multi-user.target" ];
# Install the game before launching.
wants = [ "steamcmd@${steam-app}.service" ];
after = [ "steamcmd@${steam-app}.service" ];
serviceConfig = {
ExecStart = lib.escapeShellArgs [
"${pkgs.steam-run}/bin/steam-run"
"/var/lib/steamcmd/apps/${steam-app}/start-server.sh"
"--servername Asiyah"
"--port ${toString ports.project-zomboid}"
"--udpport ${toString ports.project-zomboid-direct}"
"--steamport1 ${toString ports.project-zomboid-steam-1}"
"--steamport2 ${toString ports.project-zomboid-steam-2}"
];
Nice = "-5";
PrivateTmp = true;
Restart = "always";
User = config.users.users.project-zomboid.name;
WorkingDirectory = "~";
};
environment = {
SteamAppId = "108600";
};
};
networking.firewall.allowedTCPPorts = with ports; [
project-zomboid
project-zomboid-direct
project-zomboid-steam-1
project-zomboid-steam-2
];
networking.firewall.allowedUDPPorts = with ports; [
project-zomboid
project-zomboid-direct
project-zomboid-steam-1
project-zomboid-steam-2
];
}