1{ stdenv, lib, fetchFromGitHub, kernel, fetchurl }:
2
3stdenv.mkDerivation rec {
4 pname = "xone";
5 version = "0.3";
6
7 src = fetchFromGitHub {
8 owner = "medusalix";
9 repo = pname;
10 rev = "refs/tags/v${version}";
11 sha256 = "sha256-h+j4xCV9R6hp9trsv1NByh9m0UBafOz42ZuYUjclILE=";
12 };
13
14 setSourceRoot = ''
15 export sourceRoot=$(pwd)/source
16 '';
17
18 nativeBuildInputs = kernel.moduleBuildDependencies;
19
20 makeFlags = [
21 "-C"
22 "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
23 "M=$(sourceRoot)"
24 "VERSION=${version}"
25 ];
26
27 buildFlags = [ "modules" ];
28 installFlags = [ "INSTALL_MOD_PATH=${placeholder "out"}" ];
29 installTargets = [ "modules_install" ];
30
31 meta = with lib; {
32 description = "Linux kernel driver for Xbox One and Xbox Series X|S accessories";
33 homepage = "https://github.com/medusalix/xone";
34 license = licenses.gpl2;
35 maintainers = with lib.maintainers; [ rhysmdnz ];
36 platforms = platforms.linux;
37 };
38}
39