blob: 0ca892d4c6169d739bea09924f678683072d69f9 (
plain) (
blame)
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
127
|
{ pkgs, depot, config, ... }:
let
carpet = pkgs.fetchurl {
url = "https://github.com/gnembon/fabric-carpet/releases/download/1.4.158/fabric-carpet-1.21.2-1.4.158+v241022.jar";
sha256 = "0c76r0gz7nyn91k86flvwpbbypw5v41iib7kkvbyjb84aaafb8ap";
};
carpet-extra = pkgs.fetchurl {
url = "https://github.com/gnembon/carpet-extra/releases/download/1.4.158/carpet-extra-1.21.2-1.4.158.jar";
sha256 = "083zifzpdgl7xxd989nm1svrrqxl4fmv7wxna10cyipg6jjabjq1";
};
userGroup = "minecraft";
makeJvmOpts = megs: [
"-Xms${toString megs}M"
"-Xmx${toString megs}M"
];
whitelist = {
spreadwasser = "242a66eb-2df2-4585-9a28-ac763ad0d0f9";
sternenseemann = "d8e48069-1905-4886-a5da-a4ee917ee254";
};
rconPasswordFile = config.age.secretsDir + "/minecraft-rcon";
baseProperties = {
white-list = true;
allow-flight = true;
difficulty = "hard";
function-permission-level = 4;
snooper-enabled = false;
# TODO(sterni): replaced (?) by simulation-distance which defaults to 1
view-distance = 12;
sync-chunk-writes = "false"; # the single biggest performance fix
max-tick-time = 6000000; # TODO(sterni): disable watchdog via carpet
enforce-secure-profile = false;
# TODO(sterni): set disable pause-when-empty-seconds? we don't have anything in spawn though.
};
in
{
imports = [
../../modules/minecraft-fabric.nix
../../modules/backup-minecraft-fabric.nix
];
config = {
environment.systemPackages = [
pkgs.mcrcon
pkgs.jre
];
users = {
users."${userGroup}" = {
isNormalUser = true;
openssh.authorizedKeys.keys = depot.users.sterni.keys.all;
shell = "${pkgs.fish}/bin/fish";
};
groups."${userGroup}" = { };
};
age.secrets = {
minecraft-rcon.file = depot.users.sterni.secrets."minecraft-rcon.age";
};
services.backup-minecraft-fabric-servers = {
enable = true;
repository = "/srv/backup/from-local/minecraft";
};
services.minecraft-fabric-server = {
creative = {
enable = false; # not actively used
version = "1.21.3";
mods = [
carpet
carpet-extra
];
world = config.users.users.${userGroup}.home + "/worlds/creative";
jvmOpts = makeJvmOpts 2048;
user = userGroup;
group = userGroup;
inherit whitelist rconPasswordFile;
ops = whitelist;
serverProperties = baseProperties // {
server-port = 25566;
"rcon.port" = 25576;
gamemode = "creative";
enable-command-block = true;
motd = "storage design server";
spawn-protection = 2;
};
};
carpet = {
enable = true;
version = "1.21.3";
mods = [
carpet
carpet-extra
];
world = config.users.users.${userGroup}.home + "/worlds/carpet";
jvmOpts = makeJvmOpts 4096;
user = userGroup;
group = userGroup;
inherit whitelist rconPasswordFile;
ops = whitelist;
serverProperties = baseProperties // {
server-port = 25565;
"rcon.port" = 25575;
motd = "ich tu fleissig hustlen nenn mich bob der baumeister";
level-seed = 7240251176989694927; # for posterity
};
};
};
};
}
|