Merge pull request #206257 from matklad/throttledup

This commit is contained in:
Sandro 2023-01-23 23:54:18 +01:00 committed by GitHub
commit deeba2fb9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View file

@ -22,10 +22,10 @@ in {
# The upstream package has this in Install, but that's not enough, see the NixOS manual
systemd.services.lenovo_fix.wantedBy = [ "multi-user.target" ];
environment.etc."lenovo_fix.conf".source =
environment.etc."throttled.conf".source =
if cfg.extraConfig != ""
then pkgs.writeText "lenovo_fix.conf" cfg.extraConfig
else "${pkgs.throttled}/etc/lenovo_fix.conf";
then pkgs.writeText "throttled.conf" cfg.extraConfig
else "${pkgs.throttled}/etc/throttled.conf";
# Kernel 5.9 spams warnings whenever userspace writes to CPU MSRs.
# See https://github.com/erpalma/throttled/issues/215

View file

@ -2,13 +2,13 @@
stdenv.mkDerivation rec {
pname = "throttled";
version = "0.9.2";
version = "0.10.0";
src = fetchFromGitHub {
owner = "erpalma";
repo = pname;
rev = "v${version}";
sha256 = "sha256-4aDa6REDHO7gr1czIv6NlepeMVJI93agxJjE2vHiEmk=";
sha256 = "sha256-0MsPp6y4r/uZB2SplKV+SAiJoxIs2jgOQmQoQQ2ZKwI=";
};
nativeBuildInputs = [ python3Packages.wrapPython ];
@ -20,12 +20,12 @@ stdenv.mkDerivation rec {
];
# 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'';
postPatch = ''sed -e 's|ExecStart=.*|ExecStart=${placeholder "out"}/bin/throttled.py|' -i systemd/throttled.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 -m755 -t $out/bin throttled.py
install -D -t $out/bin throttled.py mmio.py
install -D -m644 -t $out/etc etc/*
install -D -m644 -t $out/lib/systemd/system systemd/*
runHook postInstall