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