nixpkgs/pkgs/os-specific/linux/tp_smapi/default.nix
David Guibert 1e77d0b975 kernel 4.14 require libelf to compile modules.
[...]
make modules -C /nix/store/h1vzl6bq4wif3m8dd1bw2p3fv4shjg3n-linux-4.14.9-dev/lib/modules/4.14.9/build EXTRA_CFLAGS=-Werror-implicit-function-declaration M=/tmp/nix-build-spl-kernel-2017-11-16-4.14.9.drv-0/source/build
/nix/store/h1vzl6bq4wif3m8dd1bw2p3fv4shjg3n-linux-4.14.9-dev/lib/modules/4.14.9/source/Makefile:939: *** "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel". Stop.

This patch introduces kernel.moduleBuildDependencies to avoid the logic "stdenv.lib.optional (stdenv.lib.versionAtLeast kernel.version "4.14") libelf" in multiple places.

[dezgeg did some minor tweaks on top]
2017-12-29 23:08:17 +02:00

50 lines
1.5 KiB
Nix

{ stdenv, lib, fetchFromGitHub, kernel, writeScript, coreutils, gnugrep, jq, curl, common-updater-scripts
}:
stdenv.mkDerivation rec {
name = "tp_smapi-${version}-${kernel.version}";
version = "0.42";
src = fetchFromGitHub {
owner = "evgeni";
repo = "tp_smapi";
rev = "tp-smapi/${version}";
sha256 = "12lnig90lrmkmqwl386q7ssqs9p0jikqhwl2wsmcmii1gn92hzfy";
name = "tp-smapi-${version}";
};
nativeBuildInputs = kernel.moduleBuildDependencies;
hardeningDisable = [ "pic" ];
makeFlags = [
"KBASE=${kernel.dev}/lib/modules/${kernel.modDirVersion}"
"SHELL=/bin/sh"
"HDAPS=1"
];
installPhase = ''
install -v -D -m 644 thinkpad_ec.ko "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/firmware/thinkpad_ec.ko"
install -v -D -m 644 tp_smapi.ko "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/firmware/tp_smapi.ko"
install -v -D -m 644 hdaps.ko "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/firmware/hdapsd.ko"
'';
dontStrip = true;
enableParallelBuilding = true;
passthru.updateScript = import ./update.nix {
inherit lib writeScript coreutils gnugrep jq curl common-updater-scripts;
};
meta = {
description = "IBM ThinkPad hardware functions driver";
homepage = https://github.com/evgeni/tp_smapi/tree/tp-smapi/0.41;
license = stdenv.lib.licenses.gpl2;
maintainers = [ stdenv.lib.maintainers.garbas ];
# driver is only ment for linux thinkpads i think bellow platforms should cover it.
platforms = [ "x86_64-linux" "i686-linux" ];
};
}