Kdeconnect on the phone and gsconnect on the pc do not see each other

On other distros everything worked fine, but on nixos the devices are not finding each other

NixOS has a firewall enabled by default. Did you open the ports that kdeconnect needs to work ?

I believe the best way to do this is using the NixOS module by setting programs.kdeconnect.enable = true, which should both ensure kdeconnect is installed as well as open the necessary ports.

No, how do you do that?

Like @jchw said, or

        networking.firewall = rec {
          allowedTCPPortRanges = [ { from = 1714; to = 1764; } ];
          allowedUDPPortRanges = allowedTCPPortRanges;
        };