about summary refs log tree commit diff
path: root/packages/throttled.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2022-08-12 22:53:53 +0300
committerAzat Bahawi <azat@bahawi.net>2022-08-12 22:53:53 +0300
commit61b94f0dd06cac0f7dcd38cce80f2a7ab8376098 (patch)
treeb703a9fe11eae6c4cae4e4682f02caf0caa171d0 /packages/throttled.nix
2022-08-12
Diffstat (limited to '')
-rw-r--r--packages/throttled.nix36
1 files changed, 36 insertions, 0 deletions
diff --git a/packages/throttled.nix b/packages/throttled.nix
new file mode 100644
index 0000000..ff896cf
--- /dev/null
+++ b/packages/throttled.nix
@@ -0,0 +1,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"
+  '';
+}

Consider giving Nix/NixOS a try! <3