mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-24 03:43:53 +03:00
tlp: add x86_energy_perf_policy, refactor
This commit is contained in:
parent
265718c985
commit
23845d7084
@ -6,7 +6,12 @@ let
|
||||
|
||||
cfg = config.services.tlp;
|
||||
|
||||
tlp = pkgs.tlp.override { kmod = config.system.sbin.modprobe; };
|
||||
enableRDW = config.networking.networkmanager.enable;
|
||||
|
||||
tlp = pkgs.tlp.override {
|
||||
inherit enableRDW;
|
||||
kmod = config.system.sbin.modprobe;
|
||||
};
|
||||
|
||||
# XXX: We can't use writeTextFile + readFile here because it triggers
|
||||
# TLP build to get the .drv (even on --dry-run).
|
||||
@ -90,13 +95,15 @@ in
|
||||
environment.etc = [{ source = confFile;
|
||||
target = "default/tlp";
|
||||
}
|
||||
] ++ optional tlp.enableRDW {
|
||||
] ++ optional enableRDW {
|
||||
source = "${tlp}/etc/NetworkManager/dispatcher.d/99tlp-rdw-nm";
|
||||
target = "NetworkManager/dispatcher.d/99tlp-rdw-nm";
|
||||
};
|
||||
|
||||
environment.systemPackages = [ tlp ];
|
||||
|
||||
boot.kernelModules = [ "msr" ];
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
{ stdenv, fetchFromGitHub, makeWrapper, perl, systemd, iw, rfkill, hdparm, ethtool, inetutils, kmod
|
||||
, pciutils, smartmontools
|
||||
, enableRDW ? true, networkmanager }:
|
||||
{ stdenv, lib, fetchFromGitHub, makeWrapper, perl, systemd, iw, rfkill, hdparm, ethtool, inetutils
|
||||
, kmod, pciutils, smartmontools, x86_energy_perf_policy
|
||||
, enableRDW ? false, networkmanager
|
||||
}:
|
||||
|
||||
let version = "0.8";
|
||||
in stdenv.mkDerivation {
|
||||
inherit enableRDW;
|
||||
|
||||
name = "tlp-${version}";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
@ -27,10 +26,11 @@ in stdenv.mkDerivation {
|
||||
|
||||
buildInputs = [ perl ];
|
||||
|
||||
paths = with stdenv.lib;
|
||||
concatMapStringsSep ":" (x: "${x}/bin")
|
||||
([ iw rfkill hdparm ethtool inetutils systemd kmod pciutils smartmontools ]
|
||||
++ optional enableRDW networkmanager
|
||||
paths = lib.makeSearchPath "bin"
|
||||
([ iw rfkill hdparm ethtool inetutils systemd kmod pciutils smartmontools
|
||||
x86_energy_perf_policy
|
||||
]
|
||||
++ lib.optional enableRDW networkmanager
|
||||
);
|
||||
|
||||
installTargets = [ "install-tlp" ] ++ stdenv.lib.optional enableRDW "install-rdw";
|
||||
@ -41,13 +41,6 @@ in stdenv.mkDerivation {
|
||||
wrapProgram "$i" \
|
||||
--prefix PATH : "$paths"
|
||||
done
|
||||
if [ "$enableRDW" = "1" ]; then
|
||||
for i in $out/etc/NetworkManager/dispatcher.d/*; do
|
||||
sed -i "s,/usr/lib/,$out/lib/,g" "$i"
|
||||
wrapProgram "$i" \
|
||||
--prefix PATH : "$paths"
|
||||
done
|
||||
fi
|
||||
|
||||
for i in $out/lib/udev/rules.d/*; do
|
||||
sed -i "s,RUN+=\",\\0$out,g; s,/usr/sbin,/bin,g" "$i"
|
||||
@ -56,10 +49,14 @@ in stdenv.mkDerivation {
|
||||
for i in man/*; do
|
||||
install -D $i $out/share/man/man''${i##*.}/$(basename $i)
|
||||
done
|
||||
'' + lib.optionalString enableRDW ''
|
||||
for i in $out/etc/NetworkManager/dispatcher.d/*; do
|
||||
sed -i "s,/usr/lib/,$out/lib/,g" "$i"
|
||||
wrapProgram "$i" \
|
||||
--prefix PATH : "$paths"
|
||||
done
|
||||
'';
|
||||
|
||||
passthru = { inherit enableRDW; };
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Advanced Power Management for Linux";
|
||||
homepage = "http://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html";
|
||||
|
@ -13103,7 +13103,7 @@ let
|
||||
tla = callPackage ../applications/version-management/arch { };
|
||||
|
||||
tlp = callPackage ../tools/misc/tlp {
|
||||
enableRDW = config.networking.networkmanager.enable or false;
|
||||
inherit (linuxPackages) x86_energy_perf_policy;
|
||||
};
|
||||
|
||||
todo-txt-cli = callPackage ../applications/office/todo.txt-cli { };
|
||||
|
Loading…
Reference in New Issue
Block a user