1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 kernel,
6 kernelModuleMakeFlags,
7}:
8
9stdenv.mkDerivation (finalAttr: {
10 pname = "xpad-noone";
11 version = "0-unstable-2024-01-10";
12
13 src = fetchFromGitHub {
14 owner = "medusalix";
15 repo = finalAttr.pname;
16 tag = "c3d1610";
17 hash = "sha256-jDRyvbU9GsnM1ARTuwnoD7ZXlfBxne13UpSKRo7HHSY=";
18 };
19
20 hardeningDisable = [ "pic" ];
21
22 nativeBuildInputs = kernel.moduleBuildDependencies;
23
24 makeFlags = kernelModuleMakeFlags;
25
26 postPatch = ''
27 substituteInPlace Makefile --replace-fail "/lib/modules/\$(shell uname -r)/build" "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
28 '';
29
30 installPhase = ''
31 runHook preInstall
32
33 install *.ko -Dm444 -t $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/xpad-noone
34
35 runHook postInstall
36 '';
37
38 meta = {
39 homepage = "https://github.com/medusalix/xpad-noone";
40 description = "Xpad driver from the Linux kernel with support for Xbox One controllers removed";
41 license = with lib.licenses; [
42 gpl2Only
43 ];
44 maintainers = with lib.maintainers; [ Cryolitia ];
45 platforms = lib.platforms.linux;
46 broken = kernel.kernelOlder "5.15";
47 };
48})