Skip to content

Commit

Permalink
linuxPackages.acpi-call: switch to nix-community fork
Browse files Browse the repository at this point in the history
This fixes also build against linux 5.6
We also took the opportunity to cleanup the build.

(cherry picked from commit 1ae03c9)
  • Loading branch information
Mic92 committed Apr 8, 2020
1 parent 99cbf96 commit 78e69d9
Showing 1 changed file with 18 additions and 28 deletions.
46 changes: 18 additions & 28 deletions pkgs/os-specific/linux/acpi-call/default.nix
Original file line number Diff line number Diff line change
@@ -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/[email protected]/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";
};
}

0 comments on commit 78e69d9

Please sign in to comment.