feat(pikachu): add Fabric Minecraft guest

This commit is contained in:
alexion committed 2026-11-02 08:24:56 -05:00
1 parent 7952afc5c5
commit 625da29b55
6 files changed
+160 -4

No files matched your search

+48
View File
@@ -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;
};
};
};
}