about summary refs log tree commit diff
path: root/nixpkgs/pkgs/os-specific/linux/displaylink
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/os-specific/linux/displaylink')
-rw-r--r--nixpkgs/pkgs/os-specific/linux/displaylink/default.nix74
-rw-r--r--nixpkgs/pkgs/os-specific/linux/displaylink/udev-installer.patch18
2 files changed, 92 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/os-specific/linux/displaylink/default.nix b/nixpkgs/pkgs/os-specific/linux/displaylink/default.nix
new file mode 100644
index 000000000000..2ea939ccdb09
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/linux/displaylink/default.nix
@@ -0,0 +1,74 @@
+{ stdenv, lib, unzip, utillinux,
+  libusb1, evdi, systemd, makeWrapper, requireFile, substituteAll }:
+
+let
+  arch =
+    if stdenv.hostPlatform.system == "x86_64-linux" then "x64"
+    else if stdenv.hostPlatform.system == "i686-linux" then "x86"
+    else throw "Unsupported architecture";
+  bins = "${arch}-ubuntu-1604";
+  libPath = lib.makeLibraryPath [ stdenv.cc.cc utillinux libusb1 evdi ];
+
+in stdenv.mkDerivation rec {
+  name = "displaylink-${version}";
+  version = "4.4.24";
+
+  src = requireFile rec {
+    name = "displaylink.zip";
+    sha256 = "0c02mg7vbijpfpk9imh0hmls1yiglc216zfllw5ar86r1slhd5y0";
+    message = ''
+      In order to install the DisplayLink drivers, you must first
+      comply with DisplayLink's EULA and download the binaries and
+      sources from here:
+
+      http://www.displaylink.com/downloads/file?id=1261
+
+      Once you have downloaded the file, please use the following
+      commands and re-run the installation:
+
+      mv \$PWD/"DisplayLink USB Graphics Software for Ubuntu ${version}.zip" \$PWD/${name}
+      nix-prefetch-url file://\$PWD/${name}
+    '';
+  };
+
+  nativeBuildInputs = [ unzip makeWrapper ];
+
+  unpackPhase = ''
+    unzip $src
+    chmod +x displaylink-driver-${version}.run
+    ./displaylink-driver-${version}.run --target . --noexec
+  '';
+
+  patches = [ (substituteAll {
+    src = ./udev-installer.patch;
+    inherit systemd;
+  })];
+
+  installPhase = ''
+    sed -i "s,/opt/displaylink/udev.sh,$out/lib/udev/displaylink.sh,g" udev-installer.sh
+    ( source udev-installer.sh
+      mkdir -p $out/lib/udev/rules.d
+      main systemd "$out/lib/udev/rules.d/99-displaylink.rules" "$out/lib/udev/displaylink.sh"
+    )
+
+    install -Dt $out/lib/displaylink *.spkg
+    install -Dm755 ${bins}/DisplayLinkManager $out/bin/DisplayLinkManager
+    patchelf \
+      --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
+      --set-rpath ${libPath} \
+      $out/bin/DisplayLinkManager
+    wrapProgram $out/bin/DisplayLinkManager \
+      --run "cd $out/lib/displaylink"
+  '';
+
+  dontStrip = true;
+  dontPatchELF = true;
+
+
+  meta = with stdenv.lib; {
+    description = "DisplayLink DL-5xxx, DL-41xx and DL-3x00 Driver for Linux";
+    platforms = [ "x86_64-linux" "i686-linux" ];
+    license = licenses.unfree;
+    homepage = https://www.displaylink.com/;
+  };
+}
diff --git a/nixpkgs/pkgs/os-specific/linux/displaylink/udev-installer.patch b/nixpkgs/pkgs/os-specific/linux/displaylink/udev-installer.patch
new file mode 100644
index 000000000000..3e62e20c3150
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/linux/displaylink/udev-installer.patch
@@ -0,0 +1,18 @@
+--- a/udev-installer.sh	2018-12-09 12:05:53.772318942 +0100
++++ b/udev-installer.sh	2018-12-09 12:06:19.939947629 +0100
+@@ -21,12 +21,12 @@
+   cat <<'EOF'
+ start_service()
+ {
+-  systemctl start dlm
++  @systemd@/bin/systemctl start --no-block dlm
+ }
+ 
+ stop_service()
+ {
+-  systemctl stop dlm
++  @systemd@/bin/systemctl stop dlm
+ }
+ 
+ EOF
+