throttled: fix after recent update

This commit is contained in:
Evgeny Kurnevsky 2023-01-29 10:19:17 +03:00
parent f5f566d0ff
commit 8542aa185d
No known key found for this signature in database
GPG key ID: 8FF444E5412D750C
2 changed files with 7 additions and 3 deletions

View file

@ -20,7 +20,7 @@ in {
config = mkIf cfg.enable {
systemd.packages = [ pkgs.throttled ];
# The upstream package has this in Install, but that's not enough, see the NixOS manual
systemd.services.lenovo_fix.wantedBy = [ "multi-user.target" ];
systemd.services.throttled.wantedBy = [ "multi-user.target" ];
environment.etc."throttled.conf".source =
if cfg.extraConfig != ""

View file

@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, python3Packages }:
{ lib, stdenv, fetchFromGitHub, python3Packages, pciutils }:
stdenv.mkDerivation rec {
pname = "throttled";
@ -20,7 +20,11 @@ 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/throttled.py|' -i systemd/throttled.service'';
postPatch = ''
sed -e 's|ExecStart=.*|ExecStart=${placeholder "out"}/bin/throttled.py|' -i systemd/throttled.service
substituteInPlace throttled.py --replace "'setpci'" "'${pciutils}/bin/setpci'"
'';
installPhase = ''
runHook preInstall