Files
Yiyu Zhou 804340756b linuxPackages.system76-io: install modules through modules_install
The install phase copied system76-io.ko and system76-thelio-io.ko into
the output by hand, bypassing the Kbuild module installation.
Since #571181, kernelModuleMakeFlags makes Kbuild sign each module with
kmodigest during modules_install, which also writes a certificate next
to the module, and aggregateModules merges the certificates of all
external modules into modules.cer.  The hand-copied modules have
neither, so building a NixOS system with hardware.system76.enableAll
fails:

    cat: misc/system76-thelio-io.ko.cer: No such file or directory
    cat: misc/system76-io.ko.cer: No such file or directory

The upstream Makefile has no install target, so call the Kbuild
modules_install target directly, as suggested for zenpower in #575192.
It strips, signs, and compresses the modules and writes their
certificates.  Keep the modules under misc and leave depmod to
aggregateModules.  Set INSTALL_MOD_STRIP=1, as compression now happens
before the strip phase, which used to remove the debug information.

Assisted-by: Claude (claude-opus-5-5)
2026-10-18 12:32:29 -07:00

61 lines
1.3 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
kernel,
kernelModuleMakeFlags,
}:
let
hash = "sha256-VE6sCehjXlRuOVcK4EN2H+FhaVaBi/jrAYx4TZjbreA=";
in
stdenv.mkDerivation (finalAttrs: {
name = "${finalAttrs.pname}-${finalAttrs.version}-${kernel.version}";
pname = "system76-io-module";
version = "1.0.4";
passthru.moduleName = "system76_io";
src = fetchFromGitHub {
owner = "pop-os";
repo = "system76-io-dkms";
rev = finalAttrs.version;
inherit hash;
};
hardeningDisable = [ "pic" ];
nativeBuildInputs = kernel.moduleBuildDependencies;
makeFlags = kernelModuleMakeFlags ++ [
"INSTALL_MOD_PATH=${placeholder "out"}"
"INSTALL_MOD_DIR=misc"
"INSTALL_MOD_STRIP=1"
"DEPMOD=true"
];
buildFlags = [
"KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
];
installTargets = [ "modules_install" ];
installFlags = [
"-C"
"${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
"M=$(PWD)"
];
meta = {
maintainers = with lib.maintainers; [ ahoneybun ];
license = lib.licenses.gpl2Plus;
platforms = [
"i686-linux"
"x86_64-linux"
"aarch64-linux"
];
broken = lib.versionOlder kernel.version "5.10";
description = "DKMS module for controlling System76 Io board";
homepage = "https://github.com/pop-os/system76-io-dkms";
};
})