diff options
Diffstat (limited to 'modules/nixos/minecraft-server.nix')
| -rw-r--r-- | modules/nixos/minecraft-server.nix | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/modules/nixos/minecraft-server.nix b/modules/nixos/minecraft-server.nix index 629c876..6ade951 100644 --- a/modules/nixos/minecraft-server.nix +++ b/modules/nixos/minecraft-server.nix @@ -1,5 +1,6 @@ -{ pkgs, config, inputs, ... } : +{ pkgs, lib, config, inputs, ... } : let + inherit (lib) concatStringsSep; # Keys that can access the state of each instance (read/write!) over an rsync module # Leave empty to disable rsyncSSHKeys = config.users.users.defin.openssh.authorizedKeys.keys; @@ -11,9 +12,32 @@ let # It just ain't modded minecraft without flying around allow-flight = true; }; + + jvmOpts = 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" + ]; + in { # minecraft server is closed source - nixpkgs.config.allowUnfree = true; + # nixpkgs.config.allowUnfree = true; imports = [ inputs.modded-minecraft-servers.module ]; services.modded-minecraft-servers = { @@ -23,11 +47,15 @@ in { # the name will be used for the state folder and system user. # in this case, the folder is '/var/lib/mc-deceasedcraft' # and the user is 'mc-deceasedcraft' - deceasedcraft = { + + instances.deceasedcraft = { enable = true; - inherit rsyncSSHKeys; - jvmMaxAllocation = "8G"; - jvmInitialAllocation = "2G"; + inherit rsyncSSHKeys jvmOpts; + # jvmOpts = jvmOpts + " " + (concatStringsSep " " [ + # "@libraries/net/minecraftforge/forge/1.18.2-40.2.4/unix_args.txt" + # ]); + jvmMaxAllocation = "1024m"; + jvmInitialAllocation = "512m"; jvmPackage = jre17; # I believe these options match services.minecraft-server.serverProperties options @@ -35,9 +63,11 @@ in { # Port must be unique server-port = 25565; rcon-port = 25566; - gamemode = "survival"; motd = "Welcome to DeceasedCraft"; max-players = 10; + allow-nether = false; + spawn-protection=12; + max-tick-time=600000; }; }; }; |
