summaryrefslogtreecommitdiff
path: root/config/minecraft.nix
blob: 9aa7720d7e579f4521422e36e415d043e1153c6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{ config, lib, pkgs, ... }:
let
  minecraft-port = 25565;
  allowedAddresses = [ "108.30.16.212" "24.193.7.0/24" ];
in {
  networking.firewall.extraCommands = lib.concatMapStrings (addr: ''
    iptables -A nixos-fw -p tcp \
      --dport ${toString minecraft-port} \
      -s ${addr} \
      -j nixos-fw-accept
  '') allowedAddresses;
  services.minecraft-server = {
    eula = true;
    enable = true;
    dataDir = "/storage/srv/minecraft/annie";
  };
}