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 sha256 = "sha256-hHel3BVMzTYfE59kxxADnm8tqtUFntqS3RzmJSZlWjM=";
36 # XXX: See patch files for relevant explanations.
38 ./patches/0001-makefile-correctly-sed-paths.patch
39 ./patches/0002-reintroduce-tlp-sleep-service.patch
42 buildInputs = [ perl ];
43 nativeBuildInputs = [ makeWrapper ];
45 # XXX: While [1] states that DESTDIR should not be used, and that the correct
46 # variable to set is, in fact, PREFIX, tlp thinks otherwise. The Makefile for
47 # tlp concerns itself only with DESTDIR [2] (possibly incorrectly) and so we set
48 # that as opposed to PREFIX, despite what [1] says.
50 # [1]: https://github.com/NixOS/nixpkgs/issues/65718
51 # [2]: https://github.com/linrunner/TLP/blob/ab788abf4936dfb44fbb408afc34af834230a64d/Makefile#L4-L46
57 "DESTDIR=${placeholder "out"}"
58 "TLP_BATD=/share/tlp/bat.d"
60 "TLP_CONFDEF=/share/tlp/defaults.conf"
61 "TLP_CONFREN=/share/tlp/rename.conf"
62 "TLP_FLIB=/share/tlp/func.d"
64 "TLP_META=/share/metainfo"
66 "TLP_SHCPL=/share/bash-completion/completions"
70 installTargets = [ "install-tlp" "install-man" ]
71 ++ lib.optionals enableRDW [ "install-rdw" "install-man-rdw" ];
74 checkInputs = [ checkbashisms perlcritic shellcheck ];
75 checkTarget = [ "checkall" ];
77 # TODO: Consider using resholve here
79 paths = lib.makeBinPath (
94 ] ++ lib.optional enableRDW networkmanager
95 ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform x86_energy_perf_policy) x86_energy_perf_policy
100 $out/share/tlp/tlp-pcilist
101 $out/share/tlp/tlp-readconfs
102 $out/share/tlp/tlp-usblist
103 $out/share/tlp/tpacpi-bat
105 for f in "''${fixup_perl[@]}"; do
106 wrapProgram "$f" --prefix PATH : "${paths}"
111 $out/etc/NetworkManager/dispatcher.d/*
114 $out/share/tlp/bat.d/*
115 $out/share/tlp/func.d/*
116 $out/share/tlp/tlp-func-base
118 for f in "''${fixup_bash[@]}"; do
119 sed -i '2iexport PATH=${paths}:$PATH' "$f"
123 rm -rf $out/share/metainfo
127 description = "Advanced Power Management for Linux";
129 "https://linrunner.de/en/tlp/docs/tlp-linux-advanced-power-management.html";
130 platforms = platforms.linux;
131 maintainers = with maintainers; [ abbradar lovesegfault ];
132 license = licenses.gpl2Plus;