23 systemdSupport ? stdenv.hostPlatform.isLinux,
75 # optional dependencies
83 libGLSupported ? stdenv.hostPlatform.isLinux,
85 qttranslations ? null,
89 isCrossBuild = !stdenv.buildPlatform.canExecute stdenv.hostPlatform;
91 stdenv.mkDerivation rec {
96 propagatedBuildInputs =
116 ++ lib.optionals (!stdenv.hostPlatform.isMinGW) [
123 unixODBCDrivers.sqlite
124 unixODBCDrivers.mariadb
126 ++ lib.optionals systemdSupport [
129 ++ lib.optionals stdenv.hostPlatform.isLinux [
163 ++ lib.optionals libGLSupported [
166 ++ lib.optionals stdenv.hostPlatform.isMinGW [
170 ++ lib.optional (cups != null && lib.meta.availableOn stdenv.hostPlatform cups) cups;
173 lib.optionals (lib.meta.availableOn stdenv.hostPlatform at-spi2-core) [
176 ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform libinput) [
179 ++ lib.optionals stdenv.hostPlatform.isDarwin darwinVersionInputs
180 ++ lib.optional withGtk3 gtk3
181 ++ lib.optional (libmysqlclient != null && !stdenv.hostPlatform.isMinGW) libmysqlclient
183 postgresql != null && lib.meta.availableOn stdenv.hostPlatform postgresql
186 nativeBuildInputs = [
197 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ moveBuildTree ];
199 propagatedNativeBuildInputs =
201 # I’m not sure if this is necessary, but the macOS mkspecs stuff
202 # tries to call `xcrun xcodebuild`, so better safe than sorry.
203 ++ lib.optionals stdenv.hostPlatform.isDarwin [ xcbuild ];
207 enableParallelBuilding = true;
211 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
212 # TODO: Verify that this catches all the occurrences?
214 cmake/QtPublicAppleHelpers.cmake \
215 mkspecs/features/mac/asset_catalogs.prf \
216 mkspecs/features/mac/default_pre.prf \
217 mkspecs/features/mac/sdk.mk \
218 mkspecs/features/mac/sdk.prf \
219 mkspecs/features/permissions.prf \
220 src/corelib/Qt6CoreMacros.cmake
222 substituteInPlace "$file" \
223 --replace-quiet /usr/bin/xcrun '${lib.getExe' xcbuild "xcrun"}' \
224 --replace-quiet /usr/bin/xcode-select '${lib.getExe' xcbuild "xcode-select"}' \
225 --replace-quiet /usr/libexec/PlistBuddy '${lib.getExe' xcbuild "PlistBuddy"}'
228 substituteInPlace mkspecs/common/macx.conf \
229 --replace-fail 'CONFIG += ' 'CONFIG += no_default_rpath '
232 fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
233 fix_qt_module_paths = ../hooks/fix-qt-module-paths.sh;
235 . "$fix_qt_builtin_paths"
236 . "$fix_qt_module_paths"
239 qtPluginPrefix = "lib/qt-6/plugins";
240 qtQmlPrefix = "lib/qt-6/qml";
244 "-DQT_EMBED_TOOLCHAIN_COMPILER=OFF"
245 "-DINSTALL_PLUGINSDIR=${qtPluginPrefix}"
246 "-DINSTALL_QMLDIR=${qtQmlPrefix}"
247 "-DQT_FEATURE_libproxy=ON"
248 "-DQT_FEATURE_system_sqlite=ON"
249 "-DQT_FEATURE_openssl_linked=ON"
251 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
252 "-DQT_FEATURE_sctp=ON"
253 "-DQT_FEATURE_journald=${if systemdSupport then "ON" else "OFF"}"
254 "-DQT_FEATURE_vulkan=ON"
256 ++ lib.optionals stdenv.hostPlatform.isDarwin [
257 "-DQT_FEATURE_rpath=OFF"
259 ++ lib.optionals isCrossBuild [
260 "-DQT_HOST_PATH=${pkgsBuildBuild.qt6.qtbase}"
261 "-DQt6HostInfo_DIR=${pkgsBuildBuild.qt6.qtbase}/lib/cmake/Qt6HostInfo"
264 qttranslations != null && !isCrossBuild
265 ) "-DINSTALL_TRANSLATIONSDIR=${qttranslations}/translations";
267 env.NIX_CFLAGS_COMPILE = "-DNIXPKGS_QT_PLUGIN_PREFIX=\"${qtPluginPrefix}\"";
273 separateDebugInfo = true;
279 moveToOutput "mkspecs/modules" "$dev"
280 fixQtModulePaths "$dev/mkspecs/modules"
281 fixQtBuiltinPaths "$out" '*.pr?'
283 + lib.optionalString stdenv.hostPlatform.isLinux ''
285 # FIXME: not sure why this isn't added automatically?
286 patchelf --add-rpath "${libmysqlclient}/lib/mariadb" $out/${qtPluginPrefix}/sqldrivers/libqsqlmysql.so
289 dontWrapQtApps = true;
291 setupHook = ../hooks/qtbase-setup-hook.sh;
294 homepage = "https://www.qt.io/";
295 description = "Cross-platform application framework for C++";
296 license = with licenses; [
302 maintainers = with maintainers; [
307 platforms = platforms.unix ++ platforms.windows;