1 { config, lib, stdenv, fetchFromGitHub, pkg-config, cmake
4 , glib, libXinerama, catch2
6 # lib.optional features without extra dependencies
8 , ibmSupport ? true # IBM/Lenovo notebooks
10 # lib.optional features with extra dependencies
12 # ouch, this is ugly, but this gives the man page
13 , docsSupport ? true, docbook2x, libxslt ? null
14 , man ? null, less ? null
15 , docbook_xsl ? null , docbook_xml_dtd_44 ? null
17 , ncursesSupport ? true , ncurses ? null
18 , x11Support ? true , freetype, xorg
19 , waylandSupport ? true , pango, wayland, wayland-protocols, wayland-scanner
20 , xdamageSupport ? x11Support, libXdamage ? null
21 , doubleBufferSupport ? x11Support
22 , imlib2Support ? x11Support, imlib2 ? null
24 , luaSupport ? true , lua ? null
25 , luaImlib2Support ? luaSupport && imlib2Support
26 , luaCairoSupport ? luaSupport && (x11Support || waylandSupport), cairo ? null
29 , wirelessSupport ? true , wirelesstools ? null
30 , nvidiaSupport ? false , libXNVCtrl ? null
31 , pulseSupport ? config.pulseaudio or false, libpulseaudio ? null
33 , curlSupport ? true , curl ? null
34 , rssSupport ? curlSupport
35 , weatherMetarSupport ? curlSupport
36 , weatherXoapSupport ? curlSupport
37 , journalSupport ? true, systemd ? null
41 assert docsSupport -> docbook2x != null && libxslt != null
42 && man != null && less != null
43 && docbook_xsl != null && docbook_xml_dtd_44 != null;
45 assert ncursesSupport -> ncurses != null;
47 assert xdamageSupport -> x11Support && libXdamage != null;
48 assert imlib2Support -> x11Support && imlib2 != null;
49 assert luaSupport -> lua != null;
50 assert luaImlib2Support -> luaSupport && imlib2Support
52 assert luaCairoSupport -> luaSupport && toluapp != null
54 assert luaCairoSupport || luaImlib2Support
55 -> lua.luaversion == "5.4";
57 assert wirelessSupport -> wirelesstools != null;
58 assert nvidiaSupport -> libXNVCtrl != null;
59 assert pulseSupport -> libpulseaudio != null;
61 assert curlSupport -> curl != null;
62 assert rssSupport -> curlSupport && libxml2 != null;
63 assert weatherMetarSupport -> curlSupport;
64 assert weatherXoapSupport -> curlSupport && libxml2 != null;
65 assert journalSupport -> systemd != null;
67 stdenv.mkDerivation rec {
71 src = fetchFromGitHub {
72 owner = "brndnmtthws";
75 hash = "sha256-L8YSbdk+qQl17L4IRajFD/AEWRXb2w7xH9sM9qPGrQo=";
78 postPatch = lib.optionalString docsSupport ''
79 substituteInPlace cmake/Conky.cmake --replace "# set(RELEASE true)" "set(RELEASE true)"
81 cp ${catch2}/include/catch2/catch.hpp tests/catch2/catch.hpp
82 '' + lib.optionalString waylandSupport ''
83 substituteInPlace src/CMakeLists.txt \
84 --replace 'COMMAND ''${Wayland_SCANNER}' 'COMMAND wayland-scanner'
88 # For some reason -Werror is on by default, causing the project to fail compilation.
89 NIX_CFLAGS_COMPILE = "-Wno-error";
90 NIX_LDFLAGS = "-lgcc_s";
93 nativeBuildInputs = [ cmake pkg-config ]
94 ++ lib.optionals docsSupport [ docbook2x docbook_xsl docbook_xml_dtd_44 libxslt man less ]
95 ++ lib.optional waylandSupport wayland-scanner
96 ++ lib.optional luaImlib2Support toluapp
97 ++ lib.optional luaCairoSupport toluapp
99 buildInputs = [ glib libXinerama ]
100 ++ lib.optional ncursesSupport ncurses
101 ++ lib.optionals x11Support [ freetype xorg.libICE xorg.libX11 xorg.libXext xorg.libXft xorg.libSM ]
102 ++ lib.optionals waylandSupport [ pango wayland wayland-protocols ]
103 ++ lib.optional xdamageSupport libXdamage
104 ++ lib.optional imlib2Support imlib2
105 ++ lib.optional luaSupport lua
106 ++ lib.optional luaImlib2Support imlib2
107 ++ lib.optional luaCairoSupport cairo
108 ++ lib.optional wirelessSupport wirelesstools
109 ++ lib.optional curlSupport curl
110 ++ lib.optional rssSupport libxml2
111 ++ lib.optional weatherXoapSupport libxml2
112 ++ lib.optional nvidiaSupport libXNVCtrl
113 ++ lib.optional pulseSupport libpulseaudio
114 ++ lib.optional journalSupport systemd
118 ++ lib.optional docsSupport "-DMAINTAINER_MODE=ON"
119 ++ lib.optional curlSupport "-DBUILD_CURL=ON"
120 ++ lib.optional (!ibmSupport) "-DBUILD_IBM=OFF"
121 ++ lib.optional imlib2Support "-DBUILD_IMLIB2=ON"
122 ++ lib.optional luaCairoSupport "-DBUILD_LUA_CAIRO=ON"
123 ++ lib.optional luaImlib2Support "-DBUILD_LUA_IMLIB2=ON"
124 ++ lib.optional (!mpdSupport) "-DBUILD_MPD=OFF"
125 ++ lib.optional (!ncursesSupport) "-DBUILD_NCURSES=OFF"
126 ++ lib.optional rssSupport "-DBUILD_RSS=ON"
127 ++ lib.optional (!x11Support) "-DBUILD_X11=OFF"
128 ++ lib.optional waylandSupport "-DBUILD_WAYLAND=ON"
129 ++ lib.optional xdamageSupport "-DBUILD_XDAMAGE=ON"
130 ++ lib.optional doubleBufferSupport "-DBUILD_XDBE=ON"
131 ++ lib.optional weatherMetarSupport "-DBUILD_WEATHER_METAR=ON"
132 ++ lib.optional weatherXoapSupport "-DBUILD_WEATHER_XOAP=ON"
133 ++ lib.optional wirelessSupport "-DBUILD_WLAN=ON"
134 ++ lib.optional nvidiaSupport "-DBUILD_NVIDIA=ON"
135 ++ lib.optional pulseSupport "-DBUILD_PULSEAUDIO=ON"
136 ++ lib.optional journalSupport "-DBUILD_JOURNAL=ON"
139 # `make -f src/CMakeFiles/conky.dir/build.make src/CMakeFiles/conky.dir/conky.cc.o`:
140 # src/conky.cc:137:23: fatal error: defconfig.h: No such file or directory
141 enableParallelBuilding = false;
146 homepage = "https://conky.cc";
147 changelog = "https://github.com/brndnmtthws/conky/releases/tag/v${version}";
148 description = "Advanced, highly configurable system monitor based on torsmo";
149 mainProgram = "conky";
150 maintainers = [ maintainers.guibert ];
151 license = licenses.gpl3Plus;
152 platforms = platforms.linux;