mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 19:51:17 +00:00
displaylink service: init
This commit is contained in:
parent
fbf6a97b04
commit
bc493ccfcc
61
nixos/modules/hardware/video/displaylink.nix
Normal file
61
nixos/modules/hardware/video/displaylink.nix
Normal file
|
@ -0,0 +1,61 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
enabled = elem "displaylink" config.services.xserver.videoDrivers;
|
||||
|
||||
displaylink = config.boot.kernelPackages.displaylink;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
config = mkIf enabled {
|
||||
|
||||
boot.extraModulePackages = [ displaylink ];
|
||||
|
||||
boot.kernelModules = [ "evdi" ];
|
||||
|
||||
# Those are taken from displaylink-installer.sh and from Arch Linux AUR package.
|
||||
|
||||
services.udev.extraRules = ''
|
||||
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="17e9", ATTR{bNumInterfaces}=="*5", TAG+="uaccess"
|
||||
'';
|
||||
|
||||
powerManagement.powerDownCommands = ''
|
||||
#flush any bytes in pipe
|
||||
while read -n 1 -t 1 SUSPEND_RESULT < /tmp/PmMessagesPort_out; do : ; done;
|
||||
|
||||
#suspend DisplayLinkManager
|
||||
echo "S" > /tmp/PmMessagesPort_in
|
||||
|
||||
#wait until suspend of DisplayLinkManager finish
|
||||
read -n 1 -t 10 SUSPEND_RESULT < /tmp/PmMessagesPort_out
|
||||
'';
|
||||
|
||||
powerManagement.resumeCommands = ''
|
||||
#resume DisplayLinkManager
|
||||
echo "R" > /tmp/PmMessagesPort_in
|
||||
'';
|
||||
|
||||
systemd.services.displaylink = {
|
||||
description = "DisplayLink Manager Service";
|
||||
after = [ "display-manager.service" ];
|
||||
wantedBy = [ "graphical.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = "${displaylink}/bin/DisplayLinkManager";
|
||||
Restart = "always";
|
||||
RestartSec = 5;
|
||||
};
|
||||
|
||||
preStart = ''
|
||||
mkdir -p /var/log/displaylink
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
|
@ -40,6 +40,7 @@
|
|||
./hardware/video/amdgpu.nix
|
||||
./hardware/video/ati.nix
|
||||
./hardware/video/bumblebee.nix
|
||||
./hardware/video/displaylink.nix
|
||||
./hardware/video/nvidia.nix
|
||||
./hardware/video/webcam/facetimehd.nix
|
||||
./i18n/input-method/default.nix
|
||||
|
|
Loading…
Reference in a new issue