From b609d1e774adcb69e3fd0a087418d9b5ac278768 Mon Sep 17 00:00:00 2001 From: bogale Date: Mon, 2 Nov 2026 00:02:57 +0900 Subject: [PATCH] dns through nm --- common.nix | 10 ++++++++- desktop/mods/pxeboot.nix | 27 +++++++++++++--------- mods/host.nix | 48 +++++++++++++--------------------------- 3 files changed, 40 insertions(+), 45 deletions(-) diff --git a/common.nix b/common.nix index 359fd4d..b815a29 100644 --- a/common.nix +++ b/common.nix @@ -34,7 +34,15 @@ ]; i18n.defaultLocale = "ru_RU.UTF-8"; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - networking.networkmanager.enable = true; + networking.networkmanager = { + enable = true; + insertNameservers = [ + "1.0.0.2" + "1.1.1.2" + "2606:4700:4700::1002" + "2606:4700:4700::1112" + ]; + }; nix.settings.experimental-features = [ "flakes" "nix-command" diff --git a/desktop/mods/pxeboot.nix b/desktop/mods/pxeboot.nix index e8decdd..87e88b4 100644 --- a/desktop/mods/pxeboot.nix +++ b/desktop/mods/pxeboot.nix @@ -43,17 +43,22 @@ }; }; services = { - dnsmasq.settings = { - bind-dynamic = true; - dhcp-boot = "efi/boot/BOOTX64.EFI"; - dhcp-range = [ - "10.2.0.2,10.2.255.254,12h" - "fc02::2,fc02::ffff:ffff:ffff:ffff,12h" - ]; - enable-ra = true; - enable-tftp = true; - interface = "br0"; - tftp-root = "/srv/pxe/nixos/boot"; + dnsmasq = { + enable = true; + settings = { + bind-dynamic = true; + bogus-priv = true; + dhcp-boot = "efi/boot/BOOTX64.EFI"; + dhcp-range = [ + "10.2.0.2,10.2.255.254,12h" + "fc02::2,fc02::ffff:ffff:ffff:ffff,12h" + ]; + domain-needed = true; + enable-ra = true; + enable-tftp = true; + interface = "br0"; + tftp-root = "/srv/pxe/nixos/boot"; + }; }; nfs.server = { enable = true; diff --git a/mods/host.nix b/mods/host.nix index d392c4e..2387d86 100644 --- a/mods/host.nix +++ b/mods/host.nix @@ -16,46 +16,28 @@ ./vps-init.nix ]; networking = { - networkmanager = { - dns = "dnsmasq"; - ensureProfiles = { - environmentFiles = [ config.sops.secrets.wifi-env.path ]; - profiles = { - dhcp-ethernet.connection = { - id = "dhcp-ethernet"; - type = "ethernet"; + networkmanager.ensureProfiles = { + environmentFiles = [ config.sops.secrets.wifi-env.path ]; + profiles = { + dhcp-ethernet.connection = { + id = "dhcp-ethernet"; + type = "ethernet"; + }; + home-wifi = { + connection = { + id = "home-wifi"; + type = "wifi"; }; - home-wifi = { - connection = { - id = "home-wifi"; - type = "wifi"; - }; - wifi-security = { - key-mgmt = "sae"; - psk = "$BOGALE_PSK"; - }; - wifi.ssid = "bogale"; + wifi-security = { + key-mgmt = "sae"; + psk = "$BOGALE_PSK"; }; + wifi.ssid = "bogale"; }; }; }; wg-quick.interfaces.awg0.type = "amneziawg"; }; - services.dnsmasq = { - enable = true; - settings = { - bogus-priv = true; - cache-size = 4096; - domain-needed = true; - no-resolv = true; - server = [ - "1.0.0.2" - "1.1.1.2" - "2606:4700:4700::1002" - "2606:4700:4700::1112" - ]; - }; - }; sops = { age.keyFile = "/var/lib/sops-nix/key.txt"; defaultSopsFile = ../.secrets.yaml;