aboutsummaryrefslogtreecommitdiff
path: root/modules/nixos/services/minecraft/beta/default.nix
blob: c38b1814998b5e01c507acbf957372031811e0dc (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
{ options, config, lib, pkgs, namespace, ... }:

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

    port = mkOption {
      type = types.port;
      default = 25565;
      description = "server port";
    };

    start = mkOption {
      type = types.bool;
      default = true;
      description = "autostart";
    };
  };

  config = mkIf cfg.enable {
    cxl.services.minecraft.enable = true;

    environment.persistence.${impermanence.location} = {
      directories = [
        "/srv/minecraft/beta"
      ];
    };

    services.minecraft-servers.servers.beta = {
      enable = true;
      openFirewall = true;
      autoStart = cfg.start;

      package = pkgs.cxl."minecraft-server-b1.7.3";
      jvmOpts = "-Dhttp.proxyHost=betacraft.uk -Dhttp.proxyPort=11705 -Xms1024M -Xmx2048M";

      serverProperties = {
        white-list = true;
        max-players = 69;
        server-port = cfg.port;
      };
    };
  };
}