nixpkgs/pkgs/os-specific/linux/displaylink/default.nix

76 lines
2.1 KiB
Nix
Raw Normal View History

{ stdenv
, lib
, unzip
, util-linux
, 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";
2017-05-01 13:23:41 +01:00
bins = "${arch}-ubuntu-1604";
2020-11-24 15:29:28 +00:00
libPath = lib.makeLibraryPath [ stdenv.cc.cc util-linux libusb1 evdi ];
in
stdenv.mkDerivation rec {
pname = "displaylink";
2020-07-11 11:01:26 +01:00
version = "5.3.1.34";
src = requireFile rec {
name = "displaylink.zip";
2020-07-11 11:01:26 +01:00
sha256 = "1c1kbjgpb71f73qnyl44rvwi6l4ivddq789rwvvh0ahw2jm324hy";
message = ''
In order to install the DisplayLink drivers, you must first
comply with DisplayLink's EULA and download the binaries and
sources from here:
2020-07-11 11:01:26 +01:00
https://www.displaylink.com/downloads/file?id=1576
Once you have downloaded the file, please use the following
commands and re-run the installation:
2019-11-05 18:13:36 +00:00
mv \$PWD/"DisplayLink USB Graphics Software for Ubuntu ${lib.versions.majorMinor version}.zip" \$PWD/${name}
nix-prefetch-url file://\$PWD/${name}
'';
};
nativeBuildInputs = [ unzip makeWrapper ];
unpackPhase = ''
2017-05-01 13:23:41 +01:00
unzip $src
chmod +x displaylink-driver-${version}.run
./displaylink-driver-${version}.run --target . --noexec --nodiskspace
'';
installPhase = ''
2017-05-01 13:23:41 +01:00
install -Dt $out/lib/displaylink *.spkg
install -Dm755 ${bins}/DisplayLinkManager $out/bin/DisplayLinkManager
mkdir -p $out/lib/udev/rules.d
cp ${./99-displaylink.rules} $out/lib/udev/rules.d/99-displaylink.rules
2017-05-01 13:23:41 +01:00
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";
2020-07-16 09:18:22 +01:00
maintainers = with maintainers; [ nshalman abbradar peterhoeg eyjhb ];
platforms = [ "x86_64-linux" "i686-linux" ];
license = licenses.unfree;
2019-11-05 18:13:36 +00:00
homepage = "https://www.displaylink.com/";
};
}