nixos/displaylink: write out required xorg.conf fragment

Invoke xrandr to actually connect the device.

Additionally, we let systemd create the logs directory and use our module loader
instead of handling it manually.
This commit is contained in:
Peter Hoeg 2019-11-01 12:48:13 +08:00
parent 198fdd98fb
commit d936b17d14

View file

@ -19,6 +19,21 @@ in
config = mkIf enabled {
boot.extraModulePackages = [ evdi ];
boot.kernelModules = [ "evdi" ];
environment.etc."X11/xorg.conf.d/40-displaylink.conf".text = ''
Section "OutputClass"
Identifier "DisplayLink"
MatchDriver "evdi"
Driver "modesetting"
Option "AccelMethod" "none"
EndSection
'';
# make the device available
services.xserver.displayManager.sessionCommands = ''
${lib.getBin pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource 1 0
'';
# Those are taken from displaylink-installer.sh and from Arch Linux AUR package.
@ -47,18 +62,13 @@ in
description = "DisplayLink Manager Service";
after = [ "display-manager.service" ];
conflicts = [ "getty@tty7.service" ];
path = [ pkgs.kmod ];
serviceConfig = {
ExecStart = "${displaylink}/bin/DisplayLinkManager";
Restart = "always";
RestartSec = 5;
LogsDirectory = "displaylink";
};
preStart = ''
mkdir -p /var/log/displaylink
modprobe evdi
'';
};
};