nixpkgs/pkgs/by-name/th/throttled/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

58 lines
1.4 KiB
Nix

{ lib, stdenv, fetchFromGitHub, gobject-introspection, python3Packages, pciutils, wrapGAppsNoGuiHook }:
stdenv.mkDerivation rec {
pname = "throttled";
version = "0.10.0";
src = fetchFromGitHub {
owner = "erpalma";
repo = pname;
rev = "v${version}";
sha256 = "sha256-0MsPp6y4r/uZB2SplKV+SAiJoxIs2jgOQmQoQQ2ZKwI=";
};
nativeBuildInputs = [
gobject-introspection
python3Packages.wrapPython
wrapGAppsNoGuiHook
];
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/throttled.py|' -i systemd/throttled.service
substituteInPlace throttled.py --replace "'setpci'" "'${pciutils}/bin/setpci'"
'';
installPhase = ''
runHook preInstall
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
'';
dontWrapGApps = true;
preFixup = ''
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
'';
postFixup = "wrapPythonPrograms";
meta = with lib; {
description = "Fix for Intel CPU throttling issues";
homepage = "https://github.com/erpalma/throttled";
license = licenses.mit;
platforms = [ "x86_64-linux" ];
maintainers = [ ];
};
}