{
  config,
  lib,
  namespace,
  ...
}:
let
  name = "minecraft";
  cfg = config.${namespace}.services.${name};

  mincraftConfig = lib.${namespace}.mkModule {
    inherit config name;
    description = "minecraft server";
    options = { };
    moduleConfig = {
      services.minecraft-server = {
        enable = true;
        eula = true;
        declarative = true;
        openFirewall = cfg.openFirewall;
        dataDir = "${cfg.configDir}/minecraft"; # todo
        serverProperties = {
          enforce-whitelist = true;
          white-list = true;
          "enable-rcon" = true;
          "rcon.password" = config.sops.secrets."jallen-nas/admin_password".path;
        };
        whitelist = {
          mjallen18 = "03d9fba9-4453-4ad1-afa6-c67738685189";
          AlpineScent = "76ff084d-2e66-4877-aec2-d6b278431bda";
          Fortltude = "61a01913-8b10-4d64-b7ce-7958088cd6d3";
          SpicyNick = "8bb5976f-6fd9-4fa5-8697-6ecb4ee38427";
        };
        jvmOpts = "-Xms4092M -Xmx4092M -XX:+UseG1GC -XX:ParallelGCThreads=2 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10";
      };
    };
  };
in
{
  imports = [ mincraftConfig ];
}
