1{
2 stdenv,
3 lib,
4 unzip,
5 util-linux,
6 libusb1,
7 evdi,
8 makeBinaryWrapper,
9 requireFile,
10}:
11
12let
13 bins =
14 if stdenv.hostPlatform.system == "x86_64-linux" then
15 "x64-ubuntu-1604"
16 else if stdenv.hostPlatform.system == "i686-linux" then
17 "x86-ubuntu-1604"
18 else if stdenv.hostPlatform.system == "aarch64-linux" then
19 "aarch64-linux-gnu"
20 else
21 throw "Unsupported architecture";
22 libPath = lib.makeLibraryPath [
23 stdenv.cc.cc
24 util-linux
25 libusb1
26 evdi
27 ];
28in
29stdenv.mkDerivation (finalAttrs: {
30 pname = "displaylink";
31 version = "6.1.0-17";
32
33 src = requireFile rec {
34 name = "displaylink-610.zip";
35 hash = "sha256-RJgVrX+Y8Nvz106Xh+W9N9uRLC2VO00fBJeS8vs7fKw=";
36 message = ''
37 In order to install the DisplayLink drivers, you must first
38 comply with DisplayLink's EULA and download the binaries and
39 sources from here:
40
41 https://www.synaptics.com/products/displaylink-usb-graphics-software-ubuntu-61
42
43 Once you have downloaded the file, please use the following
44 commands and re-run the installation:
45
46 mv \$PWD/"DisplayLink USB Graphics Software for Ubuntu6.1-EXE.zip" \$PWD/${name}
47 nix-prefetch-url file://\$PWD/${name}
48
49 Alternatively, you can use the following command to download the
50 file directly:
51
52 nix-prefetch-url --name ${name} https://www.synaptics.com/sites/default/files/exe_files/2024-10/DisplayLink%20USB%20Graphics%20Software%20for%20Ubuntu6.1-EXE.zip
53 '';
54 };
55
56 nativeBuildInputs = [
57 makeBinaryWrapper
58 unzip
59 ];
60
61 unpackPhase = ''
62 runHook preUnpack
63 unzip $src
64 chmod +x displaylink-driver-${finalAttrs.version}.run
65 ./displaylink-driver-${finalAttrs.version}.run --target . --noexec --nodiskspace
66 runHook postUnpack
67 '';
68
69 installPhase = ''
70 runHook preInstall
71 install -Dt $out/lib/displaylink *.spkg
72 install -Dm755 ${bins}/DisplayLinkManager $out/bin/DisplayLinkManager
73 mkdir -p $out/lib/udev/rules.d $out/share
74 cp ${./99-displaylink.rules} $out/lib/udev/rules.d/99-displaylink.rules
75 patchelf \
76 --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
77 --set-rpath ${libPath} \
78 $out/bin/DisplayLinkManager
79 wrapProgram $out/bin/DisplayLinkManager \
80 --chdir "$out/lib/displaylink"
81
82 # We introduce a dependency on the source file so that it need not be redownloaded everytime
83 echo $src >> "$out/share/workspace_dependencies.pin"
84 runHook postInstall
85 '';
86
87 dontStrip = true;
88 dontPatchELF = true;
89
90 meta = with lib; {
91 description = "DisplayLink DL-7xxx, DL-6xxx, DL-5xxx, DL-41xx and DL-3x00 Driver for Linux";
92 homepage = "https://www.displaylink.com/";
93 hydraPlatforms = [ ];
94 license = licenses.unfree;
95 mainProgram = "DisplayLinkManager";
96 maintainers = with maintainers; [ abbradar ];
97 platforms = [
98 "x86_64-linux"
99 "i686-linux"
100 "aarch64-linux"
101 ];
102 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
103 };
104})