2017-05-01 14:23:41 +02:00
|
|
|
{ stdenv, lib, fetchurl, unzip, utillinux, libusb1, evdi, systemd, makeWrapper }:
|
2016-08-27 18:46:43 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
arch =
|
|
|
|
if stdenv.system == "x86_64-linux" then "x64"
|
|
|
|
else if stdenv.system == "i686-linux" then "x86"
|
|
|
|
else throw "Unsupported architecture";
|
2017-05-01 14:23:41 +02:00
|
|
|
bins = "${arch}-ubuntu-1604";
|
|
|
|
libPath = lib.makeLibraryPath [ stdenv.cc.cc utillinux libusb1 evdi ];
|
2016-08-27 18:46:43 +02:00
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "displaylink-${version}";
|
2017-05-01 14:23:41 +02:00
|
|
|
version = "1.3.52";
|
2016-08-27 18:46:43 +02:00
|
|
|
|
2017-05-01 14:23:41 +02:00
|
|
|
src = fetchurl {
|
2016-08-27 18:46:43 +02:00
|
|
|
name = "displaylink.zip";
|
2017-05-01 14:23:41 +02:00
|
|
|
url = "http://www.displaylink.com/downloads/file?id=744";
|
|
|
|
sha256 = "0ridpsxcf761vym0nlpq702qa46ynddzci17bjmyax2pph7khr0k";
|
2016-08-27 18:46:43 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ unzip makeWrapper ];
|
|
|
|
|
|
|
|
buildCommand = ''
|
2017-05-01 14:23:41 +02:00
|
|
|
unzip $src
|
2016-08-27 18:46:43 +02:00
|
|
|
chmod +x displaylink-driver-${version}.run
|
2017-05-01 14:23:41 +02:00
|
|
|
./displaylink-driver-${version}.run --target . --noexec
|
2016-08-27 18:46:43 +02:00
|
|
|
|
2017-05-01 14:23:41 +02:00
|
|
|
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"
|
2016-08-27 18:46:43 +02:00
|
|
|
)
|
2017-05-01 14:23:41 +02:00
|
|
|
sed -i '2iPATH=${systemd}/bin:$PATH' $out/lib/udev/displaylink.sh
|
2016-08-27 18:46:43 +02:00
|
|
|
|
2017-05-01 14:23:41 +02:00
|
|
|
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"
|
2016-08-27 18:46:43 +02:00
|
|
|
|
|
|
|
fixupPhase
|
|
|
|
'';
|
|
|
|
|
|
|
|
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 = "http://www.displaylink.com/";
|
|
|
|
};
|
|
|
|
}
|