anchor.diff:          '';
         };
   
  +      wifi = {
  +        backend = mkOption {
  +          type = types.enum [ "wpa_supplicant" "iwd" ];
  +          default = "wpa_supplicant";
  +          description = ''
  +            Specify the Wi-Fi backend used.
  +            Currently supported are <option>wpa_supplicant</option> or <option>iwd</option>.
  +          '';
  +        };
  +      };
  +
         extraFlags = mkOption {
           type = with types; listOf str;
           default = [ ];
  
positive.code:       assertion = !config.networking.useDHCP;
        message = "You can not use services.connman with networking.useDHCP";
      }{
        assertion = config.networking.wireless.enable;
        message = "You must use services.connman with networking.wireless";
      }{
        assertion = !config.networking.networkmanager.enable;
        message = "You can not use services.connman with networking.networkmanager";
      }];
  
negative.code:     systemd.services.connman = {
        description = "Connection service";
        wantedBy = [ "multi-user.target" ];
        after = [ "syslog.target" ] ++ optional enableIwd "iwd.service";
        requires = optional enableIwd "iwd.service";
        serviceConfig = {
          Type = "dbus";
          BusName = "net.connman";
          Restart = "on-failure";
          ExecStart = toString ([
            "${pkgs.connman}/sbin/connmand"
            "--config=${configFile}"
            "--nodaemon"
          ] ++ optional enableIwd "--wifi=iwd_agent"
            ++ cfg.extraFlags);
          StandardOutput = "null";
        };
      };
  