From 73a4fa77e521ca92cef122aa46d9098df6fb70fd Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Sun, 7 Jul 2024 00:24:42 +0530 Subject: [PATCH] layne: use common network config --- hosts/layne/network.nix | 62 +++++++++++++++------------------------ hosts/layne/wireguard.nix | 27 ----------------- 2 files changed, 24 insertions(+), 65 deletions(-) delete mode 100644 hosts/layne/wireguard.nix diff --git a/hosts/layne/network.nix b/hosts/layne/network.nix index 5b28e8f..2341ac1 100644 --- a/hosts/layne/network.nix +++ b/hosts/layne/network.nix @@ -1,45 +1,31 @@ -{ lib, ... }: { - imports = [ ./wireguard.nix ]; - networking = { - nameservers = [ - "2620:fe::fe#dns.quad9.net" - "9.9.9.9#dns.quad9.net" - "2620:fe::9#dns.quad9.net" - "149.112.112.112#dns.quad9.net" - ]; - useDHCP = lib.mkDefault false; - useNetworkd = true; - }; +{ config, ... }: { + imports = [ + ../shared/network.nix + ../shared/networkd.nix + ../shared/wireguard.nix + ]; - systemd.network = { - enable = true; - networks = { - "41-ether" = { - enable = true; - matchConfig = { - Type = "ether"; - }; - networkConfig = { - DHCP = "yes"; - }; - dhcpV4Config = { - UseDomains = true; - }; - ipv6AcceptRAConfig = { - UseDomains = true; - }; - linkConfig = { - RequiredForOnline = "yes"; - }; - }; + sops.secrets = { + "wireguard/layne/pk" = { + mode = "400"; + owner = config.users.users.root.name; + group = config.users.users.root.group; + }; + "wireguard/layne/psk" = { + mode = "400"; + owner = config.users.users.root.name; + group = config.users.users.root.group; }; }; - services.resolved = { + nodeconfig.wireguard = { enable = true; - dnssec = "true"; - dnsovertls = "true"; - domains = [ "~." ]; - fallbackDns = [ ]; + listen-port = 51834; + pk-file = config.sops.secrets."wireguard/layne/pk".path; + psk-file = config.sops.secrets."wireguard/layne/psk".path; + node-ips = [ + "10.10.10.14/24" + "fd7c:585c:c4ae::14/64" + ]; }; } diff --git a/hosts/layne/wireguard.nix b/hosts/layne/wireguard.nix deleted file mode 100644 index 1f8debf..0000000 --- a/hosts/layne/wireguard.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ config, ... }: { - imports = [ ../shared/wireguard.nix ]; - - sops.secrets = { - "wireguard/layne/pk" = { - mode = "400"; - owner = config.users.users.root.name; - group = config.users.users.root.group; - }; - "wireguard/layne/psk" = { - mode = "400"; - owner = config.users.users.root.name; - group = config.users.users.root.group; - }; - }; - - nodeconfig.wireguard = { - enable = true; - listen-port = 51834; - pk-file = config.sops.secrets."wireguard/layne/pk".path; - psk-file = config.sops.secrets."wireguard/layne/psk".path; - node-ips = [ - "10.10.10.14/24" - "fd7c:585c:c4ae::14/64" - ]; - }; -}