anchor.diff:    # /var/lib/misc is for dnsmasq.leases.
     stateDirs = "/var/lib/NetworkManager /var/lib/dhclient /var/lib/misc";
   
  -  dns =
  -    if cfg.useDnsmasq then "dnsmasq"
  -    else if config.services.resolved.enable then "systemd-resolved"
  -    else if config.services.unbound.enable then "unbound"
  -    else "default";
  +  useDnsmasq = cfg.dns == "dnsmasq";
  +  useResolved = cfg.dns == "systemd-resolved";
  +
  +  rcman = if useResolved then "unmanaged" else "resolvconf";
   
     configFile = writeText "NetworkManager.conf" ''
       [main]
       plugins=keyfile
       dhcp=${cfg.dhcp}
  -    dns=${dns}
  +    dns=${cfg.dns}
  +    rc-manager=${rcman}
   
       [keyfile]
       ${optionalString (cfg.unmanaged != [])
  
positive.code: 
        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 {
  
negative.code:         apply = list: (attrValues cfg.basePackages) ++ list;
        };
  
        dns = mkOption {
          type = types.enum [ "default" "dnsmasq" "systemd-resolved" ];
          default = "default";
          description = ''
            Enable NetworkManager's integration with other DNS resolvers. NetworkManager can run
            dnsmasq as a local caching nameserver or systemd-resolved, using a "split DNS"
            configuration if you are connected to a VPN, and then update
            resolv.conf to point to the local nameserver.
          '';
        };
  
        dhcp = mkOption {
          type = types.enum [ "dhclient" "dhcpcd" "internal" ];
          default = "dhclient";
  