diff --git a/configuration.nix b/configuration.nix index 4adbba8..3837047 100644 --- a/configuration.nix +++ b/configuration.nix @@ -34,9 +34,6 @@ # Cleanup tmp on startup boot.cleanTmpDir = true; - # Set hostname - networking.hostName = "zion"; - # Create coolneng user users.users.coolneng = { isNormalUser = true; @@ -56,7 +53,6 @@ services.timesyncd.enable = true; # Enable ZFS support - networking.hostId = "4e74ea68"; boot.supportedFilesystems = [ "zfs" ]; # Don't import encrypted datasets diff --git a/modules/networking.nix b/modules/networking.nix index ac37a47..e579d3b 100644 --- a/modules/networking.nix +++ b/modules/networking.nix @@ -1,6 +1,25 @@ { config, pkgs, lib, ... }: { + # Assign a static IP + networking = { + hostName = "zion"; + hostId = "4e74ea68"; + interfaces.eth0 = { + useDHCP = false; + ipv4.addresses = [{ + address = "192.168.1.2"; + prefixLength = 24; + }]; + }; + defaultGateway = { + address = "192.168.1.1"; + interface = "eth0"; + }; + nameservers = [ "195.10.195.195" "165.22.224.164" ]; + enableIPv6 = false; + }; + # Enable zeroconf services.avahi = { enable = true; @@ -40,12 +59,6 @@ ''; }; - # Disable IPv6 - networking.enableIPv6 = false; - - # Disable WiFi - networking.interfaces."eth0".useDHCP = true; - # Enable NAT for wireguard networking.nat = { enable = true; @@ -77,13 +90,13 @@ # DNS server with ad-block services.dnsmasq = { enable = true; - servers = [ "195.10.195.195" "165.22.224.164" ]; + servers = config.networking.nameservers; extraConfig = '' domain-needed bogus-priv no-resolv - listen-address=127.0.0.1,192.168.13.2,10.8.0.1 + listen-address=127.0.0.1,192.168.1.2,10.8.0.1 bind-interfaces cache-size=10000 @@ -91,7 +104,7 @@ conf-file=/var/lib/dnsmasq/dnsmasq.blacklist.txt - address=/coolneng.duckdns.org/192.168.13.2 + address=/coolneng.duckdns.org/192.168.1.2 ''; };