Displaylink
DisplayLink monitors
In order to use Displaylink monitors over USB, such as the ASUS MB16AC, the displaylink driver needs to be installed:
$ services.xserver.videoDrivers = [ "displaylink" "modesetting" ];
Since these drivers depend on binary unfree blobs, you will need to first add it to your nix-store. Go to https://www.displaylink.com/downloads/ubuntu to get the appropriate driver version and note the download URL you get after accepting the EULA. Then (example):
$ nix-prefetch-url --name displaylink.zip http://assets.displaylink.com/live/downloads/software/f1369_DisplayLink%20USB%20Graphics%20Software%20for%20Ubuntu%205.2.zip\?AWSAccessKeyId\=AKIAJHGQWPVXWHEDJUEA\&Expires\=1579838008\&Signature\=4UidRIwBYLZPHSf2EkcyLFKb%2B8o%3D
Before the monitor can be used by xrandr, you will need to run the following command, which can be added to e.g. your ~/.xprofile (this is not necessary since NixOS 20.03):
$ xrandr --setprovideroutputsource 1 0
Connecting a second external monitor
In order to add a second external monitor you can add the following to your configuration:
services.xserver.displayManager.sessionCommands = ''
${lib.getBin pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource 2 0
'';
xorg configuration
After some experimentation at work getting our Dell D6000 docks to work i had to create an xorg configuration file as follows
environment.etc."X11/xorg.conf.d/20-evdi.conf" = {
enable = true;
text = ''
Section "OutputClass"
Identifier "DisplayLink"
MatchDriver "evdi"
Driver "modesetting"
Option "AccelMethod" "none"
EndSection
'';
};
Taken from arch wiki (https://wiki.archlinux.org/title/DisplayLink#Configuring_X_Server)
Note that modesetting is the modern Intel iGPU driver, read further into the Arch wiki if you're experiencing issues.
evdi is automatically pulled in as a dependency from the displaylink package, you might need to add it to boot.kernelModules.
Status of the package
As of right now (2020-01-24), the package in the nixos stable channel is out of date, so you may need to override it from nixpkgs.
Since NixOS 20.03 this package is working out of the box again.