mod: exposed some more options

This commit is contained in:
wymiller committed 2026-10-31 09:31:25 -04:00
1 parent 3ba8f51b16
commit b146700a70
3 files changed
+57 -5

No files matched your search

+36 -3
View File
@@ -56,18 +56,51 @@ recreated on each start and removed on stop by nix-minecraft. Edits to those
copies do not persist across restarts. World data is not part of those managed copies do not persist across restarts. World data is not part of those managed
directories. directories.
Change the Minecraft port in `modules/machine/krile/configuration.nix`:
```nix
services.homestead.port = 25566;
```
The default is TCP 25565. When `services.homestead.openFirewall = true`, the
opened TCP port follows this setting. Update your router's port forwarding and
connect with `krile:25566` (or your server's address). Voice chat remains on
UDP 24454, matching the pack's `config/voicechat/voicechat-server.properties`.
Rebuild krile to apply the change.
Change memory in the host configuration: Change memory in the host configuration:
```nix ```nix
services.homestead.jvmOpts = "-Xms6G -Xmx12G -XX:+UseG1GC"; services.homestead.jvmOpts = "-Xms6G -Xmx12G -XX:+UseG1GC";
``` ```
Declare operators in the host configuration:
```nix
services.homestead.operators = {
"YourMinecraftName" = {
uuid = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
level = 4;
bypassesPlayerLimit = false;
};
};
```
Replace the example name and UUID with the player's actual Minecraft account
details. A UUID string also works as a shorthand:
`services.homestead.operators."YourMinecraftName" = "your-player-uuid";`.
It defaults to permission level 4 and does not bypass the player limit.
After rebuilding krile, nix-minecraft generates
`/srv/minecraft/homestead/ops.json` when the server starts. A nonempty operator
list replaces the file on each start, so changes made with `/op` or `/deop` do
not persist across restarts. The default `{ }` leaves `ops.json` unmanaged.
Other server settings use the underlying nix-minecraft options: Other server settings use the underlying nix-minecraft options:
```nix ```nix
services.minecraft-servers.servers.homestead = { services.minecraft-servers.servers.homestead = {
serverProperties = { serverProperties = {
server-port = 25566;
max-players = 10; max-players = 10;
white-list = true; white-list = true;
}; };
@@ -76,8 +109,8 @@ services.minecraft-servers.servers.homestead = {
}; };
``` ```
Changing `server-port` also changes the opened TCP port. Voice chat remains on The underlying `serverProperties.server-port` setting can still override
UDP 24454, matching the pack's `config/voicechat/voicechat-server.properties`. `services.homestead.port`; the opened TCP port follows the effective value.
To use this module on another NixOS host, pass `nur` in `specialArgs`, import To use this module on another NixOS host, pass `nur` in `specialArgs`, import
`modules/games/homestead`, set `services.homestead.enable = true`, and set `modules/games/homestead`, set `services.homestead.enable = true`, and set
+19 -2
View File
@@ -2,6 +2,7 @@
config, config,
lib, lib,
nur, nur,
options,
pkgs, pkgs,
... ...
}: }:
@@ -15,12 +16,28 @@ in
options.services.homestead = { options.services.homestead = {
enable = lib.mkEnableOption "the Homestead 2.0 Minecraft server"; enable = lib.mkEnableOption "the Homestead 2.0 Minecraft server";
port = lib.mkOption {
type = lib.types.port;
default = 25565;
description = "TCP port for the Homestead Minecraft server.";
};
openFirewall = lib.mkOption { openFirewall = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = false; default = false;
description = "Open the Minecraft TCP port and Simple Voice Chat UDP port (24454)."; description = "Open the Minecraft TCP port and Simple Voice Chat UDP port (24454).";
}; };
operators = lib.mkOption {
type = (options.services.minecraft-servers.servers.type.getSubOptions [ ]).operators.type;
default = { };
description = ''
Server operators keyed by Minecraft username. Values may be UUID strings
or attribute sets with uuid, level, and bypassesPlayerLimit. A nonempty
value manages ops.json declaratively; an empty value leaves it unmanaged.
'';
};
jvmOpts = lib.mkOption { jvmOpts = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "-Xms6G -Xmx10G -XX:+UseG1GC"; default = "-Xms6G -Xmx10G -XX:+UseG1GC";
@@ -35,7 +52,7 @@ in
enable = true; enable = true;
servers.homestead = { servers.homestead = {
enable = true; enable = true;
inherit (cfg) openFirewall jvmOpts; inherit (cfg) openFirewall operators jvmOpts;
package = pkgs.fabricServers.fabric-1_20_1.override { package = pkgs.fabricServers.fabric-1_20_1.override {
loaderVersion = "0.19.5"; loaderVersion = "0.19.5";
@@ -54,7 +71,7 @@ in
max-tick-time = 180000; max-tick-time = 180000;
simulation-distance = 6; simulation-distance = 6;
view-distance = 10; view-distance = 10;
server-port = 25565; server-port = cfg.port;
online-mode = true; online-mode = true;
# keep-inventory = true; # keep-inventory = true;
}; };
+2
View File
@@ -80,7 +80,9 @@
services.homestead = { services.homestead = {
enable = true; enable = true;
port = 25565;
openFirewall = true; openFirewall = true;
operators = { };
}; };
services.minecraft-servers.eula = true; services.minecraft-servers.eula = true;