summaryrefslogtreecommitdiff
path: root/packages/throttled.nix
blob: 1c0f853086b25da4ff7a7046bd2a6240c1864054 (plain)
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
32
33
34
35
36
{
  fetchFromGitHub,
  kmod,
  python3Packages,
  stdenv,
}:
stdenv.mkDerivation rec {
  pname = "throttled";
  version = "git";

  src = fetchFromGitHub {
    owner = "erpalma";
    repo = pname;
    rev = "1dd726672f0b11b813d4c7b63e0157becde7a013";
    hash = "sha256-0MsPp6y4r/uZB2SplKV+SAiJoxIs2jgOQmQoQQ2ZKwI=";
  };

  nativeBuildInputs = with python3Packages; [wrapPython];

  pythonPath =
    [kmod]
    ++ (with python3Packages; [configparser dbus-python pygobject3]);

  installPhase = ''
    runHook preInstall

    install -Dm755 -t $out/opt/throttled throttled.py
    install -Dm644 -t $out/opt/throttled mmio.py

    runHook postInstall
  '';

  postFixup = ''
    wrapPythonProgramsIn $out/opt/throttled "$out $pythonPath"
  '';
}