1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 kernel,
6}:
7let
8 version = "1.0.4";
9 hash = "sha256-VE6sCehjXlRuOVcK4EN2H+FhaVaBi/jrAYx4TZjbreA=";
10in
11stdenv.mkDerivation {
12 name = "system76-io-module-${version}-${kernel.version}";
13
14 passthru.moduleName = "system76_io";
15
16 src = fetchFromGitHub {
17 owner = "pop-os";
18 repo = "system76-io-dkms";
19 rev = version;
20 inherit hash;
21 };
22
23 hardeningDisable = [ "pic" ];
24
25 nativeBuildInputs = kernel.moduleBuildDependencies;
26
27 buildFlags = [
28 "KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
29 ];
30
31 installPhase = ''
32 install -D system76-io.ko $out/lib/modules/${kernel.modDirVersion}/misc/system76-io.ko
33 '';
34
35 meta = {
36 maintainers = with lib.maintainers; [ ahoneybun ];
37 license = lib.licenses.gpl2Plus;
38 platforms = [
39 "i686-linux"
40 "x86_64-linux"
41 "aarch64-linux"
42 ];
43 broken = lib.versionOlder kernel.version "5.10";
44 description = "DKMS module for controlling System76 Io board";
45 homepage = "https://github.com/pop-os/system76-io-dkms";
46 };
47}