Displaylink: Difference between revisions
Mention that pre-sleep.service has the potential to block suspend |
update swaywm instructions for NixOS 25.11 |
||
| (3 intermediate revisions by one other user not shown) | |||
| Line 10: | Line 10: | ||
displaylink | displaylink | ||
]; | ]; | ||
</syntaxhighlight>Then add the videoDrivers:<syntaxhighlight lang=" | </syntaxhighlight>Then add the videoDrivers:<syntaxhighlight lang="nix">services.xserver.videoDrivers = [ "displaylink" "modesetting" ];</syntaxhighlight>The module <code>nixos/modules/hardware/video/displaylink.nix</code> should also work for wlroots compositors. | ||
====<big>Xserver</big>==== | ====<big>Xserver</big>==== | ||
| Line 29: | Line 29: | ||
You probably will need the `evdi` module | You probably will need the `evdi` module | ||
<syntaxhighlight lang="nix"> | |||
boot = { | boot = { | ||
extraModulePackages = [ config.boot.kernelPackages.evdi ]; | extraModulePackages = [ config.boot.kernelPackages.evdi ]; | ||
| Line 39: | Line 39: | ||
}; | }; | ||
}; | }; | ||
</ | </syntaxhighlight> | ||
====='''Gnome Wayland'''===== | ====='''Gnome Wayland'''===== | ||
| Line 45: | Line 45: | ||
Install displayLink package | Install displayLink package | ||
<syntaxhighlight lang="nix"> | |||
environment.systemPackages = with pkgs; [ | environment.systemPackages = with pkgs; [ | ||
displaylink | displaylink | ||
]; | ]; | ||
</ | </syntaxhighlight> | ||
Define videoDrivers | Define videoDrivers | ||
| Line 57: | Line 57: | ||
Add dlm service | Add dlm service | ||
<syntaxhighlight lang="nix"> | |||
systemd.services.dlm.wantedBy = [ "multi-user.target" ]; | systemd.services.dlm.wantedBy = [ "multi-user.target" ]; | ||
</ | </syntaxhighlight> | ||
====='''KDE Plasma'''===== | ====='''KDE Plasma'''===== | ||
| Line 66: | Line 66: | ||
Esnure you properly enabled wayland session | Esnure you properly enabled wayland session | ||
<syntaxhighlight lang="nix"> | |||
environment.variables = { | environment.variables = { | ||
KWIN_DRM_PREFER_COLOR_DEPTH = "24"; | KWIN_DRM_PREFER_COLOR_DEPTH = "24"; | ||
| Line 84: | Line 84: | ||
}; | }; | ||
</ | </syntaxhighlight> | ||
Install displayLink package | Install displayLink package | ||
<syntaxhighlight lang="nix"> | |||
environment.systemPackages = with pkgs; [ | environment.systemPackages = with pkgs; [ | ||
displaylink | displaylink | ||
]; | ]; | ||
</ | </syntaxhighlight> | ||
Instead of dlm setup display-link server as follows: | Instead of dlm setup display-link server as follows: | ||
<syntaxhighlight lang="nix"> | |||
systemd.services.displaylink-server = { | systemd.services.displaylink-server = { | ||
enable = true; | enable = true; | ||
requires = [ "systemd-udevd.service" ]; | requires = [ "systemd-udevd.service" ]; | ||
after = [ "systemd-udevd.service" ]; | after = [ "systemd-udevd.service" ]; | ||
wantedBy = [ "multi-user.target" ]; | wantedBy = [ "multi-user.target" ]; | ||
serviceConfig = { | serviceConfig = { | ||
Type = "simple"; | Type = "simple"; | ||
ExecStart = "${pkgs.displaylink}/bin/DisplayLinkManager"; | ExecStart = "${pkgs.displaylink}/bin/DisplayLinkManager"; | ||
User = "root"; | User = "root"; | ||
Group = "root"; | Group = "root"; | ||
Restart = "on-failure"; | Restart = "on-failure"; | ||
RestartSec = 5; # Wait 5 seconds before restarting | RestartSec = 5; # Wait 5 seconds before restarting | ||
}; | }; | ||
}; | }; | ||
</ | </syntaxhighlight> | ||
==Sway== | ==Sway== | ||
| Line 148: | Line 140: | ||
]; | ]; | ||
services.xserver.videoDrivers = [ "displaylink" ]; | services.xserver.videoDrivers = [ "displaylink" ]; | ||
# only for NixOS 25.05 and earlier | |||
systemd.services.dlm.wantedBy = [ "multi-user.target" ]; | systemd.services.dlm.wantedBy = [ "multi-user.target" ]; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Note as of [https://github.com/NixOS/nixpkgs/pull/351752 2024-10-30] nixos-unstable sway uses <code>wlroots_0_18</code>. The patch above applies correctly but you will need to invoke sway with the <code>--unsupported-gpu</code> flag. | Note as of [https://github.com/NixOS/nixpkgs/pull/351752 2024-10-30] nixos-unstable sway uses <code>wlroots_0_18</code> and as of NixOS 25.11 sway uses <code>wlroots_0_19</code>. The patch above applies correctly but you will need to invoke sway with the <code>--unsupported-gpu</code> flag. | ||
For NixOS 25.11 and later you also will not have to add a dependency on the dlm service but instead use <code>displaylink-server</code> like KDE Plasma. | |||
You can also test if your setup is working without this service (you will still require the patch for wlroots and sway with the <code>--unsupported-gpu</code> flag) by invoking the DisplayLinkManager executable (provided by the displaylink package) as root. If the setup is working, sway should at this point recognize the new display(s). | |||
[https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1823#note_2146862 Source] | [https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1823#note_2146862 Source] | ||