1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
{ lib
, stdenv
, bash
, fetchFromGitHub
, fetchFromGitLab
, SDL2
, alsa-lib
, catch2_3
, fftw
, glib
, gobject-introspection
, gtk-layer-shell
, gtkmm3
, howard-hinnant-date
, hyprland
, iniparser
, jsoncpp
, libdbusmenu-gtk3
, libevdev
, libinotify-kqueue
, libinput
, libjack2
, libmpdclient
, libnl
, libpulseaudio
, libsigcxx
, libxkbcommon
, meson
, ncurses
, ninja
, pipewire
, pkg-config
, playerctl
, portaudio
, python3
, scdoc
, sndio
, spdlog
, sway
, udev
, upower
, wayland
, wireplumber
, wrapGAppsHook
, cavaSupport ? true
, evdevSupport ? true
, experimentalPatches ? true
, hyprlandSupport ? true
, inputSupport ? true
, jackSupport ? true
, mpdSupport ? true
, mprisSupport ? stdenv.isLinux
, nlSupport ? true
, pipewireSupport ? true
, pulseSupport ? true
, rfkillSupport ? true
, runTests ? true
, sndioSupport ? true
, swaySupport ? true
, traySupport ? true
, udevSupport ? true
, upowerSupport ? true
, wireplumberSupport ? true
, withMediaPlayer ? mprisSupport && false
, nix-update-script
}:
let
# Derived from subprojects/cava.wrap
libcava.src = fetchFromGitHub {
owner = "LukashonakV";
repo = "cava";
rev = "0.10.1";
hash = "sha256-iIYKvpOWafPJB5XhDOSIW9Mb4I3A4pcgIIPQdQYEqUw=";
};
wireplumber_0_4 = wireplumber.overrideAttrs (attrs: rec {
version = "0.4.17";
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "pipewire";
repo = "wireplumber";
rev = version;
hash = "sha256-vhpQT67+849WV1SFthQdUeFnYe/okudTQJoL3y+wXwI=";
};
});
in
stdenv.mkDerivation (finalAttrs: {
pname = "waybar";
version = "0.10.0";
src = fetchFromGitHub {
owner = "Alexays";
repo = "Waybar";
rev = finalAttrs.version;
hash = "sha256-p1VRrKT2kTDy48gDXPMHlLbfcokAOFeTZXGzTeO1SAE=";
};
postUnpack = lib.optional cavaSupport ''
pushd "$sourceRoot"
cp -R --no-preserve=mode,ownership ${libcava.src} subprojects/cava-0.10.1
patchShebangs .
popd
'';
nativeBuildInputs = [
meson
ninja
pkg-config
scdoc
wrapGAppsHook
] ++ lib.optional withMediaPlayer gobject-introspection;
propagatedBuildInputs = lib.optionals withMediaPlayer [
glib
playerctl
python3.pkgs.pygobject3
];
strictDeps = false;
buildInputs = [
gtk-layer-shell
gtkmm3
howard-hinnant-date
jsoncpp
libsigcxx
libxkbcommon
spdlog
wayland
]
++ lib.optionals cavaSupport [
SDL2
alsa-lib
fftw
iniparser
ncurses
portaudio
]
++ lib.optional evdevSupport libevdev
++ lib.optional hyprlandSupport hyprland
++ lib.optional inputSupport libinput
++ lib.optional jackSupport libjack2
++ lib.optional mpdSupport libmpdclient
++ lib.optional mprisSupport playerctl
++ lib.optional nlSupport libnl
++ lib.optional pulseSupport libpulseaudio
++ lib.optional sndioSupport sndio
++ lib.optional swaySupport sway
++ lib.optional traySupport libdbusmenu-gtk3
++ lib.optional udevSupport udev
++ lib.optional upowerSupport upower
++ lib.optional wireplumberSupport wireplumber_0_4
++ lib.optional (cavaSupport || pipewireSupport) pipewire
++ lib.optional (!stdenv.isLinux) libinotify-kqueue;
nativeCheckInputs = [ catch2_3 ];
doCheck = runTests;
mesonFlags = (lib.mapAttrsToList lib.mesonEnable {
"cava" = cavaSupport;
"dbusmenu-gtk" = traySupport;
"jack" = jackSupport;
"libinput" = inputSupport;
"libnl" = nlSupport;
"libudev" = udevSupport;
"man-pages" = true;
"mpd" = mpdSupport;
"mpris" = mprisSupport;
"pipewire" = pipewireSupport;
"pulseaudio" = pulseSupport;
"rfkill" = rfkillSupport;
"sndio" = sndioSupport;
"systemd" = false;
"tests" = runTests;
"upower_glib" = upowerSupport;
"wireplumber" = wireplumberSupport;
}) ++ lib.optional experimentalPatches (lib.mesonBool "experimental" true);
postPatch = ''
substituteInPlace include/util/command.hpp \
--replace-fail /bin/sh ${lib.getExe' bash "sh"}
'';
preFixup = lib.optionalString withMediaPlayer ''
cp $src/resources/custom_modules/mediaplayer.py $out/bin/waybar-mediaplayer.py
wrapProgram $out/bin/waybar-mediaplayer.py \
--prefix PYTHONPATH : "$PYTHONPATH:$out/${python3.sitePackages}"
'';
passthru.updateScript = nix-update-script { };
meta = {
homepage = "https://github.com/alexays/waybar";
description = "Highly customizable Wayland bar for Sway and Wlroots based compositors";
changelog = "https://github.com/alexays/waybar/releases/tag/${finalAttrs.version}";
license = lib.licenses.mit;
mainProgram = "waybar";
maintainers = with lib.maintainers; [
FlorianFranzen
lovesegfault
minijackson
rodrgz
synthetica
khaneliman
];
platforms = lib.platforms.linux;
};
})
|