2021-01-15 22:18:51 +00:00
|
|
|
{ fetchFromGitHub, lib, stdenv, perl, makeWrapper
|
2021-06-28 23:13:55 +00:00
|
|
|
, iproute2, acpi, sysstat, alsa-utils
|
2020-04-24 23:36:52 +00:00
|
|
|
, scripts ? [ "bandwidth" "battery" "cpu_usage" "disk" "iface"
|
|
|
|
"load_average" "memory" "volume" "wifi" ]
|
|
|
|
}:
|
|
|
|
|
2021-01-17 00:15:33 +00:00
|
|
|
with lib;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
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 ];
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
postFixup = optionalString (elem "bandwidth" scripts) ''
|
2020-04-24 23:36:52 +00:00
|
|
|
wrapProgram $out/libexec/i3blocks/bandwidth \
|
2022-05-18 14:49:53 +00:00
|
|
|
--prefix PATH : ${makeBinPath [ iproute2 ]}
|
|
|
|
'' + optionalString (elem "battery" scripts) ''
|
2020-04-24 23:36:52 +00:00
|
|
|
wrapProgram $out/libexec/i3blocks/battery \
|
2022-05-18 14:49:53 +00:00
|
|
|
--prefix PATH : ${makeBinPath [ acpi ]}
|
|
|
|
'' + optionalString (elem "cpu_usage" scripts) ''
|
2020-04-24 23:36:52 +00:00
|
|
|
wrapProgram $out/libexec/i3blocks/cpu_usage \
|
2022-05-18 14:49:53 +00:00
|
|
|
--prefix PATH : ${makeBinPath [ sysstat ]}
|
|
|
|
'' + optionalString (elem "iface" scripts) ''
|
2020-04-24 23:36:52 +00:00
|
|
|
wrapProgram $out/libexec/i3blocks/iface \
|
2022-05-18 14:49:53 +00:00
|
|
|
--prefix PATH : ${makeBinPath [ iproute2 ]}
|
|
|
|
'' + optionalString (elem "volume" scripts) ''
|
2020-04-24 23:36:52 +00:00
|
|
|
wrapProgram $out/libexec/i3blocks/volume \
|
2022-05-18 14:49:53 +00:00
|
|
|
--prefix PATH : ${makeBinPath [ alsa-utils ]}
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Flexible scheduler for your i3bar blocks -- this is a fork to use with i3-gaps";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "i3blocks";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/Airblader/i3blocks-gaps";
|
|
|
|
license = licenses.gpl3;
|
|
|
|
maintainers = with maintainers; [ carlsverre ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|