summary refs log tree commit diff
path: root/pkgs/os-specific/linux/tpacpi-bat
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/linux/tpacpi-bat')
-rw-r--r--pkgs/os-specific/linux/tpacpi-bat/default.nix34
1 files changed, 34 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/tpacpi-bat/default.nix b/pkgs/os-specific/linux/tpacpi-bat/default.nix
new file mode 100644
index 00000000000..5512eed63ab
--- /dev/null
+++ b/pkgs/os-specific/linux/tpacpi-bat/default.nix
@@ -0,0 +1,34 @@
+{ lib, stdenv, fetchFromGitHub, perl, kmod, coreutils }:
+
+# Requires the acpi_call kernel module in order to run.
+stdenv.mkDerivation rec {
+  pname = "tpacpi-bat";
+  version = "3.1";
+
+  src = fetchFromGitHub {
+    owner = "teleshoes";
+    repo = "tpacpi-bat";
+    rev = "v${version}";
+    sha256 = "0wbaz34z99gqx721alh5vmpxpj2yxg3x9m8jqyivfi1wfpwc2nd5";
+  };
+
+  buildInputs = [ perl ];
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp tpacpi-bat $out/bin
+  '';
+
+  postPatch = ''
+    substituteInPlace tpacpi-bat \
+      --replace modprobe ${kmod}/bin/modprobe \
+      --replace cat ${coreutils}/bin/cat
+  '';
+
+  meta = {
+    maintainers = [lib.maintainers.orbekk];
+    platforms = lib.platforms.linux;
+    description = "Tool to set battery charging thesholds on Lenovo Thinkpad";
+    license = lib.licenses.gpl3Plus;
+  };
+}