summaryrefslogtreecommitdiff
path: root/packages/throttled.nix
blob: ff896cf008d35a1ed17854ceb3ea3d4e041001df (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,
  python3,
  stdenv,
}:
stdenv.mkDerivation rec {
  pname = "throttled";
  version = "unstable-2022-06-30";

  src = fetchFromGitHub {
    owner = "erpalma";
    repo = pname;
    rev = "ab9641a93a409bdc7fca6889ff23ca5a685e5a77";
    hash = "sha256-Zd+rTsVDkw9mq6k2OkMy+HxyYsl3ADy1fEM/1e/jxAs=";
  };

  nativeBuildInputs = with python3.pkgs; [wrapPython];

  pythonPath =
    (with python3.pkgs; [configparser dbus-python pygobject3])
    ++ [kmod];

  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"
  '';
}