Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 195 lines 5.4 kB view raw
1{ 2 config, 3 lib, 4 stdenv, 5 fetchFromGitHub, 6 fetchpatch, 7 pkg-config, 8 cmake, 9 10 # dependencies 11 glib, 12 libXinerama, 13 catch2, 14 gperf, 15 16 # lib.optional features without extra dependencies 17 mpdSupport ? true, 18 ibmSupport ? true, # IBM/Lenovo notebooks 19 20 # lib.optional features with extra dependencies 21 22 docsSupport ? true, 23 buildPackages, 24 pandoc, 25 python3, 26 27 ncursesSupport ? true, 28 ncurses ? null, 29 x11Support ? true, 30 freetype, 31 xorg, 32 waylandSupport ? true, 33 pango, 34 wayland, 35 wayland-protocols, 36 wayland-scanner, 37 xdamageSupport ? x11Support, 38 libXdamage ? null, 39 doubleBufferSupport ? x11Support, 40 imlib2Support ? x11Support, 41 imlib2 ? null, 42 43 luaSupport ? true, 44 lua ? null, 45 luaImlib2Support ? luaSupport && imlib2Support, 46 luaCairoSupport ? luaSupport && (x11Support || waylandSupport), 47 cairo ? null, 48 toluapp ? null, 49 50 wirelessSupport ? true, 51 wirelesstools ? null, 52 nvidiaSupport ? false, 53 libXNVCtrl ? null, 54 pulseSupport ? config.pulseaudio or false, 55 libpulseaudio ? null, 56 57 curlSupport ? true, 58 curl ? null, 59 rssSupport ? curlSupport, 60 journalSupport ? true, 61 systemd ? null, 62 libxml2 ? null, 63 64 extrasSupport ? true, 65 66 versionCheckHook, 67}: 68 69assert docsSupport -> pandoc != null && python3 != null; 70 71assert ncursesSupport -> ncurses != null; 72 73assert xdamageSupport -> x11Support && libXdamage != null; 74assert imlib2Support -> x11Support && imlib2 != null; 75assert luaSupport -> lua != null; 76assert luaImlib2Support -> luaSupport && imlib2Support && toluapp != null; 77assert luaCairoSupport -> luaSupport && toluapp != null && cairo != null; 78assert luaCairoSupport || luaImlib2Support -> lua.luaversion == "5.4"; 79 80assert wirelessSupport -> wirelesstools != null; 81assert nvidiaSupport -> libXNVCtrl != null; 82assert pulseSupport -> libpulseaudio != null; 83 84assert curlSupport -> curl != null; 85assert rssSupport -> curlSupport && libxml2 != null; 86assert journalSupport -> systemd != null; 87 88assert extrasSupport -> python3 != null; 89 90stdenv.mkDerivation (finalAttrs: { 91 pname = "conky"; 92 version = "1.22.2"; 93 94 src = fetchFromGitHub { 95 owner = "brndnmtthws"; 96 repo = "conky"; 97 tag = "v${finalAttrs.version}"; 98 hash = "sha256-tMnfdW1sbZkt8v6DITM2R0ZwyN+xs7VLGZDityYt38Q="; 99 }; 100 101 # pkg-config doesn't detect wayland-scanner in cross-compilation for some reason 102 postPatch = '' 103 substituteInPlace cmake/ConkyPlatformChecks.cmake \ 104 --replace-fail "pkg_get_variable(Wayland_SCANNER wayland-scanner wayland_scanner)" "set(Wayland_SCANNER ${lib.getExe buildPackages.wayland-scanner})" 105 ''; 106 107 strictDeps = true; 108 109 nativeBuildInputs = [ 110 cmake 111 pkg-config 112 gperf 113 ] 114 ++ lib.optional docsSupport pandoc 115 ++ lib.optional (docsSupport || extrasSupport) ( 116 # Use buildPackages to work around https://github.com/NixOS/nixpkgs/issues/305858 117 buildPackages.python3.withPackages (ps: [ 118 ps.jinja2 119 ps.pyyaml 120 ]) 121 ) 122 ++ lib.optional luaImlib2Support toluapp 123 ++ lib.optional luaCairoSupport toluapp; 124 125 buildInputs = [ 126 glib 127 libXinerama 128 ] 129 ++ lib.optional ncursesSupport ncurses 130 ++ lib.optionals x11Support [ 131 freetype 132 xorg.libICE 133 xorg.libX11 134 xorg.libXext 135 xorg.libXft 136 xorg.libSM 137 ] 138 ++ lib.optionals waylandSupport [ 139 pango 140 wayland 141 wayland-protocols 142 ] 143 ++ lib.optional xdamageSupport libXdamage 144 ++ lib.optional imlib2Support imlib2 145 ++ lib.optional luaSupport lua 146 ++ lib.optional luaImlib2Support imlib2 147 ++ lib.optional luaCairoSupport cairo 148 ++ lib.optional wirelessSupport wirelesstools 149 ++ lib.optional curlSupport curl 150 ++ lib.optional rssSupport libxml2 151 ++ lib.optional nvidiaSupport libXNVCtrl 152 ++ lib.optional pulseSupport libpulseaudio 153 ++ lib.optional journalSupport systemd; 154 155 cmakeFlags = [ 156 (lib.cmakeBool "REPRODUCIBLE_BUILD" true) 157 (lib.cmakeBool "RELEASE" true) 158 (lib.cmakeBool "BUILD_TESTING" finalAttrs.finalPackage.doCheck) 159 (lib.cmakeBool "BUILD_EXTRAS" extrasSupport) 160 (lib.cmakeBool "BUILD_DOCS" docsSupport) 161 (lib.cmakeBool "BUILD_CURL" curlSupport) 162 (lib.cmakeBool "BUILD_IBM" ibmSupport) 163 (lib.cmakeBool "BUILD_IMLIB2" imlib2Support) 164 (lib.cmakeBool "BUILD_LUA_CAIRO" luaCairoSupport) 165 (lib.cmakeBool "BUILD_LUA_IMLIB2" luaImlib2Support) 166 (lib.cmakeBool "BUILD_MPD" mpdSupport) 167 (lib.cmakeBool "BUILD_NCURSES" ncursesSupport) 168 (lib.cmakeBool "BUILD_RSS" rssSupport) 169 (lib.cmakeBool "BUILD_X11" x11Support) 170 (lib.cmakeBool "BUILD_WAYLAND" waylandSupport) 171 (lib.cmakeBool "BUILD_XDAMAGE" xdamageSupport) 172 (lib.cmakeBool "BUILD_XDBE" doubleBufferSupport) 173 (lib.cmakeBool "BUILD_WLAN" wirelessSupport) 174 (lib.cmakeBool "BUILD_NVIDIA" nvidiaSupport) 175 (lib.cmakeBool "BUILD_PULSEAUDIO" pulseSupport) 176 (lib.cmakeBool "BUILD_JOURNAL" journalSupport) 177 (lib.cmakeFeature "CMAKE_INSTALL_DATAROOTDIR" "${placeholder "out"}/share") 178 ]; 179 180 doCheck = true; 181 182 nativeInstallCheckInputs = [ versionCheckHook ]; 183 versionCheckProgramArg = "--version"; 184 doInstallCheck = true; 185 186 meta = { 187 homepage = "https://conky.cc"; 188 changelog = "https://github.com/brndnmtthws/conky/releases/tag/${finalAttrs.src.tag}"; 189 description = "Advanced, highly configurable system monitor based on torsmo"; 190 mainProgram = "conky"; 191 maintainers = [ lib.maintainers.guibert ]; 192 license = lib.licenses.gpl3Plus; 193 platforms = lib.platforms.linux; 194 }; 195})