2017-07-29 05:51:59 +03:00
|
|
|
{ stdenv, fetchgit, fetchpatch, kernel }:
|
2010-11-12 01:00:57 +03:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2014-01-05 05:57:21 +04:00
|
|
|
name = "acpi-call-${kernel.version}";
|
2012-02-17 18:32:28 +04:00
|
|
|
|
2010-11-12 01:00:57 +03:00
|
|
|
src = fetchgit {
|
2012-02-17 18:32:28 +04:00
|
|
|
url = "git://github.com/mkottman/acpi_call.git";
|
2014-07-04 21:30:11 +04:00
|
|
|
rev = "ac67445bc75ec4fcf46ceb195fb84d74ad350d51";
|
|
|
|
sha256 = "0jl19irz9x9pxab2qp4z8c3jijv2m30zhmnzi6ygbrisqqlg4c75";
|
2010-11-12 01:00:57 +03:00
|
|
|
};
|
2015-12-23 04:59:47 +03:00
|
|
|
|
2017-07-29 05:51:59 +03:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/mkottman/acpi_call/pull/67.patch";
|
|
|
|
sha256 = "0z07apvdl8nvl8iwfk1sl1iidfjyx12fc0345bmp2nq1537kpbri";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2016-02-26 20:38:15 +03:00
|
|
|
hardeningDisable = [ "pic" ];
|
2015-12-23 04:59:47 +03:00
|
|
|
|
2010-11-12 01:00:57 +03:00
|
|
|
preBuild = ''
|
2013-07-02 17:05:19 +04:00
|
|
|
sed -e 's/break/true/' -i examples/turn_off_gpu.sh
|
|
|
|
sed -e 's@/bin/bash@.bin/sh@' -i examples/turn_off_gpu.sh
|
2014-01-05 05:57:21 +04:00
|
|
|
sed -e "s@/lib/modules/\$(.*)@${kernel.dev}/lib/modules/${kernel.modDirVersion}@" -i Makefile
|
2014-10-06 12:15:46 +04:00
|
|
|
sed -e 's@acpi/acpi[.]h@linux/acpi.h@g' -i acpi_call.c
|
2010-11-12 01:00:57 +03:00
|
|
|
'';
|
2017-09-05 14:14:15 +03:00
|
|
|
|
2010-11-12 01:00:57 +03:00
|
|
|
installPhase = ''
|
2014-01-05 05:57:21 +04:00
|
|
|
mkdir -p $out/lib/modules/${kernel.modDirVersion}/misc
|
|
|
|
cp acpi_call.ko $out/lib/modules/${kernel.modDirVersion}/misc
|
2012-01-19 00:16:00 +04:00
|
|
|
mkdir -p $out/bin
|
2013-07-02 17:05:19 +04:00
|
|
|
cp examples/turn_off_gpu.sh $out/bin/test_discrete_video_off.sh
|
2012-08-03 16:49:57 +04:00
|
|
|
chmod a+x $out/bin/test_discrete_video_off.sh
|
2010-11-12 01:00:57 +03:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
maintainers = [stdenv.lib.maintainers.raskin];
|
|
|
|
platforms = stdenv.lib.platforms.linux;
|
|
|
|
description = "A module allowing arbitrary ACPI calls; use case: hybrid video";
|
|
|
|
};
|
|
|
|
}
|