External displays through usb-c dock don't work

I have a HP Elitebook, on which I installed nixos. The computer has only usb-c connectors and my company has usb-c docks which connect to displays via displayport. The external monitors don’t work and don’t show up at Arandr. How to make them work?

I have a HP Elitebook, on which I installed nixos. The computer has only usb-c connectors and my company has usb-c docks which connect to displays via displayport. The external monitors don’t work and don’t show up at Arandr. How to make them work?

How many GPUs, how they are connected, which serves the internal LCD, which serves USB-C video-out?

What GPU drivers are loaded, what does xrandr --listproviders say?

Does

xrandr --setprovideroutputsource 1 0
xrandr --setprovideroffloadsink 1 0

change anything?

Thanks for your help!

I don’t know, how do I find out?

It returns this:

Providers: number : 3
Provider 0: id: 0x49 cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 4 outputs: 6 associated providers: 1 name:Intel
Provider 1: id: 0x10b cap: 0x2, Sink Output crtcs: 1 outputs: 1 associated providers: 1 name:modesetting
Provider 2: id: 0xca cap: 0x2, Sink Output crtcs: 1 outputs: 1 associated providers: 0 name:modesetting

I ran it after your next suggestion.

This resulted in this error message:

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  34 (RRSetProviderOffloadSink)
  Value in failed request:  0x10b
  Serial number of failed request:  17
  Current serial number in output stream:  18

After running these, Arandr shows one extra display as DVI-I-2-2. When trying to use it, the monitor wakes up and says it has DisplayPort signal but flickers instead of showing anything useful.

Does you docking station requere diplaylink drivers to work?

I don’t know. How do I see that?

What GPU drivers are loaded, what does xrandr --listproviders say?

Providers: number : 3
Provider 0: id: 0x49 cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 4 outputs: 6 associated providers: 1 name:Intel
Provider 1: id: 0x10b cap: 0x2, Sink Output crtcs: 1 outputs: 1 associated providers: 1 name:modesetting
Provider 2: id: 0xca cap: 0x2, Sink Output crtcs: 1 outputs: 1 associated providers: 0 name:modesetting

Hmmm. Interesting. Then the next suggestion should actually be

xrandr --setprovideroutputsource 1 0
xrandr --setprovideroutputsource 2 0

Hopefully not the opposite order of the last two arguments, although you can try, I guess

Afterwards try

xrandr -q

After running these, xrandr -q showed a bunch of output resolutions in DVI-I-1-1 and DVI-I-2-2. Then in arandr I activated the screens and tried organising them, but clicking the accept button led to me getting logged out and back at sddm login screen. I now have services.xserver.videoDrivers = [ "displaylink" ]; in my config.

Actually, tried that again and now everything works O_o. How can I make this permanent without resorting to commands in .bashrc?

Actually, tried that again and now everything works O_o.

Purely theoretically, it might be that what matters is these commands being run before your WM or DE starts. I guess restarting the X server (probably via display-manager service?) could be informative.

How can I make this permanent without resorting to commands in .bashrc?

You might want to disclose the exact setup you use so that people (not me, I do not use mainline NixOS) can advise the best place to put things.