2017-05-30 19:30:41 +01:00
|
|
|
{ fetchurl, stdenv, perl, makeWrapper
|
|
|
|
, iproute, acpi, sysstat, xset, playerctl
|
|
|
|
, cmus, openvpn, lm_sensors, alsaUtils
|
|
|
|
, scripts ? [ "bandwidth" "battery" "cpu_usage" "disk" "iface"
|
|
|
|
"keyindicator" "load_average" "mediaplayer" "memory"
|
|
|
|
"openvpn" "temperature" "volume" "wifi" ]
|
|
|
|
}:
|
2015-12-11 06:55:00 +00:00
|
|
|
|
2017-05-30 19:30:41 +01:00
|
|
|
with stdenv.lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
perlscripts = [ "battery" "cpu_usage" "keyindicator"
|
|
|
|
"mediaplayer" "openvpn" "temperature" ];
|
|
|
|
contains_any = l1: l2: 0 < length( intersectLists l1 l2 );
|
|
|
|
|
|
|
|
in
|
2015-12-11 06:55:00 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "i3blocks-${version}";
|
|
|
|
version = "1.4";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/vivien/i3blocks/releases/download/${version}/${name}.tar.gz";
|
|
|
|
sha256 = "c64720057e22cc7cac5e8fcd58fd37e75be3a7d5a3cb8995841a7f18d30c0536";
|
|
|
|
};
|
|
|
|
|
2017-01-12 20:15:15 +00:00
|
|
|
buildFlags = "SYSCONFDIR=/etc all";
|
2015-12-11 06:55:00 +00:00
|
|
|
installFlags = "PREFIX=\${out} VERSION=${version}";
|
|
|
|
|
2017-05-30 19:30:41 +01:00
|
|
|
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/keyindicator \
|
|
|
|
--prefix PATH : ${makeBinPath (optional (elem "keyindicator" scripts) xset)}
|
|
|
|
wrapProgram $out/libexec/i3blocks/mediaplayer \
|
|
|
|
--prefix PATH : ${makeBinPath (optionals (elem "mediaplayer" scripts) [playerctl cmus])}
|
|
|
|
wrapProgram $out/libexec/i3blocks/openvpn \
|
|
|
|
--prefix PATH : ${makeBinPath (optional (elem "openvpn" scripts) openvpn)}
|
|
|
|
wrapProgram $out/libexec/i3blocks/temperature \
|
|
|
|
--prefix PATH : ${makeBinPath (optional (elem "temperature" scripts) lm_sensors)}
|
|
|
|
wrapProgram $out/libexec/i3blocks/volume \
|
|
|
|
--prefix PATH : ${makeBinPath (optional (elem "volume" scripts) alsaUtils)}
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
2016-02-27 17:24:00 +00:00
|
|
|
description = "A flexible scheduler for your i3bar blocks";
|
2015-12-11 06:55:00 +00:00
|
|
|
homepage = https://github.com/vivien/i3blocks;
|
|
|
|
license = licenses.gpl3;
|
2017-01-13 18:09:28 +00:00
|
|
|
platforms = with platforms; freebsd ++ linux;
|
2015-12-11 06:55:00 +00:00
|
|
|
};
|
|
|
|
}
|