aboutsummaryrefslogtreecommitdiff
path: root/modules/services/nixos/minecraft.nix
blob: 0209549edca7f412f34020b89af414bf119f62a7 (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
{
  lib,
  config,
  ...
}: let
  cfg = config.collinux.services.minecraft;
in
  lib.mkIf cfg.enable {
    networking.firewall.allowedUDPPorts = [cfg.port];

    virtualisation.oci-containers.containers."Minecraft" = {
      environment = {
        EULA = "TRUE";
        EMIT_SERVER_TELEMETRY = "true";

        SERVER_NAME = "YServer";
        TZ = config.time.timeZone;
        VERSION = "1.26.31.1";
        CONTENT_LOG_FILE_ENABLED = "false";

        ALLOW_CHEATS = "false";
        DIFFICULTY = "1";
      };
      image = "itzg/minecraft-bedrock-server";
      ports = [
        "0.0.0.0:${toString cfg.port}:19132/udp"
      ];
      volumes = ["/var/lib/minecraft/:/data"];

      extraOptions = ["--no-healthcheck"];
    };
  }