mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-25 23:23:07 +00:00
4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
47 lines
1.5 KiB
Nix
47 lines
1.5 KiB
Nix
{ lib, stdenv, fetchgit, libX11, perl, ... }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "xbattbar";
|
|
version = "1.4.9";
|
|
|
|
# The current active upstream of xbattbar seems to be the Debian source
|
|
# repository.
|
|
src = fetchgit {
|
|
url = "https://salsa.debian.org/debian/xbattbar.git";
|
|
rev = "upstream/${version}";
|
|
sha256 = "10w7gs0l4hzhdn38yqyr3az7n4ncmfnd6hhhly6lk5dg7k441ck6";
|
|
};
|
|
|
|
buildInputs = [ libX11 ];
|
|
|
|
# The following patches are applied:
|
|
# - sys-by-default: remove the APM checker binary, make the sys checker
|
|
# script the default. Rationale: checking battery status by /proc/apm is
|
|
# extremely oldschool and does not work on NixOS, while the sysfs script
|
|
# does.
|
|
# - perl shebang patches for acpi/sys scripts
|
|
# - unhardcode path to checker scripts
|
|
patchPhase = ''
|
|
patch -p1 < ${./sys-by-default.patch}
|
|
sed -i -e "s,/usr/lib/xbattbar/,$out/libexec/," xbattbar.c
|
|
sed -i -e "s,/usr/bin/perl,${perl}/bin/perl," xbattbar-check-acpi
|
|
sed -i -e "s,/usr/bin/perl,${perl}/bin/perl," xbattbar-check-sys
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
mkdir -p $out/libexec
|
|
install -m 0755 xbattbar $out/bin/
|
|
install -m 0755 xbattbar-check-acpi $out/libexec/
|
|
install -m 0755 xbattbar-check-sys $out/libexec/
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Display battery status in X11";
|
|
homepage = "https://salsa.debian.org/debian/xbattbar";
|
|
license = licenses.gpl2Plus;
|
|
platforms = platforms.linux;
|
|
maintainers = [ maintainers.q3k ];
|
|
};
|
|
}
|