1 { lib, stdenv, fetchgit, libX11, perl, ... }:
3 stdenv.mkDerivation rec {
7 # The current active upstream of xbattbar seems to be the Debian source
10 url = "https://salsa.debian.org/debian/xbattbar.git";
11 rev = "upstream/${version}";
12 sha256 = "10w7gs0l4hzhdn38yqyr3az7n4ncmfnd6hhhly6lk5dg7k441ck6";
15 buildInputs = [ libX11 ];
17 # The following patches are applied:
18 # - sys-by-default: remove the APM checker binary, make the sys checker
19 # script the default. Rationale: checking battery status by /proc/apm is
20 # extremely oldschool and does not work on NixOS, while the sysfs script
22 # - perl shebang patches for acpi/sys scripts
23 # - unhardcode path to checker scripts
25 patch -p1 < ${./sys-by-default.patch}
26 sed -i -e "s,/usr/lib/xbattbar/,$out/libexec/," xbattbar.c
27 sed -i -e "s,/usr/bin/perl,${perl}/bin/perl," xbattbar-check-acpi
28 sed -i -e "s,/usr/bin/perl,${perl}/bin/perl," xbattbar-check-sys
34 install -m 0755 xbattbar $out/bin/
35 install -m 0755 xbattbar-check-acpi $out/libexec/
36 install -m 0755 xbattbar-check-sys $out/libexec/
40 description = "Display battery status in X11";
41 homepage = "https://salsa.debian.org/debian/xbattbar";
42 license = licenses.gpl2Plus;
43 platforms = platforms.linux;
44 maintainers = [ maintainers.q3k ];
45 mainProgram = "xbattbar";