nixpkgs/pkgs/applications/window-managers/i3/blocks-gaps.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
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
2021-01-11 10:38:22 +01:00

52 lines
1.8 KiB
Nix

{ fetchFromGitHub, lib, stdenv, perl, makeWrapper
, iproute, acpi, sysstat, alsaUtils
, scripts ? [ "bandwidth" "battery" "cpu_usage" "disk" "iface"
"load_average" "memory" "volume" "wifi" ]
}:
with stdenv.lib;
let
perlscripts = [ "battery" "cpu_usage" "openvpn" "temperature" ];
contains_any = l1: l2: 0 < length( intersectLists l1 l2 );
in
stdenv.mkDerivation rec {
pname = "i3blocks-gaps";
version = "1.4";
src = fetchFromGitHub {
owner = "Airblader";
repo = "i3blocks-gaps";
rev = "4cfdf93c75f729a2c96d471004d31734e923812f";
sha256 = "0v9307ij8xzwdaxay3r75sd2cp453s3qb6q7dy9fks2p6wwqpazi";
};
makeFlags = [ "all" ];
installFlags = [ "PREFIX=\${out}" "VERSION=${version}" ];
buildInputs = optional (contains_any scripts perlscripts) perl;
nativeBuildInputs = [ makeWrapper ];
postFixup = ''
wrapProgram $out/libexec/i3blocks/bandwidth \
--prefix PATH : ${makeBinPath (optional (elem "bandwidth" scripts) iproute)}
wrapProgram $out/libexec/i3blocks/battery \
--prefix PATH : ${makeBinPath (optional (elem "battery" scripts) acpi)}
wrapProgram $out/libexec/i3blocks/cpu_usage \
--prefix PATH : ${makeBinPath (optional (elem "cpu_usage" scripts) sysstat)}
wrapProgram $out/libexec/i3blocks/iface \
--prefix PATH : ${makeBinPath (optional (elem "iface" scripts) iproute)}
wrapProgram $out/libexec/i3blocks/volume \
--prefix PATH : ${makeBinPath (optional (elem "volume" scripts) alsaUtils)}
'';
meta = with lib; {
description = "A flexible scheduler for your i3bar blocks -- this is a fork to use with i3-gaps";
homepage = "https://github.com/Airblader/i3blocks-gaps";
license = licenses.gpl3;
maintainers = with maintainers; [ carlsverre ];
platforms = platforms.linux;
};
}