anchor.diff:  
     config = mkIf cfg.enable {
   
  -    assertions = [{
  -      assertion = config.networking.wireless.enable == false;
  -      message = "You can not use networking.networkmanager with networking.wireless";
  -    }];
  +    assertions = [
  +      { assertion = config.networking.wireless.enable == false;
  +        message = "You can not use networking.networkmanager with networking.wireless";
  +      }
  +      { assertion = !dynamicHostsEnabled || (dynamicHostsEnabled && cfg.dns == "dnsmasq");
  +        message = ''
  +          To use networking.networkmanager.dynamicHosts you also need to set
  +          networking.networkmanager.dns = "dnsmasq"
  +        '';
  +      }
  +    ];
   
       environment.etc = with cfg.basePackages; [
         { source = configFile;
  
positive.code:           so you don't need to to that yourself.
          '';
        };
      };
    };
  
  
negative.code: 
  let
    cfg = config.networking.networkmanager;
  
    dynamicHostsEnabled =
      cfg.dynamicHosts.enable && cfg.dynamicHosts.hostsDirs != {};
  
    # /var/lib/misc is for dnsmasq.leases.
    stateDirs = "/var/lib/NetworkManager /var/lib/dhclient /var/lib/misc";
  