1{ lib, stdenv, fetchFromGitHub, kernel }:
2let
3 version = "1.0.2";
4 sha256 = "1i7zjn5cdv9h00fgjg46b8yrz4d3dqvfr25g3f13967ycy58m48h";
5in
6stdenv.mkDerivation {
7 name = "system76-acpi-module-${version}-${kernel.version}";
8
9 passthru.moduleName = "system76_acpi";
10
11 src = fetchFromGitHub {
12 owner = "pop-os";
13 repo = "system76-acpi-dkms";
14 rev = version;
15 inherit sha256;
16 };
17
18 hardeningDisable = [ "pic" ];
19
20 nativeBuildInputs = kernel.moduleBuildDependencies;
21
22 buildFlags = [
23 "KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
24 ];
25
26 installPhase = ''
27 install -D system76_acpi.ko $out/lib/modules/${kernel.modDirVersion}/misc/system76_acpi.ko
28 mkdir -p $out/lib/udev/hwdb.d
29 mv lib/udev/hwdb.d/* $out/lib/udev/hwdb.d
30 '';
31
32 meta = with lib; {
33 maintainers = [ maintainers.khumba ];
34 license = [ licenses.gpl2Only ];
35 platforms = [ "i686-linux" "x86_64-linux" ];
36 broken = kernel.kernelOlder "5.2";
37 description = "System76 ACPI Driver (DKMS)";
38 homepage = "https://github.com/pop-os/system76-acpi-dkms";
39 longDescription = ''
40 This provides the system76_acpi in-tree driver for systems missing it.
41 '';
42 };
43}