{ 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; }; }; }; }