blob: 7aa620a9f7b0813fa4a625ff9251b8dc1b305bea (
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
|
{ config, lib, pkgs, inputs, ... }: let
cfg = config.homelab.games.minecraft;
in {
imports = [ inputs.nix-minecraft.nixosModules.minecraft-servers ];
options.homelab.games.minecraft.enable = lib.mkEnableOption "minecraft servers";
config = lib.mkIf cfg.enable {
nixpkgs.overlays = [ inputs.nix-minecraft.overlay ];
environment.systemPackages = [
pkgs.packwiz
(pkgs.writeShellScriptBin "mcconsole" ''
if [ -z "$1" ]; then
name="fantasy"
else
name="$1"
fi
sudo ${lib.getExe pkgs.tmux} -S "/run/minecraft/$name.sock" attach
'')
];
networking.firewall.allowedUDPPorts = [ /*svc*/ 24454 24453 ];
services.minecraft-servers = let
fantasy-modpack = pkgs.fetchPackwizModpack {
url = "https://git.lucia.garden/fantasy-minecraft-modpack.git/plain/pack.toml";
packHash = "sha256-UxL5gKBMHyRGGZzGeoo9jJ+sXXC6huqqp20mmaO0GPs=";
};
in {
enable = true;
eula = true;
openFirewall = true;
servers = {
vanilla-1_21_1 = {
enable = false;
package = pkgs.vanillaServers.vanilla-1_21_1;
serverProperties = {
server-port = 25566;
};
};
fantasy = {
enable = true;
package = pkgs.fabricServers.fabric-1_20_1;
symlinks = {
"mods" = "${fantasy-modpack}/mods";
"config/additional-additions-config.json" = "${fantasy-modpack}/config/additional-additions-config.json";
"config/fwaystones/config.json5" = "${fantasy-modpack}/config/fwaystones/config.json5";
"config/simplebackup.json5" = "${fantasy-modpack}/config/simplebackup.json5";
};
jvmOpts = "-Xms8192M -Xmx8192M";
serverProperties = {
level-seed = "-5424614792051443123";
allow-flight = true;
spawn-protection = 0;
max-players = 6;
server-port = 25565;
simulation-distance = 8;
view-distance = 12;
difficulty = "normal";
# motd = ''\u00a7f-------\u00a7d Fantasy\u00a7f ----------\u00a7r\n\u00a7f--\u00a7c Survival\u00a7f ---\u00a7b Multiplayer\u00a7f --'';
motd = ''\u00a7r \u00a7f------------ << \u00a7dlucia\u00a7f.\u00a72garden\u00a7f >> ------------\u00a7r\n\u00a7l \u00a7f--------- << \u00a7cSurvival \u00a7eMultiplayer \u00a7f>> ---------'';
};
};
fantasy-testing = {
enable = true;
package = pkgs.fabricServers.fabric-1_20_1;
symlinks = {
"mods" = "${fantasy-modpack}/mods";
"config/additional-additions-config.json" = "${fantasy-modpack}/config/additional-additions-config.json";
"config/configurabledespawntimer.json5" = "${fantasy-modpack}/config/configurabledespawntimer.json5";
"config/fwaystones/config.json5" = "${fantasy-modpack}/config/fwaystones/config.json5";
"config/simplebackup.json5" = "${fantasy-modpack}/config/simplebackup.json5";
# Change the voice chat port, if it is the same as another server it will crash
"config/voicechat/voicechat-server.properties" = pkgs.writeText "voicechat-config" ''
port=24453
bind_address=
max_voice_distance=48.0
whisper_distance=24.0
codec=VOIP
mtu_size=1024
keep_alive=1000
enable_groups=true
voice_host=
allow_recording=true
spectator_interaction=false
spectator_player_possession=false
force_voice_chat=false
login_timeout=10000
broadcast_range=-1.0
allow_pings=true
use_natives=true
'';
};
jvmOpts = "-Xms4096M -Xmx4096M";
serverProperties = {
level-seed = "-5424614792051443123";
allow-flight = true;
spawn-protection = 0;
max-players = 4;
server-port = 20000;
difficulty = "normal";
gamemode = "creative";
motd = ''\u00a7f-------\u00a7d Fantasy\u00a7f ----------\u00a7r\n\u00a7f--\u00a7c Creative\u00a7f ---\u00a7b Multiplayer\u00a7f --'';
};
};
};
};
};
}
|