aboutsummaryrefslogtreecommitdiff
path: root/modules/nixos/services/minecraft/default.nix
blob: 7705c1c5168be89df07fd6e8ab3a505eb872c7b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{ options, config, lib, namespace, inputs, ... }:

with lib; with lib.${namespace}; let
  cfg = config.${namespace}.services.minecraft;
  impermanence = config.${namespace}.system.impermanence;
in {
  options.${namespace}.services.minecraft = with types; {
    enable = mkEnableOption "minecraft server support";
  };

  config = mkIf cfg.enable {
    nixpkgs = {
      overlays = [ inputs.nix-minecraft.overlay ];
      config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
        "minecraft-server"
      ];
    };

    services.minecraft-servers = {
      enable = true;
      eula = true;
      openFirewall = true;
    };
  };
}