How to use both KDE Connect and GSConnect?

I often need to test software on multiple desktops. I am currently trying to configure NixOS to install Plasma 6 alongside of Gnome.

However, when I add services.desktopManager.plasma6.enable = true; to my configuration, I get the following error:

error: The option `programs.kdeconnect.package' is defined multiple times while it's expected to be unique.

Definition values:
- In `/etc/nixos/environments/gnome.nix': <derivation gnome-shell-extension-gsconnect-72>
- In `/nix/store/fdxif4mqv9q06ci63mpjdxxqn2c0bs8l-nixos-26.05/nixos/nixos/modules/services/desktop-managers/plasma6.nix': <derivation kdeconnect-kde-26.04.3>
Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions.

This is because I have configured my Gnome desktop (already set up) to use the GSConnect extension:

{ pkgs, ... }:
{
  programs.kdeconnect = {
    enable = true;
    package = pkgs.gnomeExtensions.gsconnect;
  };
}

I do not wish to remove GSConnect, as I daily-drive Gnome. However, as I often need to live in other desktops, it would be ideal to have both GSConnect and KDE Connect installed side-by-side. Plasma 6 and other desktops should use KDE Connect, and Gnome should use GSConnect.

While KDE Connect works across all desktop environments, I’d prefer to get the better-integrated experience of GSConnect in Gnome.

How can I accomplish this?

Explicitly setting programs.kdeconnect.package is only useful if you want to avoid installing pkgs.kdeconnect. You can just do this:

programs.kdeconnect.enable = true;
environment.systemPackages = [
  pkgs.gnomeExtensions.gsconnect
];

Add a condition for the package based on which DE is enabled? I’m on mobile rn so cannot give exact syntax, but basically if gnome then gsconnect else kdeconnect.

That would require KDE and Gnome to be specializations, which they aren’t in OPs setup. IIUC they have both KDE Plasma and Gnome enabled at the same time.

@versteht-nur-bahnhof’s solution is correct, because as you can see in the kdeconnect module, all it does with cfg.package is add it to environment.systemPackages if non-null. Everything else is just generic firewall rules and enabling uinput for the digitizer plugin.