{ config, lib, minecraft, ... }:
{
  imports = [
    ./common
    ./servers
    minecraft.nixosModules.minecraft-servers
  ];

  config = lib.mkIf config.services.minecraft-servers.enable {
    nixpkgs = {
      overlays = [ minecraft.overlay ];
      allowUnfreePackages = [ "minecraft-server" ];
    };

    services.minecraft-servers.eula = true;

    environment.persistence."/persist".directories = [ "/srv/minecraft" ];
  };
}
