summaryrefslogtreecommitdiff
path: root/modules/nixfiles/games/minecraft.nix
blob: 4825a7b49eb43b6796244c18cdfff15927a35c88 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
  config,
  lib,
  pkgs,
  pkgsPR,
  ...
}:
with lib; let
  cfg = config.nixfiles.modules.games.minecraft;
in {
  options.nixfiles.modules.games.minecraft = {
    client.enable = mkEnableOption "Minecraft client";
    server.enable = mkEnableOption "Minecraft server";
  };

  # Configurations, opslist, whitelist and plugins are managed imperatively.
  config = mkMerge [
    (mkIf cfg.client.enable {
      hm.home.packages = with pkgs; [
        UltimMC
        jre
      ];
    })
    (mkIf cfg.server.enable {
      services.minecraft-server = {
        enable = true;
        eula = true;

        # TODO After the PR is merged, I need to somehow pin this.
        package = (pkgsPR "187458" "sha256-kOYkuXvcmqt8Lsh0yMr8reurzU1qTrzh0Z/Tjan0IF0=").papermc;

        # TODO Make PR fixing trailing whitespace on this.
        jvmOpts = mkDefault "-Xmx4096M -Xms4096M ";

        openFirewall = true;
      };
    })
  ];
}