62 , enableProprietaryCodecs ? true
64 , autoSignDarwinBinariesHook
71 pname = "qtwebengine";
80 (python3.withPackages (ps: with ps; [ html5lib ]))
84 ] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
85 autoSignDarwinBinariesHook
86 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
92 outputs = [ "out" "dev" ];
94 dontUseGnConfigure = true;
96 # ninja builds some components with -Wno-format,
97 # which cannot be set at the same time as -Wformat-security
98 hardeningDisable = [ "format" ];
101 # Don't assume /usr/share/X11, and also respect the XKB_CONFIG_ROOT
102 # environment variable, since NixOS relies on it working.
103 # See https://github.com/NixOS/nixpkgs/issues/226484 for more context.
104 ../patches/qtwebengine-xkb-includes.patch
106 ../patches/qtwebengine-link-pulseaudio.patch
108 # Override locales install path so they go to QtWebEngine's $out
109 ../patches/qtwebengine-locales-path.patch
113 # Patch Chromium build tools
115 cd src/3rdparty/chromium;
117 # Manually fix unsupported shebangs
118 substituteInPlace third_party/harfbuzz-ng/src/src/update-unicode-tables.make \
119 --replace "/usr/bin/env -S make -f" "/usr/bin/make -f" || true
120 substituteInPlace third_party/webgpu-cts/src/tools/run_deno \
121 --replace "/usr/bin/env -S deno" "/usr/bin/deno" || true
125 substituteInPlace cmake/Functions.cmake \
126 --replace "/bin/bash" "${buildPackages.bash}/bin/bash"
128 # Patch library paths in sources
129 substituteInPlace src/core/web_engine_library_info.cpp \
130 --replace "QLibraryInfo::path(QLibraryInfo::DataPath)" "\"$out\"" \
131 --replace "QLibraryInfo::path(QLibraryInfo::TranslationsPath)" "\"$out/translations\"" \
132 --replace "QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath)" "\"$out/libexec\""
134 + lib.optionalString stdenv.hostPlatform.isLinux ''
135 sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${lib.getLib systemd}/lib/\1!' \
136 src/3rdparty/chromium/device/udev_linux/udev?_loader.cc
138 sed -i -e '/libpci_loader.*Load/s!"\(libpci\.so\)!"${pciutils}/lib/\1!' \
139 src/3rdparty/chromium/gpu/config/gpu_info_collector_linux.cc
141 + lib.optionalString stdenv.hostPlatform.isDarwin ''
142 substituteInPlace configure.cmake src/gn/CMakeLists.txt \
143 --replace "AppleClang" "Clang"
144 substituteInPlace cmake/Functions.cmake \
145 --replace "/usr/bin/xcrun" "${xcbuild}/bin/xcrun"
149 "-DQT_FEATURE_qtpdf_build=ON"
150 "-DQT_FEATURE_qtpdf_widgets_build=ON"
151 "-DQT_FEATURE_qtpdf_quick_build=ON"
152 "-DQT_FEATURE_pdf_v8=ON"
153 "-DQT_FEATURE_pdf_xfa=ON"
154 "-DQT_FEATURE_pdf_xfa_bmp=ON"
155 "-DQT_FEATURE_pdf_xfa_gif=ON"
156 "-DQT_FEATURE_pdf_xfa_png=ON"
157 "-DQT_FEATURE_pdf_xfa_tiff=ON"
158 "-DQT_FEATURE_webengine_system_libevent=ON"
159 "-DQT_FEATURE_webengine_system_ffmpeg=ON"
160 # android only. https://bugreports.qt.io/browse/QTBUG-100293
161 # "-DQT_FEATURE_webengine_native_spellchecker=ON"
162 "-DQT_FEATURE_webengine_sanitizer=ON"
163 "-DQT_FEATURE_webengine_kerberos=ON"
164 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
165 "-DQT_FEATURE_webengine_system_libxml=ON"
166 "-DQT_FEATURE_webengine_webrtc_pipewire=ON"
168 # Appears not to work on some platforms
169 # https://github.com/Homebrew/homebrew-core/issues/104008
170 "-DQT_FEATURE_webengine_system_icu=ON"
171 ] ++ lib.optionals enableProprietaryCodecs [
172 "-DQT_FEATURE_webengine_proprietary_codecs=ON"
173 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
174 "-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0" # Per Qt 6’s deployment target (why doesn’t the hook work?)
177 propagatedBuildInputs = [
206 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
255 requiredSystemFeatures = [ "big-parallel" ];
258 export NINJAFLAGS="-j$NIX_BUILD_CORES"
261 # Debug info is too big to link with LTO.
262 separateDebugInfo = false;
265 description = "Web engine based on the Chromium web browser";
266 platforms = [ "x86_64-darwin" "aarch64-darwin" "aarch64-linux" "armv7a-linux" "armv7l-linux" "x86_64-linux" ];
267 # This build takes a long time; particularly on slow architectures
268 # 1 hour on 32x3.6GHz -> maybe 12 hours on 4x2.4GHz