nixpkgs/pkgs/applications/misc/waybar/default.nix

102 lines
2.7 KiB
Nix
Raw Normal View History

2021-02-12 11:34:53 +00:00
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
2021-02-12 11:34:53 +00:00
, meson
, pkg-config
, ninja
, wrapGAppsHook
, wayland
, wlroots
, gtkmm3
, libsigcxx
, jsoncpp
, fmt
, scdoc
, spdlog
, gtk-layer-shell
, howard-hinnant-date, cmake
2019-01-26 15:43:16 +00:00
, traySupport ? true, libdbusmenu-gtk3
, pulseSupport ? true, libpulseaudio
2021-01-21 04:23:23 +00:00
, sndioSupport ? true, sndio
2019-01-26 15:43:16 +00:00
, nlSupport ? true, libnl
2019-03-26 15:37:24 +00:00
, udevSupport ? true, udev
2019-01-26 15:43:16 +00:00
, swaySupport ? true, sway
2021-02-12 11:34:53 +00:00
, mpdSupport ? true, libmpdclient
2020-04-18 18:40:29 +01:00
, withMediaPlayer ? false, glib, gobject-introspection, python3, python38Packages, playerctl
2019-01-26 15:43:16 +00:00
}:
2021-02-12 11:34:53 +00:00
stdenv.mkDerivation rec {
pname = "waybar";
version = "0.9.5";
2019-01-26 15:43:16 +00:00
2021-02-12 11:34:53 +00:00
src = fetchFromGitHub {
owner = "Alexays";
repo = "Waybar";
rev = version;
sha256 = "1kzrgqaclfk6gcwhknxn28xl74gm5swipgn8kk8avacb4nsw1l9q";
};
2020-04-18 18:40:29 +01:00
patches = [
# XXX: REMOVE ON NEXT VERSION BUMP
# Fixes compatibility of the bluetooth and network modules with linux kernel
# >=5.11
# c.f. https://github.com/Alexays/Waybar/issues/994
(fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/Alexays/Waybar/pull/1015.patch";
sha256 = "sha256-jQZEM3Yru2yxcXAzapU47DoAv4ZoabrV80dH42I2OFk=";
})
];
2021-02-12 11:34:53 +00:00
nativeBuildInputs = [
meson ninja pkg-config scdoc wrapGAppsHook cmake
] ++ lib.optional withMediaPlayer gobject-introspection;
2019-01-26 15:43:16 +00:00
2021-02-12 11:34:53 +00:00
propagatedBuildInputs = lib.optionals withMediaPlayer [
glib
playerctl
python38Packages.pygobject3
];
strictDeps = false;
2019-01-26 15:43:16 +00:00
2021-02-12 11:34:53 +00:00
buildInputs = with lib;
[ wayland wlroots gtkmm3 libsigcxx jsoncpp fmt spdlog gtk-layer-shell howard-hinnant-date ]
++ optional traySupport libdbusmenu-gtk3
++ optional pulseSupport libpulseaudio
++ optional sndioSupport sndio
++ optional nlSupport libnl
++ optional udevSupport udev
++ optional swaySupport sway
++ optional mpdSupport libmpdclient;
2019-01-26 15:43:16 +00:00
2021-02-12 11:34:53 +00:00
mesonFlags = (lib.mapAttrsToList
(option: enable: "-D${option}=${if enable then "enabled" else "disabled"}")
{
dbusmenu-gtk = traySupport;
pulseaudio = pulseSupport;
sndio = sndioSupport;
libnl = nlSupport;
libudev = udevSupport;
mpd = mpdSupport;
}
) ++ [
"-Dout=${placeholder "out"}"
"-Dsystemd=disabled"
];
preFixup = lib.optional withMediaPlayer ''
2020-04-18 18:40:29 +01:00
cp $src/resources/custom_modules/mediaplayer.py $out/bin/waybar-mediaplayer.py
wrapProgram $out/bin/waybar-mediaplayer.py \
--prefix PYTHONPATH : "$PYTHONPATH:$out/${python3.sitePackages}"
'';
2021-02-12 11:34:53 +00:00
meta = with lib; {
description = "Highly customizable Wayland bar for Sway and Wlroots based compositors";
license = licenses.mit;
2021-03-03 01:04:55 +00:00
maintainers = with maintainers; [ FlorianFranzen minijackson synthetica lovesegfault ];
2021-02-12 11:34:53 +00:00
platforms = platforms.unix;
homepage = "https://github.com/alexays/waybar";
};
}