cleverca22
6/28/2016 - 7:34 AM

gistfile1.txt

{ ... }:

{
  networking = {
    nat = {
      enable = true;
      externalInterface = "enp3s0";
      externalIP = "192.168.2.11";
      forwardPorts = [
        { sourcePort = 25565; destination = "192.168.3.3"; }
      ];
      internalIPs = [ "192.168.3.3/32" ];
    };
  };
  containers.mc1 = {
    autoStart = true;
    privateNetwork = true;
    hostAddress = "192.168.3.2";
    localAddress = "192.168.3.3";
    config = { config, pkgs, ... }: {
      environment.systemPackages = with pkgs; [
        jdk8 screen
      ];
      networking = {
        firewall.allowedTCPPorts = [ 25565 ];
        hostName = "mc1.earthtools.ca";
      };
      users.extraUsers.mc1 = {
        isNormalUser = true;
        uid = 1020;
      };
      services = {
        openssh = {
          enable = true;
          permitRootLogin = "yes";
        };
      };
    };
  };
}