summary refs log tree commit diff
path: root/pkgs/tools/system/throttled
diff options
context:
space:
mode:
authorMichael Peyton Jones <me@michaelpj.com>2019-05-26 23:24:45 +0100
committerMichael Peyton Jones <me@michaelpj.com>2019-06-03 17:46:53 +0100
commitcf8457d3cc61d2b35a75250e2f76bba0cc9ef960 (patch)
tree5d4d29f228347017e85d5385df2c5d927057c7ec /pkgs/tools/system/throttled
parentae71c13a92f7e3b7968e8b7b1db9f6238dc00a25 (diff)
downloadnixpkgs-cf8457d3cc61d2b35a75250e2f76bba0cc9ef960.tar
nixpkgs-cf8457d3cc61d2b35a75250e2f76bba0cc9ef960.tar.gz
nixpkgs-cf8457d3cc61d2b35a75250e2f76bba0cc9ef960.tar.bz2
nixpkgs-cf8457d3cc61d2b35a75250e2f76bba0cc9ef960.tar.lz
nixpkgs-cf8457d3cc61d2b35a75250e2f76bba0cc9ef960.tar.xz
nixpkgs-cf8457d3cc61d2b35a75250e2f76bba0cc9ef960.tar.zst
nixpkgs-cf8457d3cc61d2b35a75250e2f76bba0cc9ef960.zip
throttled: init at 0.6
Diffstat (limited to 'pkgs/tools/system/throttled')
-rw-r--r--pkgs/tools/system/throttled/default.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/pkgs/tools/system/throttled/default.nix b/pkgs/tools/system/throttled/default.nix
new file mode 100644
index 00000000000..4f52b5e0945
--- /dev/null
+++ b/pkgs/tools/system/throttled/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchFromGitHub, python3Packages }:
+
+stdenv.mkDerivation rec {
+  pname = "throttled";
+  version = "0.6";
+
+  src = fetchFromGitHub {
+    owner = "erpalma";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1icb2288pj25vbdnd16zvisw9c01hp8vkk25ilkc74gy76xhpcs4";
+  };
+
+  nativeBuildInputs = [ python3Packages.wrapPython ];
+
+  pythonPath = with python3Packages; [ 
+    configparser
+    dbus-python
+    pygobject3
+  ];
+
+  # The upstream unit both assumes the install location, and tries to run in a virtualenv 
+  postPatch = ''sed -e 's|ExecStart=.*|ExecStart=${placeholder "out"}/bin/lenovo_fix.py|' -i systemd/lenovo_fix.service'';
+
+  installPhase = ''
+    runHook preInstall
+    install -D -m755 -t $out/bin lenovo_fix.py
+    install -D -t $out/bin lenovo_fix.py mmio.py
+    install -D -m644 -t $out/etc etc/*
+    install -D -m644 -t $out/lib/systemd/system systemd/*
+    runHook postInstall
+  '';
+
+  postFixup = ''wrapPythonPrograms'';
+
+  meta = with stdenv.lib; {
+    description = "Fix for Intel CPU throttling issues";
+    homepage = https://github.com/erpalma/throttled;
+    license = licenses.mit;
+    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ michaelpj ];
+  };
+}