nix-infra/common/fragments/minecraft.nix

79 lines
2.0 KiB
Nix
Raw Normal View History

2023-03-07 19:25:16 +00:00
{ pkgs, config, lib, ... }:
let
rsyncSSHKeys = config.users.users.agatha.openssh.authorizedKeys.keys
++ config.users.users.julia.openssh.authorizedKeys.keys;
jre8 = pkgs.temurin-bin-8;
jre17 = pkgs.temurin-bin-17;
jvmOpts = lib.concatStringsSep " " [
"-XX:+UseG1GC"
"-XX:+ParallelRefProcEnabled"
"-XX:MaxGCPauseMillis=200"
"-XX:+UnlockExperimentalVMOptions"
"-XX:+DisableExplicitGC"
"-XX:+AlwaysPreTouch"
"-XX:G1NewSizePercent=40"
"-XX:G1MaxNewSizePercent=50"
"-XX:G1HeapRegionSize=16M"
"-XX:G1ReservePercent=15"
"-XX:G1HeapWastePercent=5"
"-XX:G1MixedGCCountTarget=4"
"-XX:InitiatingHeapOccupancyPercent=20"
"-XX:G1MixedGCLiveThresholdPercent=90"
"-XX:G1RSetUpdatingPauseTimePercent=5"
"-XX:SurvivorRatio=32"
"-XX:+PerfDisableSharedMem"
"-XX:MaxTenuringThreshold=1"
];
serverDefaults = {
white-list = true;
spawn-protection = 0;
allow-flight = true;
2023-03-10 22:23:43 +00:00
max-tick-time = 2 * 60 * 1000;
2023-03-07 19:25:16 +00:00
};
in {
services.modded-minecraft-servers = {
eula = true;
instances = {
# End to End encrypted modded minecraft yay
e2e = {
2023-05-01 09:00:19 +00:00
enable = false;
2023-03-07 19:25:16 +00:00
inherit rsyncSSHKeys jvmOpts;
2023-05-01 09:00:19 +00:00
jvmInitialAllocation = "1G";
2023-03-07 19:25:16 +00:00
jvmMaxAllocation = "8G";
jvmPackage = jre8;
serverConfig = serverDefaults // {
server-port = 25565;
rcon-port = 25566;
motd = "Enigmeowtica 2: Expert";
extra-options.level-type = "BIOMESOP";
};
};
2023-05-01 09:00:19 +00:00
enigmatica-8 = {
2023-09-17 16:57:46 +00:00
enable = false;
2023-05-01 09:00:19 +00:00
inherit rsyncSSHKeys jvmOpts;
jvmInitialAllocation = "1G";
jvmMaxAllocation = "8G";
jvmPackage = jre17;
serverConfig = serverDefaults // {
server-port = 25567;
rcon-port = 25568;
motd = "Enigmeowtica 8";
max-tick-time = 300000;
};
};
2023-03-07 19:25:16 +00:00
};
};
systemd.services.mc-e2e.path = with pkgs; [ getconf gawk ];
users.users.agatha.packages = with pkgs; [ mcrcon ];
}