tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
i3blocks: add optional dependencies for scripts
Angelo Bulfone
8 years ago
4642e8d1
4e88e82e
+68
-3
2 changed files
expand all
collapse all
unified
split
pkgs
applications
window-managers
i3
blocks-gaps.nix
blocks.nix
+28
-1
pkgs/applications/window-managers/i3/blocks-gaps.nix
···
1
1
-
{ fetchFromGitHub, stdenv }:
1
1
+
{ fetchFromGitHub, stdenv, perl, makeWrapper
2
2
+
, iproute, acpi, sysstat, alsaUtils
3
3
+
, scripts ? [ "bandwidth" "battery" "cpu_usage" "disk" "iface"
4
4
+
"load_average" "memory" "volume" "wifi" ]
5
5
+
}:
6
6
+
7
7
+
with stdenv.lib;
8
8
+
9
9
+
let
10
10
+
perlscripts = [ "battery" "cpu_usage" "openvpn" "temperature" ];
11
11
+
contains_any = l1: l2: 0 < length( intersectLists l1 l2 );
2
12
13
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
27
+
28
28
+
buildInputs = optional (contains_any scripts perlscripts) perl;
29
29
+
nativeBuildInputs = [ makeWrapper ];
30
30
+
31
31
+
postFixup = ''
32
32
+
wrapProgram $out/libexec/i3blocks/bandwidth \
33
33
+
--prefix PATH : ${makeBinPath (optional (elem "bandwidth" scripts) iproute)}
34
34
+
wrapProgram $out/libexec/i3blocks/battery \
35
35
+
--prefix PATH : ${makeBinPath (optional (elem "battery" scripts) acpi)}
36
36
+
wrapProgram $out/libexec/i3blocks/cpu_usage \
37
37
+
--prefix PATH : ${makeBinPath (optional (elem "cpu_usage" scripts) sysstat)}
38
38
+
wrapProgram $out/libexec/i3blocks/iface \
39
39
+
--prefix PATH : ${makeBinPath (optional (elem "iface" scripts) iproute)}
40
40
+
wrapProgram $out/libexec/i3blocks/volume \
41
41
+
--prefix PATH : ${makeBinPath (optional (elem "volume" scripts) alsaUtils)}
42
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
1
-
{ fetchurl, stdenv }:
1
1
+
{ fetchurl, stdenv, perl, makeWrapper
2
2
+
, iproute, acpi, sysstat, xset, playerctl
3
3
+
, cmus, openvpn, lm_sensors, alsaUtils
4
4
+
, scripts ? [ "bandwidth" "battery" "cpu_usage" "disk" "iface"
5
5
+
"keyindicator" "load_average" "mediaplayer" "memory"
6
6
+
"openvpn" "temperature" "volume" "wifi" ]
7
7
+
}:
8
8
+
9
9
+
with stdenv.lib;
10
10
+
11
11
+
let
12
12
+
perlscripts = [ "battery" "cpu_usage" "keyindicator"
13
13
+
"mediaplayer" "openvpn" "temperature" ];
14
14
+
contains_any = l1: l2: 0 < length( intersectLists l1 l2 );
2
15
16
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
15
-
meta = with stdenv.lib; {
29
29
+
buildInputs = optional (contains_any scripts perlscripts) perl;
30
30
+
nativeBuildInputs = [ makeWrapper ];
31
31
+
32
32
+
postFixup = ''
33
33
+
wrapProgram $out/libexec/i3blocks/bandwidth \
34
34
+
--prefix PATH : ${makeBinPath (optional (elem "bandwidth" scripts) iproute)}
35
35
+
wrapProgram $out/libexec/i3blocks/battery \
36
36
+
--prefix PATH : ${makeBinPath (optional (elem "battery" scripts) acpi)}
37
37
+
wrapProgram $out/libexec/i3blocks/cpu_usage \
38
38
+
--prefix PATH : ${makeBinPath (optional (elem "cpu_usage" scripts) sysstat)}
39
39
+
wrapProgram $out/libexec/i3blocks/iface \
40
40
+
--prefix PATH : ${makeBinPath (optional (elem "iface" scripts) iproute)}
41
41
+
wrapProgram $out/libexec/i3blocks/keyindicator \
42
42
+
--prefix PATH : ${makeBinPath (optional (elem "keyindicator" scripts) xset)}
43
43
+
wrapProgram $out/libexec/i3blocks/mediaplayer \
44
44
+
--prefix PATH : ${makeBinPath (optionals (elem "mediaplayer" scripts) [playerctl cmus])}
45
45
+
wrapProgram $out/libexec/i3blocks/openvpn \
46
46
+
--prefix PATH : ${makeBinPath (optional (elem "openvpn" scripts) openvpn)}
47
47
+
wrapProgram $out/libexec/i3blocks/temperature \
48
48
+
--prefix PATH : ${makeBinPath (optional (elem "temperature" scripts) lm_sensors)}
49
49
+
wrapProgram $out/libexec/i3blocks/volume \
50
50
+
--prefix PATH : ${makeBinPath (optional (elem "volume" scripts) alsaUtils)}
51
51
+
'';
52
52
+
53
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;