Merge pull request #213317 from kurnevsky/throttled

throttled: fix after recent update
This commit is contained in:
Martin Weinelt 2023-02-01 01:37:20 +00:00 committed by GitHub
commit a85007b253
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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