Change:
<!-- Note that these are hard requirements --<!-- You can use the "Go to file" functionality on github to find the package Then you can go to the history for this package Find the latest "packagename: oldversion -newversion" commit The "newversion" is the the current version of the package --- <!-- Type the name of your package and try to find an open pull request for the package If you find an open pull request, you can review it! There's a high chance that you'll have the new version right away while helping the community! --- name: <!-- The current version can be found easily with the same process than above for checking the master branch If an open PR is present for the package, take this version as the current one and link to the PR --current version: 1.3.1 desired version: 1.4.0 <!-- Search your package here: If no maintainer is listed for your package, tag the person that last updated the package --maintainers: Please tag this issue in your PR.

Discussion:
, makeWrapper , pciutils , perl <ins> , perlcritic </ins> , shellcheck , smartmontools , systemd

, networkmanager }: stdenv.mkDerivation rec { pname = "tlp"; <del> version = "1.3.1"; </del> <ins> version = "1.4.0"; </ins> src = fetchFromGitHub { owner = "linrunner"; repo = "TLP"; rev = version; <del> sha256 = "14fcnaz9pw534v4d8dddqq4wcvpf1kghr8zlrk62r5lrl46sp1p5"; </del> <ins> sha256 = "sha256-Blwj4cqrrYXohnGyJYe+1NYifxqfS4DoVUHmxFf62i4="; </ins> }; # XXX: See patch files for relevant explanations. <del> patches = [ ./patches/fix-makefile-sed.patch ./patches/tlp-sleep-service.patch ]; </del> <ins> patches = [ ./patches/0001-makefile-correctly-sed-paths.patch ./patches/0002-tlp-sleep.service-reintroduce.patch ]; </ins> buildInputs = [ perl ]; nativeBuildInputs = [ makeWrapper gnused ];

"TLP_WITH_ELOGIND=0" "TLP_WITH_SYSTEMD=1" <ins> "TLP_BATD=/share/tlp/bat.d" </ins> "TLP_BIN=/bin" "TLP_CONFDEF=/share/tlp/defaults.conf" <ins> "TLP_CONFREN=/share/tlp/rename.conf" </ins> "TLP_FLIB=/share/tlp/func.d" "TLP_MAN=/share/man" "TLP_META=/share/metainfo"

installTargets = [ "install-tlp" "install-man" ] ++ lib.optionals enableRDW [ "install-rdw" "install-man-rdw" ]; <del> # 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 ]; </del> <ins> doCheck = true; checkInputs = [ checkbashisms perlcritic shellcheck ]; </ins> checkTarget = [ "checkall" ]; <ins> # TODO: Consider using resholve here </ins> postInstall = let paths = lib.makeBinPath ( [

$out/etc/NetworkManager/dispatcher.d/* $out/lib/udev/tlp-* $out/sbin/* <ins> $out/share/tlp/bat.d/* </ins> $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> rm -rf $out/var rm -rf $out/share/metainfo </ins> ''; meta = with lib; {

<ins> From 5c5d878bf49bae5920c330482217477819ba9bc2 Mon Sep 17 00:00:00 2001 From: Bernardo Meurer <bernardo@meurer.org> Date: Fri, 15 Oct 2021 23:22:50 -0700 Subject: [PATCH 1/2] makefile: correctly sed paths The default Makefile for tlp makes a mess with catenating `DESTDIR` to everything, but then not actualy using the catenated (_ prefixed) variables to sed it's `.in` files. This patch makes sure that it correctly sets the paths, taking `DESTDIR` in account where it makes sense (e.g. /bin where we want $out/bin) but not where it doesn't (/etc/tlp.conf should be just that). The reason DESTDIR is used at all, as opposed to the more appropriate PREFIX, is covered in the nix formula, and is (also) due to the Makefile being a bit "different." --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index e9bbab4..ab05720 100644 --- a/Makefile +++ b/Makefile @@ -51,19 +51,19 @@ _TPACPIBAT = $(DESTDIR)$(TPACPIBAT) SED = sed  -e "s|@TLPVER@|$(TLPVER)|g"  -	-e "s|@TLP_SBIN@|$(TLP_SBIN)|g"  -	-e "s|@TLP_TLIB@|$(TLP_TLIB)|g"  -	-e "s|@TLP_FLIB@|$(TLP_FLIB)|g"  -	-e "s|@TLP_ULIB@|$(TLP_ULIB)|g"  -	-e "s|@TLP_BATD@|$(TLP_BATD)|g"  +	-e "s|@TLP_SBIN@|$(_SBIN)|g"  +	-e "s|@TLP_TLIB@|$(_TLIB)|g"  +	-e "s|@TLP_FLIB@|$(_FLIB)|g"  +	-e "s|@TLP_ULIB@|$(_ULIB)|g"  +	-e "s|@TLP_BATD@|$(_BATD)|g"  -e "s|@TLP_CONFUSR@|$(TLP_CONFUSR)|g"  -e "s|@TLP_CONFDIR@|$(TLP_CONFDIR)|g"  -	-e "s|@TLP_CONFDEF@|$(TLP_CONFDEF)|g"  -	-e "s|@TLP_CONFREN@|$(TLP_CONFREN)|g"  -	-e "s|@TLP_CONF@|$(TLP_CONF)|g"  +	-e "s|@TLP_CONFDEF@|$(_CONFDEF)|g"  +	-e "s|@TLP_CONFREN@|$(_CONFREN)|g"  +	-e "s|@TLP_CONF@|$(_CONF)|g"  -e "s|@TLP_RUN@|$(TLP_RUN)|g"    -e "s|@TLP_VAR@|$(TLP_VAR)|g"    -	-e "s|@TPACPIBAT@|$(TPACPIBAT)|g" +	-e "s|@TPACPIBAT@|$(_TPACPIBAT)|g" INFILES =  tlp  -- 2.33.0 </ins>

<ins> From a3506c9bc8929645b7b08859e47039b8cc830d22 Mon Sep 17 00:00:00 2001 From: Bernardo Meurer <bernardo@meurer.org> Date: Fri, 15 Oct 2021 23:07:40 -0700 Subject: [PATCH 2/2] tlp-sleep.service: reintroduce This patch reintroduces tlp-sleep as a systemd unit as opposed to a systemd system-sleep hook script. This is due to the recommendation by systemd itself to not use the hook scripts. As per the manual: > Note that scripts or binaries dropped in /usr/lib/systemd/system-sleep/ > are intended for local use only and should be considered hacks. If > applications want to react to system suspend/hibernation and resume, > they should rather use the Inhibitor interface[1]. --- Makefile             |  6 +++--- tlp-sleep            | 11 ----------- tlp-sleep.service.in | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 14 deletions(-) delete mode 100644 tlp-sleep create mode 100644 tlp-sleep.service.in diff --git a/Makefile b/Makefile index ab05720..075b42f 100644 --- a/Makefile +++ b/Makefile @@ -76,6 +76,7 @@ INFILES =  tlp.rules  tlp-readconfs  tlp-run-on  +	tlp-sleep.service  tlp.service  tlp-stat  tlp.upstart  @@ -106,7 +107,6 @@ SHFILES =  tlp-rdw-udev.in  tlp-rf.in  tlp-run-on.in  -	tlp-sleep  tlp-sleep.elogind  tlp-stat.in  tlp-usb-udev.in @@ -159,7 +159,7 @@ ifneq ($(TLP_NO_INIT),1) endif ifneq ($(TLP_WITH_SYSTEMD),0) install -D -m 644 tlp.service $(_SYSD)/tlp.service -	install -D -m 755 tlp-sleep $(_SDSL)/tlp +	install -D -m 644 tlp-sleep.service $(_SYSD)/tlp-sleep.service endif ifneq ($(TLP_WITH_ELOGIND),0) install -D -m 755 tlp-sleep.elogind $(_ELOD)/49-tlp-sleep @@ -216,7 +216,7 @@ uninstall-tlp: rm $(_ULIB)/rules.d/85-tlp.rules rm -f $(_SYSV)/tlp rm -f $(_SYSD)/tlp.service -	rm -f $(_SDSL)/tlp-sleep +	rm -f $(_SYSD)/tlp-sleep.service rm -f $(_ELOD)/49-tlp-sleep rm -f $(_SHCPL)/tlp-stat rm -f $(_SHCPL)/bluetooth diff --git a/tlp-sleep b/tlp-sleep deleted file mode 100644 index e548d55..0000000 --- a/tlp-sleep +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# tlp - systemd suspend/resume hook -# -# Copyright (c) 2021 Thomas Koch <linrunner at gmx.net> and others. -# This software is licensed under the GPL v2 or later. - -case $1 in -    pre)  tlp suspend ;; -    post) tlp resume  ;; -esac diff --git a/tlp-sleep.service.in b/tlp-sleep.service.in new file mode 100644 index 0000000..79c202c --- /dev/null +++ b/tlp-sleep.service.in @@ -0,0 +1,19 @@ +# tlp - systemd suspend/resume service +# +# Copyright (c) 2021 Thomas Koch <linrunner at gmx.net> and others. +# This software is licensed under the GPL v2 or later. + +[Unit] +Description=TLP suspend/resume +Before=sleep.target +StopWhenUnneeded=yes +Documentation=https://linrunner.de/tlp + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=@TLP_SBIN@/tlp suspend +ExecStop=@TLP_SBIN@/tlp resume + +[Install] +WantedBy=sleep.target -- 2.33.0 </ins>

<del> commit c44347b3b813e209fff537b4d46d23430727a5e2 Author: Bernardo Meurer <meurerbernardo@gmail.com> Date:   Tue Feb 25 21:27:39 2020 -0800 makefile: correctly sed paths The default Makefile for tlp makes a mess with catenating `DESTDIR` to everything, but then not actualy using the catenated (_ prefixed) variables to sed it's `.in` files. This patch makes sure that it correctly sets the paths, taking `DESTDIR` in account where it makes sense (e.g. /bin where we want $out/bin) but not where it doesn't (/etc/tlp.conf should be just that). The reason DESTDIR is used at all, as opposed to the more appropriate PREFIX, is covered in the nix formula, and is (also) due to the Makefile being a bit "different." diff --git a/Makefile b/Makefile index b5af74e..95122df 100644 --- a/Makefile +++ b/Makefile @@ -47,17 +47,17 @@ _TPACPIBAT = $(DESTDIR)$(TPACPIBAT) SED = sed  -e "s|@TLPVER@|$(TLPVER)|g"  -	-e "s|@TLP_SBIN@|$(TLP_SBIN)|g"  -	-e "s|@TLP_TLIB@|$(TLP_TLIB)|g"  -	-e "s|@TLP_FLIB@|$(TLP_FLIB)|g"  -	-e "s|@TLP_ULIB@|$(TLP_ULIB)|g"  +	-e "s|@TLP_SBIN@|$(_SBIN)|g"  +	-e "s|@TLP_TLIB@|$(_TLIB)|g"  +	-e "s|@TLP_FLIB@|$(_FLIB)|g"  +	-e "s|@TLP_ULIB@|$(_ULIB)|g"  -e "s|@TLP_CONFUSR@|$(TLP_CONFUSR)|g"  -e "s|@TLP_CONFDIR@|$(TLP_CONFDIR)|g"  -	-e "s|@TLP_CONFDEF@|$(TLP_CONFDEF)|g"  +	-e "s|@TLP_CONFDEF@|$(_CONFDEF)|g"  -e "s|@TLP_CONF@|$(TLP_CONF)|g"  -e "s|@TLP_RUN@|$(TLP_RUN)|g"    -e "s|@TLP_VAR@|$(TLP_VAR)|g"    -	-e "s|@TPACPIBAT@|$(TPACPIBAT)|g" +	-e "s|@TPACPIBAT@|$(_TPACPIBAT)|g" INFILES =  tlp  </del>

<del> commit ca94cd56210067e2a55c1f413bd7713f7d338f9f Author: Bernardo Meurer <meurerbernardo@gmail.com> Date:   Wed Feb 26 10:46:23 2020 -0800 tlp-sleep.service: reintroduce This patch reintroduces tlp-sleep as a systemd unit as opposed to a systemd system-sleep hook script. This is due to the recommendation by systemd itself to not use the hook scripts. As per the manual: > Note that scripts or binaries dropped in /usr/lib/systemd/system-sleep/ > are intended for local use only and should be considered hacks. If > applications want to react to system suspend/hibernation and resume, > they should rather use the Inhibitor interface[1]. diff --git a/Makefile b/Makefile index 95122df..0e9230a 100644 --- a/Makefile +++ b/Makefile @@ -70,6 +70,7 @@ INFILES =  tlp.rules  tlp-readconfs  tlp-run-on  +	tlp-sleep.service  tlp.service  tlp-stat  tlp.upstart  @@ -99,7 +100,6 @@ SHFILES =  tlp-rdw-udev.in  tlp-rf.in  tlp-run-on.in  -	tlp-sleep  tlp-sleep.elogind  tlp-stat.in  tlp-usb-udev.in @@ -147,7 +147,7 @@ ifneq ($(TLP_NO_INIT),1) endif ifneq ($(TLP_WITH_SYSTEMD),0) install -D -m 644 tlp.service $(_SYSD)/tlp.service -	install -D -m 755 tlp-sleep $(_SDSL)/tlp +	install -D -m 644 tlp-sleep.service $(_SYSD)/tlp-sleep.service endif ifneq ($(TLP_WITH_ELOGIND),0) install -D -m 755 tlp-sleep.elogind $(_ELOD)/49-tlp-sleep @@ -204,7 +204,7 @@ uninstall-tlp: rm $(_ULIB)/rules.d/85-tlp.rules rm -f $(_SYSV)/tlp rm -f $(_SYSD)/tlp.service -	rm -f $(_SDSL)/tlp-sleep +	rm -f $(_SYSD)/tlp-sleep.service rm -f $(_ELOD)/49-tlp-sleep rm -f $(_SHCPL)/tlp-stat rm -f $(_SHCPL)/bluetooth diff --git a/tlp-sleep b/tlp-sleep deleted file mode 100644 index 3de85ce..0000000 --- a/tlp-sleep +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# tlp - systemd suspend/resume hook -# -# Copyright (c) 2020 Thomas Koch <linrunner at gmx.net> and others. -# This software is licensed under the GPL v2 or later. - -case $1 in -    pre)  tlp suspend ;; -    post) tlp resume  ;; -esac diff --git a/tlp-sleep.service.in b/tlp-sleep.service.in new file mode 100644 index 0000000..4ac17bd --- /dev/null +++ b/tlp-sleep.service.in @@ -0,0 +1,19 @@ +# tlp - systemd suspend/resume service +# +# Copyright (c) 2020 Thomas Koch <linrunner at gmx.net> and others. +# This software is licensed under the GPL v2 or later. + +[Unit] +Description=TLP suspend/resume +Before=sleep.target +StopWhenUnneeded=yes +Documentation=https://linrunner.de/tlp + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=@TLP_SBIN@/tlp suspend +ExecStop=@TLP_SBIN@/tlp resume + +[Install] +WantedBy=sleep.target </del>