depot/pkgs/os-specific/linux/ddcci/default.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

51 lines
1.6 KiB
Nix

{ lib, stdenv, fetchFromGitLab, kernel, fetchpatch }:
stdenv.mkDerivation rec {
pname = "ddcci-driver";
version = "0.4.5-unstable-2024-09-26";
name = "${pname}-${kernel.version}-${version}";
src = fetchFromGitLab {
owner = "${pname}-linux";
repo = "${pname}-linux";
rev = "0233e1ee5eddb4b8a706464f3097bad5620b65f4";
hash = "sha256-Osvojt8UE+cenOuMoSY+T+sODTAAKkvY/XmBa5bQX88=";
};
patches = [
# See https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux/-/merge_requests/17
(fetchpatch {
url = "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux/-/commit/e0605c9cdff7bf3fe9587434614473ba8b7e5f63.patch";
hash = "sha256-sTq03HtWQBd7Wy4o1XbdmMjXQE2dG+1jajx4HtwBHjM=";
})
];
hardeningDisable = [ "pic" ];
nativeBuildInputs = kernel.moduleBuildDependencies;
prePatch = ''
substituteInPlace ./ddcci/Makefile \
--replace '"$(src)"' '$(PWD)' \
--replace depmod \#
substituteInPlace ./ddcci-backlight/Makefile \
--replace '"$(src)"' '$(PWD)' \
--replace depmod \#
'';
makeFlags = kernel.makeFlags ++ [
"KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
"KVER=${kernel.modDirVersion}"
"KERNEL_MODLIB=$(out)/lib/modules/${kernel.modDirVersion}"
"INCLUDEDIR=$(out)/include"
];
meta = with lib; {
description = "Kernel module driver for DDC/CI monitors";
homepage = "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ kiike ];
platforms = platforms.linux;
broken = kernel.kernelOlder "5.1";
};
}