From 9827d5f95cc71cf47eeaec1d1ddf08633e8490cb Mon Sep 17 00:00:00 2001 From: Benjamin Staffin Date: Sun, 30 Apr 2017 00:42:11 -0700 Subject: [PATCH] nixos: optional NetworkManager dnsmasq integration --- nixos/modules/services/networking/networkmanager.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nixos/modules/services/networking/networkmanager.nix b/nixos/modules/services/networking/networkmanager.nix index 220107a24118..0c12b2c1dfd4 100644 --- a/nixos/modules/services/networking/networkmanager.nix +++ b/nixos/modules/services/networking/networkmanager.nix @@ -12,6 +12,7 @@ let configFile = writeText "NetworkManager.conf" '' [main] plugins=keyfile + dns=${if cfg.useDnsmasq then "dnsmasq" else "default"} [keyfile] ${optionalString (config.networking.hostName != "") @@ -158,6 +159,17 @@ in { ethernet.macAddress = macAddressOpt; wifi.macAddress = macAddressOpt; + useDnsmasq = mkOption { + type = types.bool; + default = false; + description = '' + Enable NetworkManager's dnsmasq integration. NetworkManager will run + dnsmasq as a local caching nameserver, using a "split DNS" + configuration if you are connected to a VPN, and then update + resolv.conf to point to the local nameserver. + ''; + }; + dispatcherScripts = mkOption { type = types.listOf (types.submodule { options = {