summaryrefslogtreecommitdiff
path: root/packages/throttled.nix
diff options
context:
space:
mode:
Diffstat (limited to 'packages/throttled.nix')
-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"
+ '';
+}