1{ lib
2, stdenv
3, fetchFromGitHub
4, kernel
5, libdrm
6, python3
7}:
8
9let
10 python3WithLibs = python3.withPackages (ps: with ps; [
11 pybind11
12 ]);
13in
14stdenv.mkDerivation (finalAttrs: {
15 pname = "evdi";
16 version = "1.14.5";
17
18 src = fetchFromGitHub {
19 owner = "DisplayLink";
20 repo = "evdi";
21 rev = "refs/tags/v${finalAttrs.version}";
22 hash = "sha256-G+zNFwKWtAFr2AapQoukjFQlFItIP5Q5m5TWuvTMY8k=";
23 };
24
25 env.NIX_CFLAGS_COMPILE = toString [
26 "-Wno-error"
27 "-Wno-error=discarded-qualifiers" # for Linux 4.19 compatibility
28 "-Wno-error=sign-compare"
29 ];
30
31 nativeBuildInputs = kernel.moduleBuildDependencies;
32
33 buildInputs = [
34 kernel
35 libdrm
36 python3WithLibs
37 ];
38
39 makeFlags = kernel.makeFlags ++ [
40 # This was removed in https://github.com/DisplayLink/evdi/commit/9884501a20346ff85d8a8e3782e9ac9795013ced#diff-5d2a962cad1c08060cbab9e0bba5330ed63958b64ac04024593562cec55f176dL52
41 "CONFIG_DRM_EVDI=m"
42 "KVER=${kernel.modDirVersion}"
43 "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
44 ];
45
46 hardeningDisable = [ "format" "pic" "fortify" ];
47
48 installPhase = ''
49 runHook preInstall
50 install -Dm755 module/evdi.ko $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/gpu/drm/evdi/evdi.ko
51 install -Dm755 library/libevdi.so $out/lib/libevdi.so
52 runHook postInstall
53 '';
54
55 enableParallelBuilding = true;
56
57 meta = with lib; {
58 broken = kernel.kernelOlder "4.19";
59 changelog = "https://github.com/DisplayLink/evdi/releases/tag/v${finalAttrs.version}";
60 description = "Extensible Virtual Display Interface";
61 homepage = "https://www.displaylink.com/";
62 license = with licenses; [ lgpl21Only gpl2Only ];
63 maintainers = [ ];
64 platforms = platforms.linux;
65 };
66})