blob: 50243c17e07db292f9d61995ba7b0348bbf80745 (
plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
{ options, config, lib, pkgs, namespace, ... }:
with lib; with lib.${namespace}; let
cfg = config.${namespace}.services.minecraft.tower;
impermanence = config.${namespace}.system.impermanence;
in {
options.${namespace}.services.minecraft.tower = with types; {
enable = mkEnableOption "tower smp minecraft server";
port = mkOption {
type = types.port;
default = 25565;
description = "server port";
};
start = mkOption {
type = types.bool;
default = true;
description = "autostart";
};
voicechat = {
port = mkOption {
type = types.port;
default = 24454;
description = "voice chat port";
};
force = mkOption {
type = types.bool;
default = false;
description = "require players to have simple voice chat installed";
};
};
};
config = mkIf cfg.enable {
cxl.services.minecraft.enable = true;
environment.persistence.${impermanence.location} = {
directories = [
"/srv/minecraft/tower"
];
};
networking.firewall.allowedUDPPorts = [ cfg.voicechat.port ];
services.minecraft-servers.servers.tower = {
enable = true;
openFirewall = true;
autoStart = cfg.start;
package = pkgs.fabricServers.fabric-1_21_11;
operators = {
"trimet" = "5321640f-e00d-4118-a6cc-47094f19d084";
};
serverProperties = {
enforce-secure-profile = false;
white-list = true;
enforce-whitelist = true;
gamemode = "survival";
difficulty = "hard";
level-seed = "2048000367064948194";
spawn-protection = 0;
max-players = 69;
motd = "the \\u00a79tower\\u00a7r must grow";
server-port = cfg.port;
query-port = cfg.port;
};
symlinks = {
"mods" = pkgs.linkFarmFromDrvs "mods" (builtins.attrValues {
fabric = pkgs.fetchurl {
url = "https://cdn.modrinth.com/data/P7dR8mSH/versions/L34yYPTD/fabric-api-0.141.2%2B1.21.11.jar";
sha256 = "sha256-bB0MT90tgrVgcxiOTK0ogsgODtkifKNzRppCDRz2qXQ=";
};
noChatReports = pkgs.fetchurl {
url = "https://cdn.modrinth.com/data/qQyHxfxd/versions/rhykGstm/NoChatReports-FABRIC-1.21.11-v2.18.0.jar";
sha256 = "sha256-FIAjmJ8BT98BLlDYpDp1zErTkZn4mBT1yMo43N7+ELg=";
};
chunky = pkgs.fetchurl {
url = "https://cdn.modrinth.com/data/fALzjamp/versions/1CpEkmcD/Chunky-Fabric-1.4.55.jar";
sha256 = "sha256-M8vZvODjNmhRxLWYYQQzNOt8GJIkjx7xFAO77bR2vRU=";
};
spark = pkgs.fetchurl {
url = "https://cdn.modrinth.com/data/l6YH9Als/versions/1CB3cS0m/spark-1.10.156-fabric.jar";
sha256 = "sha256-Nu0Tj/3iovH8sy7LzH+iG+rxYR4APRnjrUCVSHPlcvo=";
};
#TODO: distributing this as a compiled binary... sucks
towersmp = pkgs.runCommandLocal "towersmp.jar" {} ''
cp ${./towersmp-1.0.0.jar} $out
'';
voicechat = pkgs.fetchurl {
url = "https://cdn.modrinth.com/data/9eGKb6K1/versions/1OVXKX2W/voicechat-fabric-1.21.11-2.6.11.jar";
sha256 = "sha256-G1/hX+4GVerQMnYrlaNdB8u+Df0hwl7gtSR6ydG5NTs=";
};
lithium = pkgs.fetchurl {
url = "https://cdn.modrinth.com/data/gvQqBUqZ/versions/gl30uZvp/lithium-fabric-0.21.2%2Bmc1.21.11.jar";
sha256 = "sha256-MQZjnHPuI/RL++Xl56gVTf460P1ISR5KhXZ1mO17Bzk=";
};
ferrite = pkgs.fetchurl {
url = "https://cdn.modrinth.com/data/uXXizFIs/versions/eRLwt73x/ferritecore-8.0.3-fabric.jar";
sha256 = "sha256-yG6rrNvwY5ibLKgSyOk/VWuP7/HJ38B8rvodkKXHvzU=";
};
krypton = pkgs.fetchurl {
url = "https://cdn.modrinth.com/data/fQEb0iXm/versions/O9LmWYR7/krypton-0.2.10.jar";
sha256 = "sha256-lCkdVpCgztf+fafzgP29y+A82sitQiegN4Zrp0Ve/4s=";
};
});
"config/voicechat/voicechat-server.properties" = pkgs.writeText "voicechat-server.properties" ''
port=${toString cfg.voicechat.port}
force_voice_chat=${boolToString cfg.voicechat.force}
'';
};
};
};
}
|