Change:
<del> { stdenv, lib, fetchFromGitHub, perl, makeWrapper, file, systemd, iw, rfkill , hdparm, ethtool, inetutils , kmod, pciutils, smartmontools , x86_energy_perf_policy, gawk, gnugrep, coreutils, utillinux , checkbashisms, shellcheck , enableRDW ? false, networkmanager }: let paths = lib.makeBinPath ([ iw rfkill hdparm ethtool inetutils systemd kmod pciutils smartmontools x86_energy_perf_policy gawk gnugrep coreutils utillinux ] ++ lib.optional enableRDW networkmanager ); in stdenv.mkDerivation rec { </del> <ins> { stdenv , lib , checkbashisms , coreutils , ethtool , fetchFromGitHub , gawk , gnugrep , gnused , hdparm , iw , kmod , makeWrapper , pciutils , perl , shellcheck , smartmontools , systemd , utillinux , x86_energy_perf_policy # RDW only works with NetworkManager, and thus is optional with default off , enableRDW ? false , networkmanager }: stdenv.mkDerivation rec { </ins> pname = "tlp"; <del> version = "1.2.2"; </del> <ins> version = "1.3.1"; </ins> src = fetchFromGitHub { owner = "linrunner"; repo = "TLP"; rev = version; <del> sha256 = "0vm31ca6kdak9xzwskz7a8hvdp67drfh2zcdwlz3260r8r2ypgg1"; </del> <ins> sha256 = "14fcnaz9pw534v4d8dddqq4wcvpf1kghr8zlrk62r5lrl46sp1p5"; </ins> }; <del> outRef = placeholder "out"; </del> <ins> # XXX: See patch files for relevant explanations. patches = [ ./patches/fix-makefile-sed.patch ./patches/tlp-sleep-service.patch ]; buildInputs = [ perl ]; nativeBuildInputs = [ makeWrapper gnused ]; # XXX: While [1] states that DESTDIR should not be used, and that the correct # variable to set is, in fact, PREFIX, tlp thinks otherwise. The Makefile for # tlp concerns itself only with DESTDIR [2] (possibly incorrectly) and so we set # that as opposed to PREFIX, despite what [1] says. # # [1]: https://github.com/NixOS/nixpkgs/issues/65718 # [2]: https://github.com/linrunner/TLP/blob/ab788abf4936dfb44fbb408afc34af834230a64d/Makefile#L4-L46 </ins> makeFlags = [ <del> "DESTDIR=${outRef}" "TLP_SBIN=${outRef}/bin" "TLP_BIN=${outRef}/bin" "TLP_TLIB=${outRef}/share/tlp" "TLP_FLIB=${outRef}/share/tlp/func.d" "TLP_ULIB=${outRef}/lib/udev" "TLP_NMDSP=${outRef}/etc/NetworkManager/dispatcher.d" "TLP_SHCPL=${outRef}/share/bash-completion/completions" "TLP_MAN=${outRef}/share/man" "TLP_META=${outRef}/share/metainfo" </del> <ins> "DESTDIR=${placeholder "out"}" </ins> "TLP_NO_INIT=1" <del> ]; </del> <ins> "TLP_WITH_ELOGIND=0" "TLP_WITH_SYSTEMD=1" </ins> <del> nativeBuildInputs = [ makeWrapper file ]; buildInputs = [ perl ]; installTargets = [ "install-tlp" "install-man" ] ++ stdenv.lib.optional enableRDW "install-rdw"; checkInputs = [ checkbashisms shellcheck </del> <ins> "TLP_BIN=/bin" "TLP_CONFDEF=/share/tlp/defaults.conf" "TLP_FLIB=/share/tlp/func.d" "TLP_MAN=/share/man" "TLP_META=/share/metainfo" "TLP_SBIN=/sbin" "TLP_SHCPL=/share/bash-completion/completions" "TLP_TLIB=/share/tlp" </ins> ]; <del> doCheck = true; </del> <ins> installTargets = [ "install-tlp" "install-man" ] ++ lib.optionals enableRDW [ "install-rdw" "install-man-rdw" ]; # XXX: This is disabled because it's basically just noise since upstream # itself does not seem to care about the zillion shellcheck errors. doCheck = false; checkInputs = [ checkbashisms shellcheck ]; </ins> checkTarget = [ "checkall" ]; <del> postInstall = '' cp -r $out/$out/* $out rm -rf $out/$(echo "$NIX_STORE" | cut -d "/" -f2) </del> <ins> postInstall = let paths = lib.makeBinPath ( [ coreutils ethtool gawk gnugrep gnused hdparm iw kmod pciutils perl smartmontools systemd utillinux x86_energy_perf_policy ] ++ lib.optional enableRDW networkmanager ); in '' fixup_perl=( $out/share/tlp/tlp-pcilist $out/share/tlp/tlp-readconfs $out/share/tlp/tlp-usblist $out/share/tlp/tpacpi-bat ) for f in "''${fixup_perl[@]}"; do wrapProgram "$f" --prefix PATH : "${paths}" done </ins> <del> for i in $out/bin/* $out/lib/udev/tlp-* ${lib.optionalString enableRDW "$out/etc/NetworkManager/dispatcher.d/*"}; do if file "$i" | grep -q Perl; then # Perl script; use wrapProgram wrapProgram "$i"  --prefix PATH : "${paths}" else # Bash script sed -i '2iexport PATH=${paths}:$PATH' "$i" fi done ''; </del> <ins> fixup_bash=( $out/bin/* $out/etc/NetworkManager/dispatcher.d/* $out/lib/udev/tlp-* $out/sbin/* $out/share/tlp/func.d/* $out/share/tlp/tlp-func-base ) for f in "''${fixup_bash[@]}"; do sed -i '2iexport PATH=${paths}:$PATH' "$f" done ''; </ins> <del> meta = with stdenv.lib; { </del> <ins> meta = with lib; { </ins> description = "Advanced Power Management for Linux"; <del> homepage = https://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html; </del> <ins> homepage = "https://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html"; </ins> platforms = platforms.linux; <del> maintainers = with maintainers; [ abbradar ]; </del> <ins> maintainers = with maintainers; [ abbradar lovesegfault ]; </ins> license = licenses.gpl2Plus; }; }

Discussion:
Describe the bug Our current version of tlp, 1.2.1, is ancient and misses the large number of fixes in versions 1.3.0 and 1.3.1. A bump is warranted, but is nontrivial since a lot has changed. Additional context Maintainer information:
cc.
I'm working on this