summary refs log tree commit diff
path: root/pkgs/os-specific/linux/acpi-call/default.nix
blob: 1a9b3cbf74dc989780fa2a8eb37f68f2dc78c7ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{stdenv, fetchgit, kernel, ...}:

stdenv.mkDerivation {
  src = fetchgit {
    url="git://github.com/mkottman/acpi_call.git";
    rev="4f71ce83392bc52b3497";
    sha256="1f20516dc7d42bc7d9d71eaa54f48f38cd56b8683062f81d6f3857990056bdd3";
  };
  name = "acpi-call";

  preBuild = ''
    kernelVersion=$(cd ${kernel}/lib/modules && ls)
    sed -e 's/break/true/' -i test_off.sh
    sed -e 's@/bin/bash@.bin/sh@' -i test_off.sh
    sed -e "s@/lib/modules/\$(.*)@${kernel}/lib/modules/$kernelVersion@" -i Makefile
  '';
 
  installPhase = ''
    kernelVersion=$(cd ${kernel}/lib/modules && ls)
    ensureDir $out/lib/modules/$kernelVersion/misc
    cp acpi_call.ko $out/lib/modules/$kernelVersion/misc
    ensureDir $out/bin
    cp test_off.sh $out/bin/test_discrete_video_off.sh
  '';

  meta = {
    maintainers = [stdenv.lib.maintainers.raskin];
    platforms = stdenv.lib.platforms.linux;
    description = "A module allowing arbitrary ACPI calls; use case: hybrid video";
  };
}