summaryrefslogtreecommitdiff
path: root/config/minecraft.nix
blob: 8e6ad0ca2712229673bc96ac8c8d6e211b1f348c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{ 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";
  };
}