Merge pull request #84597 from NixOS/acpi-call

linuxPackages.acpi-call: switch to nix-community fork
This commit is contained in:
Jörg Thalheim 2020-04-08 15:34:01 +01:00 committed by GitHub
commit fe8875a363
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,43 +1,33 @@
{ stdenv, fetchgit, fetchpatch, kernel }:
{ stdenv, fetchFromGitHub, kernel }:
stdenv.mkDerivation {
name = "acpi-call-${kernel.version}";
stdenv.mkDerivation rec {
pname = "acpi-call";
version = "2020-04-07-${kernel.version}";
src = fetchgit {
url = "git://github.com/mkottman/acpi_call.git";
rev = "ac67445bc75ec4fcf46ceb195fb84d74ad350d51";
sha256 = "0jl19irz9x9pxab2qp4z8c3jijv2m30zhmnzi6ygbrisqqlg4c75";
src = fetchFromGitHub {
owner = "nix-community";
repo = "acpi_call";
rev = "3d7c9fe5ed3fc5ed5bafd39d54b1fdc7a09ce710";
sha256 = "09kp8zl392h99wjwzqrdw2xcfnsc944hzmfwi8n1y7m2slpdybv3";
};
patches = [
(fetchpatch {
url = "https://github.com/mkottman/acpi_call/pull/67.patch";
sha256 = "0z07apvdl8nvl8iwfk1sl1iidfjyx12fc0345bmp2nq1537kpbri";
})
];
hardeningDisable = [ "pic" ];
nativeBuildInputs = kernel.moduleBuildDependencies;
preBuild = ''
sed -e 's/break/true/' -i examples/turn_off_gpu.sh
sed -e 's@/bin/bash@.bin/sh@' -i examples/turn_off_gpu.sh
sed -e "s@/lib/modules/\$(.*)@${kernel.dev}/lib/modules/${kernel.modDirVersion}@" -i Makefile
sed -e 's@acpi/acpi[.]h@linux/acpi.h@g' -i acpi_call.c
'';
makeFlags = [
"KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
];
installPhase = ''
mkdir -p $out/lib/modules/${kernel.modDirVersion}/misc
cp acpi_call.ko $out/lib/modules/${kernel.modDirVersion}/misc
mkdir -p $out/bin
cp examples/turn_off_gpu.sh $out/bin/test_discrete_video_off.sh
chmod a+x $out/bin/test_discrete_video_off.sh
install -D acpi_call.ko $out/lib/modules/${kernel.modDirVersion}/misc/acpi_call.ko
install -D -m755 examples/turn_off_gpu.sh $out/bin/test_discrete_video_off.sh
'';
meta = {
maintainers = [stdenv.lib.maintainers.raskin];
platforms = stdenv.lib.platforms.linux;
meta = with stdenv.lib; {
maintainers = with maintainers; [ raskin mic92 ];
inherit (src.meta) homepage;
platforms = platforms.linux;
description = "A module allowing arbitrary ACPI calls; use case: hybrid video";
};
}