nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 config,
3 cairo,
4 cmake,
5 fetchFromGitHub,
6 fetchpatch,
7 libuv,
8 libXdmcp,
9 libpthreadstubs,
10 libxcb,
11 pcre,
12 pkg-config,
13 python3,
14 python3Packages, # sphinx-build
15 lib,
16 stdenv,
17 xcbproto,
18 xcbutil,
19 xcbutilcursor,
20 xcbutilimage,
21 xcbutilrenderutil,
22 xcbutilwm,
23 xcbutilxrm,
24 makeWrapper,
25 removeReferencesTo,
26 alsa-lib,
27 curl,
28 libmpdclient,
29 libpulseaudio,
30 wirelesstools,
31 libnl,
32 i3,
33 jsoncpp,
34
35 # override the variables ending in 'Support' to enable or disable modules
36 alsaSupport ? true,
37 githubSupport ? false,
38 mpdSupport ? false,
39 pulseSupport ? config.pulseaudio or false,
40 iwSupport ? false,
41 nlSupport ? true,
42 i3Support ? false,
43}:
44
45stdenv.mkDerivation (finalAttrs: {
46 pname = "polybar";
47 version = "3.7.2";
48
49 src = fetchFromGitHub {
50 owner = "polybar";
51 repo = "polybar";
52 tag = finalAttrs.version;
53 hash = "sha256-5PYKl6Hi4EYEmUBwkV0rLiwxNqIyR5jwm495YnNs0gI=";
54 fetchSubmodules = true;
55 };
56
57 nativeBuildInputs = [
58 cmake
59 pkg-config
60 python3Packages.sphinx
61 removeReferencesTo
62 ]
63 ++ lib.optional i3Support makeWrapper;
64
65 buildInputs = [
66 cairo
67 libuv
68 libXdmcp
69 libpthreadstubs
70 libxcb
71 pcre
72 python3
73 xcbproto
74 xcbutil
75 xcbutilcursor
76 xcbutilimage
77 xcbutilrenderutil
78 xcbutilwm
79 xcbutilxrm
80 ]
81 ++ lib.optional alsaSupport alsa-lib
82 ++ lib.optional githubSupport curl
83 ++ lib.optional mpdSupport libmpdclient
84 ++ lib.optional pulseSupport libpulseaudio
85 ++ lib.optional iwSupport wirelesstools
86 ++ lib.optional nlSupport libnl
87 ++ lib.optionals i3Support [
88 jsoncpp
89 i3
90 ];
91
92 patches = [
93 # FIXME: remove after version update
94 (fetchpatch {
95 name = "gcc15-cstdint-fix.patch";
96 url = "https://github.com/polybar/polybar/commit/f99e0b1c7a5b094f5a04b14101899d0cb4ece69d.patch";
97 sha256 = "sha256-Mf9R4u1Kq4yqLqTFD5ZoLjrK+GmlvtSsEyRFRCiQ72U=";
98 })
99
100 ./remove-hardcoded-etc.diff
101 ];
102
103 # Replace hardcoded /etc when copying and reading the default config.
104 postPatch = ''
105 substituteInPlace CMakeLists.txt --replace "/etc" $out
106 substituteAllInPlace src/utils/file.cpp
107 '';
108
109 postInstall = ''
110 remove-references-to -t ${stdenv.cc} $out/bin/polybar
111 ''
112 + (lib.optionalString i3Support ''
113 wrapProgram $out/bin/polybar \
114 --prefix PATH : "${i3}/bin"
115 '');
116
117 meta = {
118 homepage = "https://polybar.github.io/";
119 changelog = "https://github.com/polybar/polybar/releases/tag/${finalAttrs.version}";
120 description = "Fast and easy-to-use tool for creating status bars";
121 longDescription = ''
122 Polybar aims to help users build beautiful and highly customizable
123 status bars for their desktop environment, without the need of
124 having a black belt in shell scripting.
125 '';
126 license = lib.licenses.mit;
127 maintainers = with lib.maintainers; [
128 afldcr
129 moni
130 ];
131 mainProgram = "polybar";
132 platforms = lib.platforms.linux;
133 };
134})