tlp: use sed patching instead of makeWrapper

Fixes #15631
This commit is contained in:
Nikolay Amiantov 2016-05-24 03:01:06 +03:00
parent 429463d55c
commit 5b315e1598

View File

@ -1,11 +1,19 @@
{ stdenv, lib, fetchFromGitHub, makeWrapper, perl, systemd, iw, rfkill, hdparm, ethtool, inetutils { stdenv, lib, fetchFromGitHub, perl, systemd, iw, rfkill, hdparm, ethtool, inetutils
, kmod, pciutils, smartmontools, x86_energy_perf_policy, gawk, gnugrep, coreutils , kmod, pciutils, smartmontools, x86_energy_perf_policy, gawk, gnugrep, coreutils
, enableRDW ? false, networkmanager , enableRDW ? false, networkmanager
}: }:
let version = "0.8"; let
in stdenv.mkDerivation { paths = lib.makeBinPath
([ iw rfkill hdparm ethtool inetutils systemd kmod pciutils smartmontools
x86_energy_perf_policy gawk gnugrep coreutils
]
++ lib.optional enableRDW networkmanager
);
in stdenv.mkDerivation rec {
name = "tlp-${version}"; name = "tlp-${version}";
version = "0.8";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "linrunner"; owner = "linrunner";
@ -22,24 +30,16 @@ in stdenv.mkDerivation {
"TLP_NO_PMUTILS=1" "TLP_NO_PMUTILS=1"
]; ];
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ perl ]; buildInputs = [ perl ];
paths = lib.makeBinPath
([ iw rfkill hdparm ethtool inetutils systemd kmod pciutils smartmontools
x86_energy_perf_policy gawk gnugrep coreutils
]
++ lib.optional enableRDW networkmanager
);
installTargets = [ "install-tlp" ] ++ stdenv.lib.optional enableRDW "install-rdw"; installTargets = [ "install-tlp" ] ++ stdenv.lib.optional enableRDW "install-rdw";
postInstall = '' postInstall = ''
for i in $out/bin/* $out/lib/udev/tlp-*; do for i in $out/bin/* $out/lib/udev/tlp-*; do
sed -i "s,/usr/lib/,$out/lib/,g" "$i" sed -i \
wrapProgram "$i" \ -e "s,/usr/lib/,$out/lib/,g" \
--prefix PATH : "$paths" -e '2iexport PATH=${paths}:$PATH' \
"$i"
done done
for i in $out/lib/udev/rules.d/*; do for i in $out/lib/udev/rules.d/*; do
@ -51,9 +51,10 @@ in stdenv.mkDerivation {
done done
'' + lib.optionalString enableRDW '' '' + lib.optionalString enableRDW ''
for i in $out/etc/NetworkManager/dispatcher.d/*; do for i in $out/etc/NetworkManager/dispatcher.d/*; do
sed -i "s,/usr/lib/,$out/lib/,g" "$i" sed -i \
wrapProgram "$i" \ -e "s,/usr/lib/,$out/lib/,g" \
--prefix PATH : "$paths" -e '2iexport PATH=${paths}:$PATH' \
"$i"
done done
''; '';