1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 kernel,
6}:
7stdenv.mkDerivation (finalAttrs: {
8 name = "system76-acpi-module-${finalAttrs.version}-${kernel.version}";
9 version = "1.0.2";
10
11 passthru.moduleName = "system76_acpi";
12
13 src = fetchFromGitHub {
14 owner = "pop-os";
15 repo = "system76-acpi-dkms";
16 tag = finalAttrs.version;
17 hash = "sha256-EJGKimf+mDSCG6+I7DZuo5GfPVqGPPkcADDtxoqV/8Q=";
18 };
19
20 hardeningDisable = [ "pic" ];
21
22 nativeBuildInputs = kernel.moduleBuildDependencies;
23
24 buildFlags = [
25 "KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
26 ];
27
28 installPhase = ''
29 runHook preInstall
30
31 install -D system76_acpi.ko $out/lib/modules/${kernel.modDirVersion}/misc/system76_acpi.ko
32 mkdir -p $out/lib/udev/hwdb.d
33 mv lib/udev/hwdb.d/* $out/lib/udev/hwdb.d
34
35 runHook postInstall
36 '';
37
38 # GCC 14 makes this an error by default, remove when fixed upstream
39 env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types";
40
41 meta = {
42 maintainers = with lib.maintainers; [ ahoneybun ];
43 license = [ lib.licenses.gpl2Only ];
44 platforms = [
45 "i686-linux"
46 "x86_64-linux"
47 ];
48 broken = kernel.kernelOlder "5.2";
49 description = "System76 ACPI Driver (DKMS)";
50 homepage = "https://github.com/pop-os/system76-acpi-dkms";
51 longDescription = ''
52 This provides the system76_acpi in-tree driver for systems missing it.
53 '';
54 };
55})