Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ qtModule 2, qtdeclarative 3, qtwebchannel 4, qtpositioning 5, qtwebsockets 6, buildPackages 7, bison 8, coreutils 9, flex 10, git 11, gperf 12, ninja 13, pkg-config 14, python3 15, which 16, nodejs 17, qtbase 18, perl 19, xorg 20, libXcursor 21, libXScrnSaver 22, libXrandr 23, libXtst 24, libxshmfence 25, libXi 26, fontconfig 27, freetype 28, harfbuzz 29, icu 30, dbus 31, libdrm 32, zlib 33, minizip 34, libjpeg 35, libpng 36, libtiff 37, libwebp 38, libopus 39, jsoncpp 40, protobuf 41, libvpx 42, srtp 43, snappy 44, nss 45, libevent 46, openssl 47, alsa-lib 48, pulseaudio 49, libcap 50, pciutils 51, systemd 52, pipewire 53, gn 54, runCommand 55, writeScriptBin 56, ffmpeg_4 57, lib 58, stdenv 59, glib 60, libxml2 61, libxslt 62, lcms2 63, re2 64, libkrb5 65, mesa 66, xkeyboard_config 67, enableProprietaryCodecs ? true 68 # darwin 69, clang_14 70, bootstrap_cmds 71, cctools 72, xcbuild 73, AGL 74, AVFoundation 75, Accelerate 76, Cocoa 77, CoreLocation 78, CoreML 79, ForceFeedback 80, GameController 81, ImageCaptureCore 82, LocalAuthentication 83, MediaAccessibility 84, MediaPlayer 85, MetalKit 86, Network 87, OpenDirectory 88, Quartz 89, ReplayKit 90, SecurityInterface 91, Vision 92, openbsm 93, libunwind 94, cups 95, libpm 96, sandbox 97, xnu 98}: 99 100qtModule { 101 pname = "qtwebengine"; 102 qtInputs = [ qtdeclarative qtwebchannel qtwebsockets qtpositioning ]; 103 nativeBuildInputs = [ 104 bison 105 coreutils 106 flex 107 git 108 gperf 109 ninja 110 pkg-config 111 (python3.withPackages (ps: with ps; [ html5lib ])) 112 which 113 gn 114 nodejs 115 ] ++ lib.optionals stdenv.isDarwin [ 116 clang_14 117 bootstrap_cmds 118 cctools 119 xcbuild 120 ]; 121 doCheck = true; 122 outputs = [ "out" "dev" ]; 123 124 dontUseGnConfigure = true; 125 126 # ninja builds some components with -Wno-format, 127 # which cannot be set at the same time as -Wformat-security 128 hardeningDisable = [ "format" ]; 129 130 patches = [ 131 # removes macOS 12+ dependencies 132 ../patches/qtwebengine-darwin-no-low-latency-flag.patch 133 ../patches/qtwebengine-darwin-no-copy-certificate-chain.patch 134 # Don't assume /usr/share/X11, and also respect the XKB_CONFIG_ROOT 135 # environment variable, since NixOS relies on it working. 136 # See https://github.com/NixOS/nixpkgs/issues/226484 for more context. 137 ../patches/qtwebengine-xkb-includes.patch 138 ]; 139 140 postPatch = '' 141 # Patch Chromium build tools 142 ( 143 cd src/3rdparty/chromium; 144 145 # Manually fix unsupported shebangs 146 substituteInPlace third_party/harfbuzz-ng/src/src/update-unicode-tables.make \ 147 --replace "/usr/bin/env -S make -f" "/usr/bin/make -f" || true 148 substituteInPlace third_party/webgpu-cts/src/tools/run_deno \ 149 --replace "/usr/bin/env -S deno" "/usr/bin/deno" || true 150 patchShebangs . 151 ) 152 153 substituteInPlace cmake/Functions.cmake \ 154 --replace "/bin/bash" "${buildPackages.bash}/bin/bash" 155 156 # Patch library paths in sources 157 substituteInPlace src/core/web_engine_library_info.cpp \ 158 --replace "QLibraryInfo::path(QLibraryInfo::DataPath)" "\"$out\"" \ 159 --replace "QLibraryInfo::path(QLibraryInfo::TranslationsPath)" "\"$out/translations\"" \ 160 --replace "QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath)" "\"$out/libexec\"" 161 '' 162 + lib.optionalString stdenv.isLinux '' 163 sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${lib.getLib systemd}/lib/\1!' \ 164 src/3rdparty/chromium/device/udev_linux/udev?_loader.cc 165 166 sed -i -e '/libpci_loader.*Load/s!"\(libpci\.so\)!"${pciutils}/lib/\1!' \ 167 src/3rdparty/chromium/gpu/config/gpu_info_collector_linux.cc 168 '' 169 + lib.optionalString stdenv.isDarwin '' 170 substituteInPlace configure.cmake \ 171 --replace "AppleClang" "Clang" 172 substituteInPlace cmake/Functions.cmake \ 173 --replace "/usr/bin/xcrun" "${xcbuild}/bin/xcrun" 174 substituteInPlace src/3rdparty/chromium/third_party/crashpad/crashpad/util/BUILD.gn \ 175 --replace "\$sysroot/usr" "${xnu}" 176 ''; 177 178 cmakeFlags = [ 179 "-DQT_FEATURE_qtpdf_build=ON" 180 "-DQT_FEATURE_qtpdf_widgets_build=ON" 181 "-DQT_FEATURE_qtpdf_quick_build=ON" 182 "-DQT_FEATURE_pdf_v8=ON" 183 "-DQT_FEATURE_pdf_xfa=ON" 184 "-DQT_FEATURE_pdf_xfa_bmp=ON" 185 "-DQT_FEATURE_pdf_xfa_gif=ON" 186 "-DQT_FEATURE_pdf_xfa_png=ON" 187 "-DQT_FEATURE_pdf_xfa_tiff=ON" 188 "-DQT_FEATURE_webengine_system_icu=ON" 189 "-DQT_FEATURE_webengine_system_libevent=ON" 190 "-DQT_FEATURE_webengine_system_libxml=ON" 191 "-DQT_FEATURE_webengine_system_ffmpeg=ON" 192 # android only. https://bugreports.qt.io/browse/QTBUG-100293 193 # "-DQT_FEATURE_webengine_native_spellchecker=ON" 194 "-DQT_FEATURE_webengine_sanitizer=ON" 195 "-DQT_FEATURE_webengine_kerberos=ON" 196 ] ++ lib.optionals stdenv.isLinux [ 197 "-DQT_FEATURE_webengine_webrtc_pipewire=ON" 198 ] ++ lib.optionals enableProprietaryCodecs [ 199 "-DQT_FEATURE_webengine_proprietary_codecs=ON" 200 ] ++ lib.optionals stdenv.isDarwin [ 201 "-DCMAKE_OSX_DEPLOYMENT_TARGET=${stdenv.targetPlatform.darwinSdkVersion}" 202 ]; 203 204 propagatedBuildInputs = [ 205 # Image formats 206 libjpeg 207 libpng 208 libtiff 209 libwebp 210 211 # Video formats 212 srtp 213 libvpx 214 215 # Audio formats 216 libopus 217 218 # Text rendering 219 harfbuzz 220 icu 221 222 openssl 223 glib 224 libxml2 225 libxslt 226 lcms2 227 re2 228 229 libevent 230 ffmpeg_4 231 ] ++ lib.optionals stdenv.isLinux [ 232 dbus 233 zlib 234 minizip 235 snappy 236 nss 237 protobuf 238 jsoncpp 239 240 # Audio formats 241 alsa-lib 242 pulseaudio 243 244 # Text rendering 245 fontconfig 246 freetype 247 248 libcap 249 pciutils 250 251 # X11 libs 252 xorg.xrandr 253 libXScrnSaver 254 libXcursor 255 libXrandr 256 xorg.libpciaccess 257 libXtst 258 xorg.libXcomposite 259 xorg.libXdamage 260 libdrm 261 xorg.libxkbfile 262 libxshmfence 263 libXi 264 xorg.libXext 265 266 # Pipewire 267 pipewire 268 269 libkrb5 270 mesa 271 ] ++ lib.optionals stdenv.isDarwin [ 272 AGL 273 AVFoundation 274 Accelerate 275 Cocoa 276 CoreLocation 277 CoreML 278 ForceFeedback 279 GameController 280 ImageCaptureCore 281 LocalAuthentication 282 MediaAccessibility 283 MediaPlayer 284 MetalKit 285 Network 286 OpenDirectory 287 Quartz 288 ReplayKit 289 SecurityInterface 290 Vision 291 292 openbsm 293 libunwind 294 ]; 295 296 buildInputs = [ 297 cups 298 ] ++ lib.optionals stdenv.isDarwin [ 299 libpm 300 sandbox 301 ]; 302 303 requiredSystemFeatures = [ "big-parallel" ]; 304 305 preConfigure = '' 306 export NINJAFLAGS="-j$NIX_BUILD_CORES" 307 ''; 308 309 meta = with lib; { 310 description = "A web engine based on the Chromium web browser"; 311 platforms = platforms.unix; 312 broken = stdenv.isDarwin && stdenv.isx86_64; 313 # This build takes a long time; particularly on slow architectures 314 # 1 hour on 32x3.6GHz -> maybe 12 hours on 4x2.4GHz 315 timeout = 24 * 3600; 316 }; 317}