cleverca22
6/10/2016 - 1:25 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.example.ca";
      };
      users.extraUsers.mc1 = {
        isNormalUser = true;
        uid = 1020;
      };
      services = {
        openssh = {
          enable = true;
          permitRootLogin = "yes";
        };
      };
    };
  };
}