anchor.diff:        group = "networkmanager";
       }];
   
  +    services.resolved = lib.mkIf useResolved {
  +      enable = true;
  +    };
  +
       systemd.packages = cfg.packages;
   
       systemd.services."network-manager" = {
         wantedBy = [ "network.target" ];
  +      wants = lib.mkIf useResolved [ "systemd-resolved.service" ];
         restartTriggers = [ configFile ];
   
         preStart = ''
  
positive.code:   # /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";
  
    configFile = writeText "NetworkManager.conf" ''
      [main]
      plugins=keyfile
      dhcp=${cfg.dhcp}
      dns=${dns}
  
      [keyfile]
      ${optionalString (cfg.unmanaged != [])
  
negative.code:         description = ''
            A list of scripts which will be executed in response to  network  events.
          '';
        };
  
        extraConfig = mkOption {
          type = types.lines;
          default = "";
          description = "Additional configuration added verbatim to the configuration file.";
        };
      };
    };
  