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

117 lines
2.5 KiB
Nix
Raw Normal View History

{ config
, cairo
2021-02-12 11:34:35 +00:00
, cmake
, fetchFromGitHub
, libXdmcp
, libpthreadstubs
, libxcb
, pcre
, pkg-config
, python3
2021-04-21 04:10:35 +01:00
, python3Packages # sphinx-build
2021-02-12 11:34:35 +00:00
, lib
, stdenv
, xcbproto
, xcbutil
, xcbutilcursor
, xcbutilimage
, xcbutilrenderutil
, xcbutilwm
, xcbutilxrm
, makeWrapper
, removeReferencesTo
, alsa-lib
2021-04-21 04:22:25 +01:00
, curl
, libmpdclient
, libpulseaudio
, wirelesstools
, libnl
, i3
, i3-gaps
, jsoncpp
2021-07-13 20:16:20 +01:00
# override the variables ending in 'Support' to enable or disable modules
, alsaSupport ? true
2021-04-21 04:22:25 +01:00
, githubSupport ? false
2021-07-13 20:16:20 +01:00
, mpdSupport ? false
, pulseSupport ? config.pulseaudio or false
, iwSupport ? false
, nlSupport ? true
, i3Support ? false
2021-04-21 04:22:25 +01:00
, i3GapsSupport ? false
}:
stdenv.mkDerivation rec {
2021-07-13 20:16:20 +01:00
pname = "polybar";
2021-10-02 16:49:12 +01:00
version = "3.5.7";
2019-04-14 17:26:31 +01:00
2021-07-13 20:16:20 +01:00
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = version;
2021-10-02 16:49:12 +01:00
sha256 = "sha256-h12VW3IY4do4cKz2Fd/QgVTBk+zJO+qXuRUCQUyO/x0=";
2021-07-13 20:16:20 +01:00
fetchSubmodules = true;
};
2021-07-13 20:16:20 +01:00
nativeBuildInputs = [
cmake
pkg-config
python3Packages.sphinx
removeReferencesTo
] ++ lib.optional (i3Support || i3GapsSupport) makeWrapper;
2021-04-21 04:10:35 +01:00
2021-07-13 20:16:20 +01:00
buildInputs = [
cairo
libXdmcp
libpthreadstubs
libxcb
pcre
python3
xcbproto
xcbutil
xcbutilcursor
xcbutilimage
xcbutilrenderutil
xcbutilwm
xcbutilxrm
] ++ lib.optional alsaSupport alsa-lib
++ lib.optional githubSupport curl
++ lib.optional mpdSupport libmpdclient
++ lib.optional pulseSupport libpulseaudio
++ lib.optional iwSupport wirelesstools
++ lib.optional nlSupport libnl
++ lib.optional (i3Support || i3GapsSupport) jsoncpp
++ lib.optional i3Support i3
++ lib.optional i3GapsSupport i3-gaps;
2021-07-13 20:16:20 +01:00
postInstall =
if i3Support then ''
wrapProgram $out/bin/polybar \
--prefix PATH : "${i3}/bin"
''
else if i3GapsSupport
then ''
wrapProgram $out/bin/polybar \
--prefix PATH : "${i3-gaps}/bin"
''
else "";
2018-05-07 00:39:32 +01:00
2021-07-13 20:16:20 +01:00
postFixup = ''
remove-references-to -t ${stdenv.cc} $out/bin/polybar
'';
2021-02-12 11:34:35 +00:00
2021-07-13 20:16:20 +01:00
meta = with lib; {
homepage = "https://polybar.github.io/";
changelog = "https://github.com/polybar/polybar/releases/tag/${version}";
description = "A fast and easy-to-use tool for creating status bars";
longDescription = ''
Polybar aims to help users build beautiful and highly customizable
status bars for their desktop environment, without the need of
having a black belt in shell scripting.
'';
license = licenses.mit;
maintainers = with maintainers; [ afldcr Br1ght0ne fortuneteller2k ];
platforms = platforms.linux;
};
}