# Out-of-tree build of drivers/platform/x86/uniwill from torvalds/linux v6.19
# (uniwill-acpi.c, uniwill-wmi.c, uniwill-wmi.h, vendored verbatim; GPL-2.0-or-later).
# Takes `kernel` and `kernelModuleMakeFlags` from the kernelPackages scope.
{
lib,
stdenv,
kernel,
kernelModuleMakeFlags,
}:
stdenv.mkDerivation {
pname = "uniwill-laptop";
version = "6.19-${kernel.version}";
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [
./Makefile
./uniwill-acpi.c
./uniwill-wmi.c
./uniwill-wmi.h
];
};
hardeningDisable = [ "pic" ];
nativeBuildInputs = kernel.moduleBuildDependencies;
makeFlags = kernelModuleMakeFlags ++ [
"KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
];
installPhase = ''
install -D uniwill-laptop.ko $out/lib/modules/${kernel.modDirVersion}/extra/uniwill-laptop.ko
'';
meta = {
description = "Uniwill/TongFang laptop extras (hwmon fans and temperatures, lightbar, hotkeys), Linux 6.19 driver for older kernels";
homepage = "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/platform/x86/uniwill";
license = lib.licenses.gpl2Plus;
platforms = [ "x86_64-linux" ];
};
}