i3blocks: add optional dependencies for scripts

+68 -3
+28 -1
pkgs/applications/window-managers/i3/blocks-gaps.nix
··· 1 - { fetchFromGitHub, stdenv }: 1 + { fetchFromGitHub, stdenv, perl, makeWrapper 2 + , iproute, acpi, sysstat, alsaUtils 3 + , scripts ? [ "bandwidth" "battery" "cpu_usage" "disk" "iface" 4 + "load_average" "memory" "volume" "wifi" ] 5 + }: 6 + 7 + with stdenv.lib; 8 + 9 + let 10 + perlscripts = [ "battery" "cpu_usage" "openvpn" "temperature" ]; 11 + contains_any = l1: l2: 0 < length( intersectLists l1 l2 ); 2 12 13 + in 3 14 stdenv.mkDerivation rec { 4 15 name = "i3blocks-gaps-${version}"; 5 16 version = "1.4"; ··· 13 24 14 25 makeFlags = "all"; 15 26 installFlags = "PREFIX=\${out} VERSION=${version}"; 27 + 28 + buildInputs = optional (contains_any scripts perlscripts) perl; 29 + nativeBuildInputs = [ makeWrapper ]; 30 + 31 + postFixup = '' 32 + wrapProgram $out/libexec/i3blocks/bandwidth \ 33 + --prefix PATH : ${makeBinPath (optional (elem "bandwidth" scripts) iproute)} 34 + wrapProgram $out/libexec/i3blocks/battery \ 35 + --prefix PATH : ${makeBinPath (optional (elem "battery" scripts) acpi)} 36 + wrapProgram $out/libexec/i3blocks/cpu_usage \ 37 + --prefix PATH : ${makeBinPath (optional (elem "cpu_usage" scripts) sysstat)} 38 + wrapProgram $out/libexec/i3blocks/iface \ 39 + --prefix PATH : ${makeBinPath (optional (elem "iface" scripts) iproute)} 40 + wrapProgram $out/libexec/i3blocks/volume \ 41 + --prefix PATH : ${makeBinPath (optional (elem "volume" scripts) alsaUtils)} 42 + ''; 16 43 17 44 meta = with stdenv.lib; { 18 45 description = "A flexible scheduler for your i3bar blocks -- this is a fork to use with i3-gaps";
+40 -2
pkgs/applications/window-managers/i3/blocks.nix
··· 1 - { fetchurl, stdenv }: 1 + { fetchurl, stdenv, perl, makeWrapper 2 + , iproute, acpi, sysstat, xset, playerctl 3 + , cmus, openvpn, lm_sensors, alsaUtils 4 + , scripts ? [ "bandwidth" "battery" "cpu_usage" "disk" "iface" 5 + "keyindicator" "load_average" "mediaplayer" "memory" 6 + "openvpn" "temperature" "volume" "wifi" ] 7 + }: 8 + 9 + with stdenv.lib; 10 + 11 + let 12 + perlscripts = [ "battery" "cpu_usage" "keyindicator" 13 + "mediaplayer" "openvpn" "temperature" ]; 14 + contains_any = l1: l2: 0 < length( intersectLists l1 l2 ); 2 15 16 + in 3 17 stdenv.mkDerivation rec { 4 18 name = "i3blocks-${version}"; 5 19 version = "1.4"; ··· 12 26 buildFlags = "SYSCONFDIR=/etc all"; 13 27 installFlags = "PREFIX=\${out} VERSION=${version}"; 14 28 15 - meta = with stdenv.lib; { 29 + buildInputs = optional (contains_any scripts perlscripts) perl; 30 + nativeBuildInputs = [ makeWrapper ]; 31 + 32 + postFixup = '' 33 + wrapProgram $out/libexec/i3blocks/bandwidth \ 34 + --prefix PATH : ${makeBinPath (optional (elem "bandwidth" scripts) iproute)} 35 + wrapProgram $out/libexec/i3blocks/battery \ 36 + --prefix PATH : ${makeBinPath (optional (elem "battery" scripts) acpi)} 37 + wrapProgram $out/libexec/i3blocks/cpu_usage \ 38 + --prefix PATH : ${makeBinPath (optional (elem "cpu_usage" scripts) sysstat)} 39 + wrapProgram $out/libexec/i3blocks/iface \ 40 + --prefix PATH : ${makeBinPath (optional (elem "iface" scripts) iproute)} 41 + wrapProgram $out/libexec/i3blocks/keyindicator \ 42 + --prefix PATH : ${makeBinPath (optional (elem "keyindicator" scripts) xset)} 43 + wrapProgram $out/libexec/i3blocks/mediaplayer \ 44 + --prefix PATH : ${makeBinPath (optionals (elem "mediaplayer" scripts) [playerctl cmus])} 45 + wrapProgram $out/libexec/i3blocks/openvpn \ 46 + --prefix PATH : ${makeBinPath (optional (elem "openvpn" scripts) openvpn)} 47 + wrapProgram $out/libexec/i3blocks/temperature \ 48 + --prefix PATH : ${makeBinPath (optional (elem "temperature" scripts) lm_sensors)} 49 + wrapProgram $out/libexec/i3blocks/volume \ 50 + --prefix PATH : ${makeBinPath (optional (elem "volume" scripts) alsaUtils)} 51 + ''; 52 + 53 + meta = { 16 54 description = "A flexible scheduler for your i3bar blocks"; 17 55 homepage = https://github.com/vivien/i3blocks; 18 56 license = licenses.gpl3;