4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
43 lines
1.2 KiB
Nix
43 lines
1.2 KiB
Nix
{ lib, stdenv, fetchFromGitHub, python3Packages }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "throttled";
|
|
version = "0.8";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "erpalma";
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
sha256 = "0qw124gdgjqij3xhgg8j1mdsg6j0xg340as5qf8hd3gwc38sqi9x";
|
|
};
|
|
|
|
nativeBuildInputs = [ python3Packages.wrapPython ];
|
|
|
|
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/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 lib; {
|
|
description = "Fix for Intel CPU throttling issues";
|
|
homepage = "https://github.com/erpalma/throttled";
|
|
license = licenses.mit;
|
|
platforms = [ "x86_64-linux" ];
|
|
maintainers = with maintainers; [ michaelpj ];
|
|
};
|
|
}
|