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