12 gobject-introspection,
50 enableManpages ? stdenv.buildPlatform.canExecute stdenv.hostPlatform,
52 experimentalPatches ? true,
53 hyprlandSupport ? true,
57 mprisSupport ? stdenv.hostPlatform.isLinux,
59 pipewireSupport ? true,
62 runTests ? stdenv.buildPlatform.canExecute stdenv.hostPlatform,
64 systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemdMinimal,
69 wireplumberSupport ? true,
70 withMediaPlayer ? mprisSupport && false,
77 # Derived from subprojects/cava.wrap
78 libcava.src = fetchFromGitHub {
79 owner = "LukashonakV";
82 hash = "sha256-ZDFbI69ECsUTjbhlw2kHRufZbQMu+FQSMmncCJ5pagg=";
85 stdenv.mkDerivation (finalAttrs: {
89 src = fetchFromGitHub {
92 rev = "refs/tags/${finalAttrs.version}";
93 hash = "sha256-3lc0voMU5RS+mEtxKuRayq/uJO09X7byq6Rm5NZohq8=";
97 # Fix a regression introduced in release 0.11.0
98 # TODO: remove this patch when updating to the next release
99 # Issue: https://github.com/Alexays/Waybar/issues/3597
100 # PR: https://github.com/Alexays/Waybar/pull/3604
103 url = "https://github.com/Alexays/Waybar/commit/0d02f6877d88551ea2be0cd151c1e6354e208b1c.patch";
104 hash = "sha256-wpdK6AY+14jt85dOQy6xkh8tNGDN2F9GA9zOfAuOaIc=";
108 postUnpack = lib.optional cavaSupport ''
110 cp -R --no-preserve=mode,ownership ${libcava.src} subprojects/cava-0.10.2
115 nativeBuildInputs = [
121 ] ++ lib.optional withMediaPlayer gobject-introspection ++ lib.optional enableManpages scdoc;
123 propagatedBuildInputs = lib.optionals withMediaPlayer [
126 python3.pkgs.pygobject3
140 ++ lib.optionals cavaSupport [
148 ++ lib.optional evdevSupport libevdev
149 ++ lib.optional hyprlandSupport hyprland
150 ++ lib.optional inputSupport libinput
151 ++ lib.optional jackSupport libjack2
152 ++ lib.optional mpdSupport libmpdclient
153 ++ lib.optional mprisSupport playerctl
154 ++ lib.optional nlSupport libnl
155 ++ lib.optional pulseSupport libpulseaudio
156 ++ lib.optional sndioSupport sndio
157 ++ lib.optional swaySupport sway
158 ++ lib.optional systemdSupport systemdMinimal
159 ++ lib.optional traySupport libdbusmenu-gtk3
160 ++ lib.optional udevSupport udev
161 ++ lib.optional upowerSupport upower
162 ++ lib.optional wireplumberSupport wireplumber
163 ++ lib.optional (cavaSupport || pipewireSupport) pipewire
164 ++ lib.optional (!stdenv.hostPlatform.isLinux) libinotify-kqueue;
166 nativeCheckInputs = [ catch2_3 ];
170 (lib.mapAttrsToList lib.mesonEnable {
171 "cava" = cavaSupport && lib.asserts.assertMsg sndioSupport "Sndio support is required for Cava";
172 "dbusmenu-gtk" = traySupport;
173 "jack" = jackSupport;
174 "libevdev" = evdevSupport;
175 "libinput" = inputSupport;
177 "libudev" = udevSupport;
178 "man-pages" = enableManpages;
180 "mpris" = mprisSupport;
181 "pipewire" = pipewireSupport;
182 "pulseaudio" = pulseSupport;
183 "rfkill" = rfkillSupport;
184 "sndio" = sndioSupport;
185 "systemd" = systemdSupport;
187 "upower_glib" = upowerSupport;
188 "wireplumber" = wireplumberSupport;
190 ++ lib.optional experimentalPatches (lib.mesonBool "experimental" true);
192 env = lib.optionalAttrs systemdSupport {
193 PKG_CONFIG_SYSTEMD_SYSTEMDUSERUNITDIR = "${placeholder "out"}/lib/systemd/user";
197 substituteInPlace include/util/command.hpp \
198 --replace-fail /bin/sh ${lib.getExe' bash "sh"}
201 preFixup = lib.optionalString withMediaPlayer ''
202 cp $src/resources/custom_modules/mediaplayer.py $out/bin/waybar-mediaplayer.py
204 wrapProgram $out/bin/waybar-mediaplayer.py \
205 --prefix PYTHONPATH : "$PYTHONPATH:$out/${python3.sitePackages}"
209 updateScript = nix-update-script { };
210 tests.version = testers.testVersion {
212 version = "v${finalAttrs.version}";
217 homepage = "https://github.com/alexays/waybar";
218 description = "Highly customizable Wayland bar for Sway and Wlroots based compositors";
219 changelog = "https://github.com/alexays/waybar/releases/tag/${finalAttrs.version}";
220 license = lib.licenses.mit;
221 mainProgram = "waybar";
222 maintainers = with lib.maintainers; [
230 platforms = lib.platforms.linux;