diff options
| author | Devin Finlinson <devin.finlinson@pm.me> | 2025-06-26 14:45:23 -0600 |
|---|---|---|
| committer | Devin Finlinson <devin.finlinson@pm.me> | 2025-06-26 14:45:23 -0600 |
| commit | f1ccbea121e20505990c283531125c91cd052697 (patch) | |
| tree | 37fa9bcaa07c96c89f5ce2cccb30b0a1fa755f4f /modules | |
| parent | 74a1f3bc5570470635ff1337de5dae08e1ae24c8 (diff) | |
minecraft modded server time
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/nixos/minecraft-server.nix | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/modules/nixos/minecraft-server.nix b/modules/nixos/minecraft-server.nix new file mode 100644 index 0000000..8b83f34 --- /dev/null +++ b/modules/nixos/minecraft-server.nix @@ -0,0 +1,44 @@ +{ pkgs, config, inputs, ... } : +let + # 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; + jre17 = pkgs.temurin-bin-17; + + defaults = { + # 5 minutes tick timeout, for heavy packs + max-tick-time = 5 * 60 * 1000; + # It just ain't modded minecraft without flying around + allow-flight = true; + }; +in { + # minecraft server is closed source + nixpkgs.config.allowUnfree = true; + + imports = [ inputs.mms.module ]; + services.modded-minecraft-servers = { + # This is mandatory for legal reasons. + eula = true; + + # 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 = { + enable = true; + inherit rsyncSSHKeys; + jvmMaxAllocation = "8G"; + jvmInitialAllocation = "2G"; + jvmPackage = jre17; + + # I believe these options match services.minecraft-server.serverProperties options + serverConfig = defaults // { + # Port must be unique + server-port = 25565; + rcon-port = 25566; + gamemode = "survival"; + motd = "Welcome to DeceasedCraft"; + max-players = 10; + }; + }; + }; +} |
