From 859ee774e1c302583321a9403798fde76dd8bf8d Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 31 Jan 2024 18:00:03 +0100 Subject: [PATCH 1/8] displaylink: use `finalAttrs` pattern --- pkgs/os-specific/linux/displaylink/default.nix | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pkgs/os-specific/linux/displaylink/default.nix b/pkgs/os-specific/linux/displaylink/default.nix index 408dfa408e1d..6872fa55059e 100644 --- a/pkgs/os-specific/linux/displaylink/default.nix +++ b/pkgs/os-specific/linux/displaylink/default.nix @@ -4,10 +4,8 @@ , util-linux , libusb1 , evdi -, systemd , makeWrapper , requireFile -, substituteAll }: let @@ -17,9 +15,8 @@ let else if stdenv.hostPlatform.system == "aarch64-linux" then "aarch64-linux-gnu" else throw "Unsupported architecture"; libPath = lib.makeLibraryPath [ stdenv.cc.cc util-linux libusb1 evdi ]; - in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "displaylink"; version = "5.8.0-63.33"; @@ -45,8 +42,8 @@ stdenv.mkDerivation rec { unpackPhase = '' unzip $src - chmod +x displaylink-driver-${version}.run - ./displaylink-driver-${version}.run --target . --noexec --nodiskspace + chmod +x displaylink-driver-${finalAttrs.version}.run + ./displaylink-driver-${finalAttrs.version}.run --target . --noexec --nodiskspace ''; installPhase = '' @@ -77,4 +74,4 @@ stdenv.mkDerivation rec { hydraPlatforms = []; sourceProvenance = with sourceTypes; [ binaryNativeCode ]; }; -} +}) From 1551a2e3e2b179620b959092ea8dc4642f035fa8 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 31 Jan 2024 18:00:28 +0100 Subject: [PATCH 2/8] displaylink: add missing phase hooks --- pkgs/os-specific/linux/displaylink/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/os-specific/linux/displaylink/default.nix b/pkgs/os-specific/linux/displaylink/default.nix index 6872fa55059e..d2b918d32901 100644 --- a/pkgs/os-specific/linux/displaylink/default.nix +++ b/pkgs/os-specific/linux/displaylink/default.nix @@ -41,12 +41,15 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ unzip makeWrapper ]; unpackPhase = '' + runHook preUnpack unzip $src chmod +x displaylink-driver-${finalAttrs.version}.run ./displaylink-driver-${finalAttrs.version}.run --target . --noexec --nodiskspace + runHook postUnpack ''; installPhase = '' + runHook preInstall install -Dt $out/lib/displaylink *.spkg install -Dm755 ${bins}/DisplayLinkManager $out/bin/DisplayLinkManager mkdir -p $out/lib/udev/rules.d $out/share @@ -60,6 +63,7 @@ stdenv.mkDerivation (finalAttrs: { # We introduce a dependency on the source file so that it need not be redownloaded everytime echo $src >> "$out/share/workspace_dependencies.pin" + runHook postInstall ''; dontStrip = true; From cacc44a576eafdf70001377d465fb52e776b0dff Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 31 Jan 2024 18:02:07 +0100 Subject: [PATCH 3/8] displaylink: switch to `makeBinaryWrapper` --- pkgs/os-specific/linux/displaylink/default.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/displaylink/default.nix b/pkgs/os-specific/linux/displaylink/default.nix index d2b918d32901..ddba18dfea48 100644 --- a/pkgs/os-specific/linux/displaylink/default.nix +++ b/pkgs/os-specific/linux/displaylink/default.nix @@ -4,7 +4,7 @@ , util-linux , libusb1 , evdi -, makeWrapper +, makeBinaryWrapper , requireFile }: @@ -38,7 +38,10 @@ stdenv.mkDerivation (finalAttrs: { ''; }; - nativeBuildInputs = [ unzip makeWrapper ]; + nativeBuildInputs = [ + makeBinaryWrapper + unzip + ]; unpackPhase = '' runHook preUnpack From a4e9c088701dc31cd8223a06329a1c76ddcaabaa Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 31 Jan 2024 18:06:21 +0100 Subject: [PATCH 4/8] displaylink: sort `meta` attributes and add `meta.mainProgram` --- pkgs/os-specific/linux/displaylink/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/displaylink/default.nix b/pkgs/os-specific/linux/displaylink/default.nix index ddba18dfea48..476ea57d44ec 100644 --- a/pkgs/os-specific/linux/displaylink/default.nix +++ b/pkgs/os-specific/linux/displaylink/default.nix @@ -75,10 +75,11 @@ stdenv.mkDerivation (finalAttrs: { meta = with lib; { description = "DisplayLink DL-5xxx, DL-41xx and DL-3x00 Driver for Linux"; homepage = "https://www.displaylink.com/"; + hydraPlatforms = []; license = licenses.unfree; + mainProgram = "DisplayLinkManager"; maintainers = with maintainers; [ abbradar ]; platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" ]; - hydraPlatforms = []; sourceProvenance = with sourceTypes; [ binaryNativeCode ]; }; }) From 25b075dffd70dc7da9aff90c38267b807093da6a Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 31 Jan 2024 18:03:07 +0100 Subject: [PATCH 5/8] evdi: use `finalAttrs` pattern --- pkgs/os-specific/linux/evdi/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/evdi/default.nix b/pkgs/os-specific/linux/evdi/default.nix index f4ad16523afb..eaf3b74156aa 100644 --- a/pkgs/os-specific/linux/evdi/default.nix +++ b/pkgs/os-specific/linux/evdi/default.nix @@ -5,13 +5,13 @@ let pybind11 ]); in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "evdi"; version = "1.14.1-unstable-2024-01-30"; src = fetchFromGitHub { owner = "DisplayLink"; - repo = pname; + repo = "evdi"; rev = "d21a6ea3c69ba180457966a04b6545d321cf46ca"; hash = "sha256-Txa9yX9h3GfmHRRNvhrfrsUoQhqRWbBt4gJYAZTNe0w="; }; @@ -49,4 +49,4 @@ stdenv.mkDerivation rec { homepage = "https://www.displaylink.com/"; broken = kernel.kernelOlder "4.19"; }; -} +}) From 7ae4984c3091b26f5fa956d459a120273217bd9d Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 31 Jan 2024 18:03:48 +0100 Subject: [PATCH 6/8] evdi: add missing phase hooks --- pkgs/os-specific/linux/evdi/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/os-specific/linux/evdi/default.nix b/pkgs/os-specific/linux/evdi/default.nix index eaf3b74156aa..697e1611f1e3 100644 --- a/pkgs/os-specific/linux/evdi/default.nix +++ b/pkgs/os-specific/linux/evdi/default.nix @@ -34,8 +34,10 @@ stdenv.mkDerivation (finalAttrs: { hardeningDisable = [ "format" "pic" "fortify" ]; installPhase = '' + runHook preInstall install -Dm755 module/evdi.ko $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/gpu/drm/evdi/evdi.ko install -Dm755 library/libevdi.so $out/lib/libevdi.so + runHook postInstall ''; enableParallelBuilding = true; From 93d5d8dcde92127adecf3b46f01e158ed3d9bc70 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 31 Jan 2024 18:04:18 +0100 Subject: [PATCH 7/8] evdi: sort `meta` attributes --- pkgs/os-specific/linux/evdi/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/evdi/default.nix b/pkgs/os-specific/linux/evdi/default.nix index 697e1611f1e3..1472a58610fc 100644 --- a/pkgs/os-specific/linux/evdi/default.nix +++ b/pkgs/os-specific/linux/evdi/default.nix @@ -43,12 +43,12 @@ stdenv.mkDerivation (finalAttrs: { enableParallelBuilding = true; meta = with lib; { + broken = kernel.kernelOlder "4.19"; changelog = "https://github.com/DisplayLink/evdi/releases/tag/v${version}"; description = "Extensible Virtual Display Interface"; + homepage = "https://www.displaylink.com/"; + license = with licenses; [ lgpl21Only gpl2Only ]; maintainers = with maintainers; [ ]; platforms = platforms.linux; - license = with licenses; [ lgpl21Only gpl2Only ]; - homepage = "https://www.displaylink.com/"; - broken = kernel.kernelOlder "4.19"; }; }) From 12490c715146458a288cf48a8bb6035df22d4464 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 31 Jan 2024 18:05:00 +0100 Subject: [PATCH 8/8] evdi: update code style --- pkgs/os-specific/linux/evdi/default.nix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/evdi/default.nix b/pkgs/os-specific/linux/evdi/default.nix index 1472a58610fc..059c7891a52b 100644 --- a/pkgs/os-specific/linux/evdi/default.nix +++ b/pkgs/os-specific/linux/evdi/default.nix @@ -1,4 +1,10 @@ -{ lib, stdenv, fetchFromGitHub, kernel, libdrm, python3 }: +{ lib +, stdenv +, fetchFromGitHub +, kernel +, libdrm +, python3 +}: let python3WithLibs = python3.withPackages (ps: with ps; [ @@ -24,7 +30,11 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = kernel.moduleBuildDependencies; - buildInputs = [ kernel libdrm python3WithLibs ]; + buildInputs = [ + kernel + libdrm + python3WithLibs + ]; makeFlags = kernel.makeFlags ++ [ "KVER=${kernel.modDirVersion}"