feat(pikachu): add Fabric Minecraft guest
This commit is contained in:
1 parent
7952afc5c5
commit
625da29b55
6 files changed
+160
-4
No files matched your search
@@ -0,0 +1,48 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.guests.minecraft;
|
||||
minecraftUid = config.registry."stable-uid".${config.networking.hostName}.minecraft;
|
||||
in
|
||||
{
|
||||
options.guests.minecraft.statePath = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
example = "/srv/minecraft/main";
|
||||
description = "Host path bind-mounted as Minecraft's durable server state.";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.statePath != null;
|
||||
message = "guests.minecraft.statePath must point at the host directory that stores Minecraft state.";
|
||||
}
|
||||
];
|
||||
|
||||
registry."stable-uid".${config.networking.hostName}.minecraft = 20008;
|
||||
|
||||
guests.minecraft = {
|
||||
interior = {
|
||||
modules.services.games.minecraft.enable = true;
|
||||
users.users.minecraft.uid = minecraftUid;
|
||||
};
|
||||
|
||||
mounts."/data" = {
|
||||
directory = cfg.statePath;
|
||||
owner = minecraftUid;
|
||||
group = "storage";
|
||||
mode = "0770";
|
||||
};
|
||||
|
||||
limits = {
|
||||
memory = lib.mkDefault "5G";
|
||||
cpu = lib.mkDefault "400%";
|
||||
tasksMax = lib.mkDefault 1024;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -58,6 +58,12 @@
|
||||
};
|
||||
};
|
||||
|
||||
guests.minecraft = {
|
||||
enable = true;
|
||||
vlan = 20;
|
||||
statePath = "/pikachu/media/games/servers/minecraft/main";
|
||||
};
|
||||
|
||||
guests.palworld = {
|
||||
enable = true;
|
||||
vlan = 20;
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [ inputs.nix-minecraft.nixosModules.minecraft-servers ];
|
||||
|
||||
options.modules.services.games.minecraft.enable = lib.mkEnableOption "Fabric Minecraft server";
|
||||
|
||||
config = lib.mkIf config.modules.services.games.minecraft.enable {
|
||||
nixpkgs.overlays = [ inputs.nix-minecraft.overlays.default ];
|
||||
|
||||
services.minecraft-servers = {
|
||||
enable = true;
|
||||
eula = true;
|
||||
openFirewall = true;
|
||||
dataDir = "/data";
|
||||
|
||||
managementSystem = {
|
||||
tmux.enable = false;
|
||||
systemd-socket.enable = true;
|
||||
};
|
||||
|
||||
servers.main = {
|
||||
enable = true;
|
||||
package = pkgs.fabricServers.fabric-1_21_1;
|
||||
jvmOpts = [
|
||||
"-Xms1G"
|
||||
"-Xmx4G"
|
||||
];
|
||||
serverProperties = {
|
||||
"enable-rcon" = false;
|
||||
"online-mode" = true;
|
||||
"white-list" = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -12,7 +12,7 @@ let
|
||||
|
||||
in
|
||||
{
|
||||
# Next stable UID: 20007
|
||||
# Next stable UID: 20009
|
||||
|
||||
type = lib.types.ints.positive;
|
||||
|
||||
|
||||
Reference in new issue
Block a user