1{ stdenv, fetchFromGitHub, fetchpatch, kernel, lib }:
2
3stdenv.mkDerivation rec {
4 pname = "vendor-reset";
5 version = "unstable-2021-02-16-${kernel.version}";
6
7 src = fetchFromGitHub {
8 owner = "gnif";
9 repo = "vendor-reset";
10 rev = "225a49a40941e350899e456366265cf82b87ad25";
11 sha256 = "sha256-xa7P7+mRk4FVgi+YYCcsFLfyNqPmXvy3xhGoTDVqPxw=";
12 };
13
14 patches = [
15 # Fix build with Linux 5.18.
16 # https://github.com/gnif/vendor-reset/pull/58
17 (fetchpatch {
18 url = "https://github.com/gnif/vendor-reset/commit/5bbffcd6fee5348e8808bdbfcb5b21d455b02f55.patch";
19 sha256 = "sha256-L1QxVpcZAVYiaMFCBfL2EJgeMyOR8sDa1UqF1QB3bns=";
20 })
21 ];
22
23 nativeBuildInputs = kernel.moduleBuildDependencies;
24
25 hardeningDisable = [ "pic" ];
26
27 makeFlags = [
28 "KVER=${kernel.modDirVersion}"
29 "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
30 ];
31
32 installPhase = ''
33 install -D vendor-reset.ko -t "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/misc/"
34 '';
35
36 enableParallelBuilding = true;
37
38 meta = with lib; {
39 description = "Linux kernel vendor specific hardware reset module";
40 homepage = "https://github.com/gnif/vendor-reset";
41 license = licenses.gpl2Only;
42 maintainers = with maintainers; [ ];
43 platforms = [ "x86_64-linux" ];
44 broken = kernel.kernelOlder "4.19";
45 };
46}