Compare commits
	
		
			No commits in common. "c8348b49d81e874148d5d89cc10d0e5edb381f5e" and "1d3d84f871e0ab498f401f189aaa3c4fc246012a" have entirely different histories.
		
	
	
		
			c8348b49d8
			...
			1d3d84f871
		
	
		
@ -1,23 +1,6 @@
 | 
				
			|||||||
{ config, lib, pkgs, ... }:
 | 
					{ config, lib, pkgs, ... }:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  # Assign a static IP
 | 
					 | 
				
			||||||
  networking = {
 | 
					 | 
				
			||||||
    interfaces.eth0 = {
 | 
					 | 
				
			||||||
      useDHCP = false;
 | 
					 | 
				
			||||||
      addresses = {
 | 
					 | 
				
			||||||
        address = "10.0.1.3";
 | 
					 | 
				
			||||||
        prefixLength = 24;
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    defaultGateway = {
 | 
					 | 
				
			||||||
      address = "10.0.1.1";
 | 
					 | 
				
			||||||
      interface = "eth0";
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    nameservers = [ "1.1.1.1" "8.8.8.8" ];
 | 
					 | 
				
			||||||
    enableIPv6 = false;
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  # Enable zeroconf
 | 
					  # Enable zeroconf
 | 
				
			||||||
  services.avahi = {
 | 
					  services.avahi = {
 | 
				
			||||||
    enable = true;
 | 
					    enable = true;
 | 
				
			||||||
@ -33,42 +16,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  # Firewall configuration
 | 
					  # Firewall configuration
 | 
				
			||||||
  networking.firewall = {
 | 
					  networking.firewall = {
 | 
				
			||||||
    allowedTCPPorts = [
 | 
					    # Samba
 | 
				
			||||||
      445 # Samba
 | 
					    allowedTCPPorts = [ 445 139 ];
 | 
				
			||||||
      139 # Samba
 | 
					    allowedUDPPorts = [ 137 138 ];
 | 
				
			||||||
    ];
 | 
					 | 
				
			||||||
    allowedUDPPorts = [
 | 
					 | 
				
			||||||
      137 # Samba
 | 
					 | 
				
			||||||
      138 # Samba
 | 
					 | 
				
			||||||
      1194 # Wireguard
 | 
					 | 
				
			||||||
    ];
 | 
					 | 
				
			||||||
    extraCommands = ''
 | 
					 | 
				
			||||||
      iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
 | 
					 | 
				
			||||||
    '';
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  # Enable NAT for wireguard
 | 
					 | 
				
			||||||
  networking.nat = {
 | 
					 | 
				
			||||||
    enable = true;
 | 
					 | 
				
			||||||
    externalInterface = "eth0";
 | 
					 | 
				
			||||||
    internalInterfaces = [ "wg0" ];
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  # Wireguard setup
 | 
					 | 
				
			||||||
  networking.wireguard.interfaces = {
 | 
					 | 
				
			||||||
    wg0 = {
 | 
					 | 
				
			||||||
      ips = [ "10.8.0.1/24" ];
 | 
					 | 
				
			||||||
      listenPort = 1194;
 | 
					 | 
				
			||||||
      privateKeyFile = "/home/coace/.wg/keys/privatekey";
 | 
					 | 
				
			||||||
      peers = [
 | 
					 | 
				
			||||||
        # Fernando
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          # Placeholder public key
 | 
					 | 
				
			||||||
          publicKey = "XMkTztU2Y8hw6Fu/2o4Gszij+EmNacvFMXuZyHS1n38=";
 | 
					 | 
				
			||||||
          allowedIPs = [ "10.8.0.2/32" ];
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      ];
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Disable IPv6
 | 
				
			||||||
 | 
					  networking.enableIPv6 = false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user