7b7c83e449
Change-Id: I3393c16db76fba839ea72612f54e6a2a72d0b69d Reviewed-on: https://cl.tvl.fyi/c/depot/+/8329 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: sterni <sternenseemann@systemli.org>
118 lines
2.9 KiB
Nix
118 lines
2.9 KiB
Nix
{ pkgs, depot, config, ... }:
|
|
|
|
let
|
|
carpet = pkgs.fetchurl {
|
|
url = "https://github.com/gnembon/fabric-carpet/releases/download/1.4.40/fabric-carpet-1.17-1.4.40+v210608.jar";
|
|
sha256 = "0gv8nmishgml034ncvwldiz3q607sg8xcj6k0c3lfns23cyg80dv";
|
|
};
|
|
|
|
carpet-extra = pkgs.fetchurl {
|
|
url = "https://github.com/gnembon/carpet-extra/releases/download/1.4.40/carpet-extra-1.17-1.4.40.jar";
|
|
sha256 = "16bj57scbgfrbljr5nci2s438hip6zrg92wfzz9il4mw6cdgbymc";
|
|
};
|
|
|
|
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;
|
|
view-distance = 12;
|
|
sync-chunk-writes = "false"; # the single biggest performance fix
|
|
max-tick-time = 6000000; # TODO(sterni): disable watchdog via carpet
|
|
};
|
|
in
|
|
|
|
{
|
|
imports = [
|
|
../../modules/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.minecraft-fabric-server = {
|
|
creative = {
|
|
enable = true;
|
|
version = "1.17";
|
|
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.17";
|
|
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
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|