1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 kernel,
6}:
7let
8 version = "1.0.17";
9 hash = "sha256-9/t+Mvfnq0KkPbe1mnrVy4mzNaK7vAgLuhUnOeEvBfI=";
10in
11stdenv.mkDerivation {
12 name = "system76-module-${version}-${kernel.version}";
13
14 passthru.moduleName = "system76";
15
16 src = fetchFromGitHub {
17 owner = "pop-os";
18 repo = "system76-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.ko $out/lib/modules/${kernel.modDirVersion}/misc/system76.ko
33 mkdir -p $out/lib/udev/hwdb.d
34 mv lib/udev/hwdb.d/* $out/lib/udev/hwdb.d
35 '';
36
37 meta = {
38 maintainers = with lib.maintainers; [ ahoneybun ];
39 license = [ lib.licenses.gpl2Plus ];
40 platforms = [
41 "i686-linux"
42 "x86_64-linux"
43 ];
44 description = "System76 DKMS driver";
45 homepage = "https://github.com/pop-os/system76-dkms";
46 longDescription = ''
47 The System76 DKMS driver. On newer System76 laptops, this driver controls
48 some of the hotkeys and allows for custom fan control.
49 '';
50 };
51}