21 , x86_energy_perf_policy
22 # RDW only works with NetworkManager, and thus is optional with default off
25 }: stdenv.mkDerivation rec {
29 src = fetchFromGitHub {
33 hash = "sha256-kjtszDLlnIkBi3yU/AyGSV8q7QBuZbDhsqJ8AvULb0M=";
36 # XXX: See patch files for relevant explanations.
38 ./patches/0001-makefile-correctly-sed-paths.patch
39 ./patches/0002-reintroduce-tlp-sleep-service.patch
43 substituteInPlace Makefile --replace-fail ' ?= /usr/' ' ?= /'
46 buildInputs = [ perl ];
47 nativeBuildInputs = [ makeWrapper ];
49 # XXX: While [1] states that DESTDIR should not be used, and that the correct
50 # variable to set is, in fact, PREFIX, tlp thinks otherwise. The Makefile for
51 # tlp concerns itself only with DESTDIR [2] (possibly incorrectly) and so we set
52 # that as opposed to PREFIX, despite what [1] says.
54 # [1]: https://github.com/NixOS/nixpkgs/issues/65718
55 # [2]: https://github.com/linrunner/TLP/blob/ab788abf4936dfb44fbb408afc34af834230a64d/Makefile#L4-L46
61 "DESTDIR=${placeholder "out"}"
64 installTargets = [ "install-tlp" "install-man" ]
65 ++ lib.optionals enableRDW [ "install-rdw" "install-man-rdw" ];
68 nativeCheckInputs = [ checkbashisms perlcritic shellcheck ];
69 checkTarget = [ "checkall" ];
71 # TODO: Consider using resholve here
73 paths = lib.makeBinPath (
88 ] ++ lib.optional enableRDW networkmanager
89 ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform x86_energy_perf_policy) x86_energy_perf_policy
94 $out/share/tlp/tlp-pcilist
95 $out/share/tlp/tlp-readconfs
96 $out/share/tlp/tlp-usblist
98 for f in "''${fixup_perl[@]}"; do
99 wrapProgram "$f" --prefix PATH : "${paths}"
104 $out/etc/NetworkManager/dispatcher.d/*
107 $out/share/tlp/bat.d/*
108 $out/share/tlp/func.d/*
109 $out/share/tlp/tlp-func-base
111 for f in "''${fixup_bash[@]}"; do
112 sed -i '2iexport PATH=${paths}:$PATH' "$f"
116 rm -rf $out/share/metainfo
120 description = "Advanced Power Management for Linux";
122 "https://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html";
123 changelog = "https://github.com/linrunner/TLP/releases/tag/${version}";
124 platforms = platforms.linux;
126 maintainers = with maintainers; [ abbradar lovesegfault ];
127 license = licenses.gpl2Plus;