Difference between revisions of "Displaylink"

From NixOS Wiki
Jump to: navigation, search
(Updated the example to use the newest version of the drivers for convenience.)
(Add details to gnome and kde plasma setup)
Line 14: Line 14:
 
</nowiki>}}
 
</nowiki>}}
  
====Connecting a second external monitor====
+
====Xserver====
 +
=====Connecting a second external monitor=====
 
In order to add a second external monitor you can add the following to your configuration:
 
In order to add a second external monitor you can add the following to your configuration:
  
Line 22: Line 23:
  
 
[[Category:Video]]
 
[[Category:Video]]
 +
 +
==== DisplayLink Driver and Wayland====
 +
 +
At first add displayLink driver to nix store as above described.
 +
 +
=====evdi module=====
 +
 +
You probably will need the `evdi` module
 +
{{bc|<nowiki>
 +
boot = {
 +
  extraModulePackages = [ config.boot.kernelPackages.evdi ];
 +
  initrd = {
 +
    # List of modules that are always loaded by the initrd.
 +
    kernelModules = [
 +
      "evdi"
 +
    ];
 +
  };
 +
};
 +
</nowiki>}}
 +
 +
=====Gnome Wayland=====
 +
 +
Install displayLink package
 +
 +
{{bc|<nowiki>
 +
environment.systemPackages = with pkgs; [
 +
  displaylink
 +
];
 +
</nowiki>}}
 +
 +
Define videoDrivers
 +
{{bc|<nowiki>
 +
services.xserver.videoDrivers = [ "displaylink" ];
 +
</nowiki>}}
 +
 +
Add dlm service
 +
{{bc|<nowiki>
 +
systemd.services.dlm.wantedBy = [ "multi-user.target" ];
 +
</nowiki>}}
 +
 +
 +
==== KDE Plasma====
 +
 +
Apparently KDE Plasma (Wayland) requires a slight different approach.
 +
 +
Esnure you properly enabled wayland session
 +
 +
{{bc|<nowiki>
 +
environment.variables = {
 +
  KWIN_DRM_PREFER_COLOR_DEPTH = "24";
 +
};
 +
 +
services = {
 +
  desktopManager.plasma6 = {
 +
    enable = true;
 +
  };
 +
  displayManager = {
 +
    sddm = {
 +
      enable = true;
 +
      wayland.enable = true;
 +
    };
 +
    defaultSession = "plasma";
 +
  };
 +
 +
};
 +
</nowiki>}}
 +
 +
Install displayLink package
 +
 +
{{bc|<nowiki>
 +
environment.systemPackages = with pkgs; [
 +
  displaylink
 +
];
 +
</nowiki>}}
 +
 +
Instead of dlm setup display-link server as follows:
 +
 +
{{bc|<nowiki>
 +
# --- THIS IS THE CRUCIAL PART FOR ENABLING THE SERVICE ---
 +
systemd.services.displaylink-server = {
 +
  enable = true;
 +
  # Ensure it starts after udev has done its work
 +
  requires = [ "systemd-udevd.service" ];
 +
  after = [ "systemd-udevd.service" ];
 +
  wantedBy = [ "multi-user.target" ]; # Start at boot
 +
  # *** THIS IS THE CRITICAL 'serviceConfig' BLOCK ***
 +
  serviceConfig = {
 +
    Type = "simple"; # Or "forking" if it forks (simple is common for daemons)
 +
    # The ExecStart path points to the DisplayLinkManager binary provided by the package
 +
    ExecStart = "${pkgs.displaylink}/bin/DisplayLinkManager";
 +
    # User and Group to run the service as (root is common for this type of daemon)
 +
    User = "root";
 +
    Group = "root";
 +
    # Environment variables that the service itself might need
 +
    # Environment = [ "DISPLAY=:0" ]; # Might be needed in some cases, but generally not for this
 +
    Restart = "on-failure";
 +
    RestartSec = 5; # Wait 5 seconds before restarting
 +
  };
 +
};
 +
</nowiki>}}

Revision as of 12:42, 21 June 2025

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" ];

The module `nixos/modules/hardware/video/displaylink.nix` should also work for wlroots compositors.

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. The currently expected version for the driver can be found under: https://www.synaptics.com/products/displaylink-graphics/downloads/ubuntu-5.8?filetype=exe.

Then (example):

$ nix-prefetch-url --name displaylink-600.zip https://www.synaptics.com/sites/default/files/exe_files/2024-05/DisplayLink%20USB%20Graphics%20Software%20for%20Ubuntu6.0-EXE.zip

Xserver

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
'';

DisplayLink Driver and Wayland

At first add displayLink driver to nix store as above described.

evdi module

You probably will need the `evdi` module

boot = {
  extraModulePackages = [ config.boot.kernelPackages.evdi ];
  initrd = {
    # List of modules that are always loaded by the initrd.
    kernelModules = [
      "evdi"
    ];
  };
};
Gnome Wayland

Install displayLink package

environment.systemPackages = with pkgs; [
  displaylink
];

Define videoDrivers

services.xserver.videoDrivers = [ "displaylink" ];

Add dlm service

systemd.services.dlm.wantedBy = [ "multi-user.target" ];


KDE Plasma

Apparently KDE Plasma (Wayland) requires a slight different approach.

Esnure you properly enabled wayland session

environment.variables = {
  KWIN_DRM_PREFER_COLOR_DEPTH = "24";
};

services = {
  desktopManager.plasma6 = {
    enable = true;
  };
  displayManager = {
    sddm = {
      enable = true;
      wayland.enable = true;
    };
    defaultSession = "plasma";
  };

};

Install displayLink package

environment.systemPackages = with pkgs; [
  displaylink
];

Instead of dlm setup display-link server as follows:

# --- THIS IS THE CRUCIAL PART FOR ENABLING THE SERVICE ---
systemd.services.displaylink-server = {
  enable = true;
  # Ensure it starts after udev has done its work
  requires = [ "systemd-udevd.service" ];
  after = [ "systemd-udevd.service" ];
  wantedBy = [ "multi-user.target" ]; # Start at boot
  # *** THIS IS THE CRITICAL 'serviceConfig' BLOCK ***
  serviceConfig = {
    Type = "simple"; # Or "forking" if it forks (simple is common for daemons)
    # The ExecStart path points to the DisplayLinkManager binary provided by the package
    ExecStart = "${pkgs.displaylink}/bin/DisplayLinkManager";
    # User and Group to run the service as (root is common for this type of daemon)
    User = "root";
    Group = "root";
    # Environment variables that the service itself might need
    # Environment = [ "DISPLAY=:0" ]; # Might be needed in some cases, but generally not for this
    Restart = "on-failure";
    RestartSec = 5; # Wait 5 seconds before restarting
  };
};