at 25.11-pre 211 lines 6.0 kB view raw
1{ 2 config, 3 lib, 4 stdenv, 5 fetchFromGitHub, 6 pkg-config, 7 cmake, 8 9 # dependencies 10 glib, 11 libXinerama, 12 catch2, 13 14 # lib.optional features without extra dependencies 15 mpdSupport ? true, 16 ibmSupport ? true, # IBM/Lenovo notebooks 17 18 # lib.optional features with extra dependencies 19 20 # ouch, this is ugly, but this gives the man page 21 docsSupport ? true, 22 docbook2x, 23 libxslt ? null, 24 man ? null, 25 less ? null, 26 docbook_xsl ? null, 27 docbook_xml_dtd_44 ? null, 28 29 ncursesSupport ? true, 30 ncurses ? null, 31 x11Support ? true, 32 freetype, 33 xorg, 34 waylandSupport ? true, 35 pango, 36 wayland, 37 wayland-protocols, 38 wayland-scanner, 39 xdamageSupport ? x11Support, 40 libXdamage ? null, 41 doubleBufferSupport ? x11Support, 42 imlib2Support ? x11Support, 43 imlib2 ? null, 44 45 luaSupport ? true, 46 lua ? null, 47 luaImlib2Support ? luaSupport && imlib2Support, 48 luaCairoSupport ? luaSupport && (x11Support || waylandSupport), 49 cairo ? null, 50 toluapp ? null, 51 52 wirelessSupport ? true, 53 wirelesstools ? null, 54 nvidiaSupport ? false, 55 libXNVCtrl ? null, 56 pulseSupport ? config.pulseaudio or false, 57 libpulseaudio ? null, 58 59 curlSupport ? true, 60 curl ? null, 61 rssSupport ? curlSupport, 62 weatherMetarSupport ? curlSupport, 63 weatherXoapSupport ? curlSupport, 64 journalSupport ? true, 65 systemd ? null, 66 libxml2 ? null, 67}: 68 69assert 70 docsSupport 71 -> 72 docbook2x != null 73 && libxslt != null 74 && man != null 75 && less != null 76 && docbook_xsl != null 77 && docbook_xml_dtd_44 != null; 78 79assert ncursesSupport -> ncurses != null; 80 81assert xdamageSupport -> x11Support && libXdamage != null; 82assert imlib2Support -> x11Support && imlib2 != null; 83assert luaSupport -> lua != null; 84assert luaImlib2Support -> luaSupport && imlib2Support && toluapp != null; 85assert luaCairoSupport -> luaSupport && toluapp != null && cairo != null; 86assert luaCairoSupport || luaImlib2Support -> lua.luaversion == "5.4"; 87 88assert wirelessSupport -> wirelesstools != null; 89assert nvidiaSupport -> libXNVCtrl != null; 90assert pulseSupport -> libpulseaudio != null; 91 92assert curlSupport -> curl != null; 93assert rssSupport -> curlSupport && libxml2 != null; 94assert weatherMetarSupport -> curlSupport; 95assert weatherXoapSupport -> curlSupport && libxml2 != null; 96assert journalSupport -> systemd != null; 97 98stdenv.mkDerivation rec { 99 pname = "conky"; 100 version = "1.19.6"; 101 102 src = fetchFromGitHub { 103 owner = "brndnmtthws"; 104 repo = "conky"; 105 rev = "v${version}"; 106 hash = "sha256-L8YSbdk+qQl17L4IRajFD/AEWRXb2w7xH9sM9qPGrQo="; 107 }; 108 109 postPatch = 110 lib.optionalString docsSupport '' 111 substituteInPlace cmake/Conky.cmake --replace "# set(RELEASE true)" "set(RELEASE true)" 112 113 cp ${catch2}/include/catch2/catch.hpp tests/catch2/catch.hpp 114 '' 115 + lib.optionalString waylandSupport '' 116 substituteInPlace src/CMakeLists.txt \ 117 --replace 'COMMAND ''${Wayland_SCANNER}' 'COMMAND wayland-scanner' 118 ''; 119 120 env = { 121 # For some reason -Werror is on by default, causing the project to fail compilation. 122 NIX_CFLAGS_COMPILE = "-Wno-error"; 123 NIX_LDFLAGS = "-lgcc_s"; 124 }; 125 126 nativeBuildInputs = 127 [ 128 cmake 129 pkg-config 130 ] 131 ++ lib.optionals docsSupport [ 132 docbook2x 133 docbook_xsl 134 docbook_xml_dtd_44 135 libxslt 136 man 137 less 138 ] 139 ++ lib.optional waylandSupport wayland-scanner 140 ++ lib.optional luaImlib2Support toluapp 141 ++ lib.optional luaCairoSupport toluapp; 142 buildInputs = 143 [ 144 glib 145 libXinerama 146 ] 147 ++ lib.optional ncursesSupport ncurses 148 ++ lib.optionals x11Support [ 149 freetype 150 xorg.libICE 151 xorg.libX11 152 xorg.libXext 153 xorg.libXft 154 xorg.libSM 155 ] 156 ++ lib.optionals waylandSupport [ 157 pango 158 wayland 159 wayland-protocols 160 ] 161 ++ lib.optional xdamageSupport libXdamage 162 ++ lib.optional imlib2Support imlib2 163 ++ lib.optional luaSupport lua 164 ++ lib.optional luaImlib2Support imlib2 165 ++ lib.optional luaCairoSupport cairo 166 ++ lib.optional wirelessSupport wirelesstools 167 ++ lib.optional curlSupport curl 168 ++ lib.optional rssSupport libxml2 169 ++ lib.optional weatherXoapSupport libxml2 170 ++ lib.optional nvidiaSupport libXNVCtrl 171 ++ lib.optional pulseSupport libpulseaudio 172 ++ lib.optional journalSupport systemd; 173 174 cmakeFlags = 175 [ ] 176 ++ lib.optional docsSupport "-DMAINTAINER_MODE=ON" 177 ++ lib.optional curlSupport "-DBUILD_CURL=ON" 178 ++ lib.optional (!ibmSupport) "-DBUILD_IBM=OFF" 179 ++ lib.optional imlib2Support "-DBUILD_IMLIB2=ON" 180 ++ lib.optional luaCairoSupport "-DBUILD_LUA_CAIRO=ON" 181 ++ lib.optional luaImlib2Support "-DBUILD_LUA_IMLIB2=ON" 182 ++ lib.optional (!mpdSupport) "-DBUILD_MPD=OFF" 183 ++ lib.optional (!ncursesSupport) "-DBUILD_NCURSES=OFF" 184 ++ lib.optional rssSupport "-DBUILD_RSS=ON" 185 ++ lib.optional (!x11Support) "-DBUILD_X11=OFF" 186 ++ lib.optional waylandSupport "-DBUILD_WAYLAND=ON" 187 ++ lib.optional xdamageSupport "-DBUILD_XDAMAGE=ON" 188 ++ lib.optional doubleBufferSupport "-DBUILD_XDBE=ON" 189 ++ lib.optional weatherMetarSupport "-DBUILD_WEATHER_METAR=ON" 190 ++ lib.optional weatherXoapSupport "-DBUILD_WEATHER_XOAP=ON" 191 ++ lib.optional wirelessSupport "-DBUILD_WLAN=ON" 192 ++ lib.optional nvidiaSupport "-DBUILD_NVIDIA=ON" 193 ++ lib.optional pulseSupport "-DBUILD_PULSEAUDIO=ON" 194 ++ lib.optional journalSupport "-DBUILD_JOURNAL=ON"; 195 196 # `make -f src/CMakeFiles/conky.dir/build.make src/CMakeFiles/conky.dir/conky.cc.o`: 197 # src/conky.cc:137:23: fatal error: defconfig.h: No such file or directory 198 enableParallelBuilding = false; 199 200 doCheck = true; 201 202 meta = with lib; { 203 homepage = "https://conky.cc"; 204 changelog = "https://github.com/brndnmtthws/conky/releases/tag/v${version}"; 205 description = "Advanced, highly configurable system monitor based on torsmo"; 206 mainProgram = "conky"; 207 maintainers = [ maintainers.guibert ]; 208 license = licenses.gpl3Plus; 209 platforms = platforms.linux; 210 }; 211}