summaryrefslogtreecommitdiff
path: root/config/minecraft.nix
blob: 0708ade98048dad6f5a242df35ee40ed0621190d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{ config, lib, pkgs, ... }:
let
  minecraft-port = 25565;
  allowedAddresses = [ "108.30.16.212" ];
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";
  };
}