nixpkgs/pkgs/tools/system/throttled/default.nix

44 lines
1.2 KiB
Nix
Raw Normal View History

2019-05-26 23:24:45 +01:00
{ stdenv, fetchFromGitHub, python3Packages }:
stdenv.mkDerivation rec {
pname = "throttled";
2020-02-21 05:39:41 +00:00
version = "0.7";
2019-05-26 23:24:45 +01:00
src = fetchFromGitHub {
owner = "erpalma";
repo = pname;
rev = "v${version}";
2020-02-21 05:39:41 +00:00
sha256 = "1y1sczvj2qc8ml9i1rdzr8hklvci9bdphm3mmri2ncaqys8wdbh4";
2019-05-26 23:24:45 +01:00
};
nativeBuildInputs = [ python3Packages.wrapPython ];
2020-02-21 05:39:41 +00:00
pythonPath = with python3Packages; [
2019-05-26 23:24:45 +01:00
configparser
dbus-python
pygobject3
];
2020-02-21 05:39:41 +00:00
# The upstream unit both assumes the install location, and tries to run in a virtualenv
2019-05-26 23:24:45 +01:00
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";
2019-05-26 23:24:45 +01:00
license = licenses.mit;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ michaelpj ];
};
}