summaryrefslogtreecommitdiff
path: root/services/minecraft/p2.nix
blob: 4b85ddc81f46098a3a9374c046c8f2d6ecb7e301 (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
40
41
42
43
44
45
46
47
48
{ auxiliaryPkgs, ... }:

let
  inherit (auxiliaryPkgs) common;

  # next to vanilla! a srv dns record handles the routing
  # from `p2.mc.rnrd.eu` to here.
  p2Port = 25566;
  p2Directory = "/srv/mc-p2";
  p2Memory = "8G";

  p2Image = common.pullImage {
    name = "itzg/minecraft-server";
    tag = "2026.9.0-java17"; # fabric, 1.20.1, java 17
    digest = "sha256:40f4721c1e6020164e5b7eed81c844734ca4ae8339f6546869edc48be82f82dc";
    x86.sha256 = "sha256-M8sHIOegqJsMYvk2Lnc6Zwkj9NO30hgf67OscjpW7KE=";
  };

in
{
  networking.firewall.allowedTCPPorts = [ p2Port ];

  foundation.services.minecraft-p2 = {
    fullImage = p2Image;

    ports = [ (common.globalPort [ p2Port 25565 ]) ];

    volumes = [ [ "${p2Directory}" "/data" ] ];

    environment = {
      EULA = "TRUE";

      # curseforge only, modrinth is not supported due to upstream issue!
      # see: https://github.com/nvb-uy/ProminenceII-HasturianEra/issues/559
      TYPE = "AUTO_CURSEFORGE";
      CF_SLUG = "prominence-2-hasturian-era";
      CF_FILENAME_MATCHER = "4.0.4";

      MEMORY = p2Memory;

      OVERRIDE_SERVER_PROPERTIES = "false"; # configs are managed by hand

      UID = "0";
      GID = "0";
      UMASK = "0022";
    };
  };
}