Usb-c rj45 adapter appends 'c2' to interface name

I have 3 different adapters.
2 work as expected, 1 doesn’t. But I don’t know why.

My laptop has 3 usb-c ports, I’ve configured Nixos to give different network settings depending on which usb-c port is used.
eg. enp0s20f0u4 enp72s0u1 enp72s0u2

But my new adapter always appends ‘c2’ to the interface name.
eg. enp0s20f0u4c2 enp72s0u1c2 enp72s0u2c2

Why?
How can I solve this? I could duplicate my network config for the ‘…c2’, but I’d rather not.

udev rules would cover this, but I’d personally write a nix function to cover the -c2 case.

1 Like

I agree
Not perfect but better than nothing.

  wired-interfaces-with-c2 =
    if cfg.wired-interface-c2-duplication then
      lib.attrsets.concatMapAttrs (name: value: {
        ${name} = value;
        ${name + "c2"} = value;
      }) cfg.wired-interfaces
    else
      cfg.wired-interfaces;

1 Like