5 Run `./fetch.sh` to update package sources from Git.
6 Check for any minor version changes.
10 { makeScopeWithSplicing', generateSplicesForMkScope
11 , lib, stdenv, fetchurl, fetchgit, fetchpatch, fetchFromGitHub, makeSetupHook, makeWrapper
12 , bison, cups ? null, harfbuzz, libGL, perl, python3
13 , gstreamer, gst-plugins-base, gtk3, dconf
14 , llvmPackages_15, overrideSDK, overrideLibcxx
18 , developerBuild ? false
19 , decryptSslTraffic ? false
26 srcs = import ./srcs.nix { inherit lib fetchgit fetchFromGitHub; };
28 qtCompatVersion = srcs.qtbase.version;
31 qtbase = lib.optionals stdenv.isDarwin [
32 ./qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
34 # Patch framework detection to support X.framework/X.tbd,
35 # extending the current support for X.framework/X.
36 ./qtbase.patch.d/0012-qtbase-tbd-frameworks.patch
38 ./qtbase.patch.d/0014-aarch64-darwin.patch
40 ./qtbase.patch.d/0003-qtbase-mkspecs.patch
41 ./qtbase.patch.d/0004-qtbase-replace-libdir.patch
42 ./qtbase.patch.d/0005-qtbase-cmake.patch
43 ./qtbase.patch.d/0006-qtbase-gtk3.patch
44 ./qtbase.patch.d/0007-qtbase-xcursor.patch
45 ./qtbase.patch.d/0008-qtbase-tzdir.patch
46 ./qtbase.patch.d/0009-qtbase-qtpluginpath.patch
47 ./qtbase.patch.d/0010-qtbase-assert.patch
48 ./qtbase.patch.d/0011-fix-header_module.patch
52 # prevent headaches from stale qmlcache data
53 ./qtdeclarative-default-disable-qmlcache.patch
55 qtlocation = lib.optionals stdenv.cc.isClang [
56 # Fix build with Clang 16
58 url = "https://github.com/boostorg/numeric_conversion/commit/50a1eae942effb0a9b90724323ef8f2a67e7984a.patch";
60 extraPrefix = "src/3rdparty/mapbox-gl-native/deps/boost/1.65.1/";
61 hash = "sha256-UEvIXzn387f9BAeBdhheStD/4M7en+rmqX8C6gstl6k=";
64 qtmultimedia = lib.optionals stdenv.isDarwin [
65 # build patch for qtmultimedia with xcode 15
67 url = "https://raw.githubusercontent.com/Homebrew/formula-patches/3f509180/qt5/qt5-qtmultimedia-xcode15.patch";
69 hash = "sha256-HrEqfmm8WbapWgLM0L4AKW8168pwT2zYI8HOJruEPSs=";
73 ## Upstream patches after the Qt6 transition that apply without problems & fix bugs
75 # Fixes QList -> QSet conversion
77 url = "https://github.com/qt/qtpim/commit/f337e281e28904741a3b1ac23d15c3a83ef2bbc9.patch";
78 hash = "sha256-zlxD45JnbhIgdJxMmGxGMUBcQPcgzpu3s4bLX939jL0=";
80 # Fixes invalid syntax from a previous bad patch in tests
82 url = "https://github.com/qt/qtpim/commit/2aefdd8bd28a4decf9ef8381f5b255f39f1ee90c.patch";
83 hash = "sha256-mg93QF3hi50igw1/Ok7fEs9iCaN6co1+p2/5fQtxTmc=";
85 # Unit test account for QList index change
87 url = "https://github.com/qt/qtpim/commit/79b41af6a4117f5efb0298289e20c30b4d0b0b2e.patch";
88 hash = "sha256-u+cLl4lu6r2+j5GAiasqbB6/OZPz5A6GpSB33vd/VBg=";
90 # Remove invalid method overload which confuses the QML engine
92 url = "https://github.com/qt/qtpim/commit/5679a6141c76ae7d64c3acc8a87b1adb048289e0.patch";
93 hash = "sha256-z8f8kLhC9CqBOfGPL8W9KJq7MwALAAicXfRkHiQEVJ4=";
95 # Specify enum flag type properly in unit test
97 url = "https://github.com/qt/qtpim/commit/a43cc24e57db8d3c3939fa540d67da3294dcfc5c.patch";
98 hash = "sha256-SsYkxX6prxi8VRZr4az+wqawcRN8tR3UuIFswJL+3T4=";
100 # Update qHash methods to return size_t instead of uint
102 url = "https://github.com/qt/qtpim/commit/9c698155d82fc2b68a87c59d0443c33f9085b117.patch";
103 hash = "sha256-rb8D8taaglhQikYSAPrtLvazgIw8Nga/a9+J21k8gIo=";
105 # Mark virtual methods with override keyword
107 url = "https://github.com/qt/qtpim/commit/f34cf2ff2b0f428d5b8a70763b29088075ebbd1c.patch";
108 hash = "sha256-tNPOEVpx1eqHx5T23ueW32KxMQ/SB+TBCJ4PZ6SA3LI=";
110 # Fix calendardemo example
112 url = "https://github.com/qt/qtpim/commit/a66590d473753bc49105d3132fb9e4150c92a14a.patch";
113 hash = "sha256-RPRtGQ24NQYewnv6+IqYITpwD/XxuK68a1iKgFmKm3c=";
115 # Make the tests pass on big endian systems
117 url = "https://github.com/qt/qtpim/commit/7802f038ed1391078e27fa3f37d785a69314537b.patch";
118 hash = "sha256-hogUXyPXjGE0q53PWOjiQbQ2YzOsvrJ7mo9djGIbjVQ=";
120 # Fix some deprecated QChar constructor issues in unit tests
122 url = "https://github.com/qt/qtpim/commit/114615812dcf9398c957b0833e860befe15f840f.patch";
123 hash = "sha256-yZ1qs8y5DSq8FDXRPyuSPRIzjEUTWAhpVide/b+xaLQ=";
125 # Accessors should be const
127 url = "https://github.com/qt/qtpim/commit/a2bf7cdf05c264b5dd2560f799760b5508f154e4.patch";
128 hash = "sha256-+YfPrKyOKnPkqFokwW/aDsEivg4TzdJwQpDdAtM+rQE=";
130 # Enforce detail access constraints in contact operations by default
132 url = "https://github.com/qt/qtpim/commit/8765a35233aa21a932ee92bbbb92a5f8edd4dc68.patch";
133 hash = "sha256-vp/enerVecEXz4zyxQ66DG+fVVWxI4bYnLj92qaaqNk=";
135 # Fixes broken file generation, which breaks reverse dependencies that try to find one of its modules
137 url = "https://github.com/qt/qtpim/commit/4b2bdce30bd0629c9dc0567af6eeaa1d038f3152.patch";
138 hash = "sha256-2dXhkZyxPvY2KQq2veerAlpXkpU5/FeArWRlm1aOcEY=";
141 ## Patches that haven't been upstreamed
143 # Fix tst_QContactManager::compareVariant_data test
145 url = "https://salsa.debian.org/qt-kde-team/qt/qtpim/-/raw/360682f88457b5ae7c92f32f574e51ccc5edbea0/debian/patches/1001_fix-qtdatetime-null-comparison.patch";
146 hash = "sha256-k/rO9QjwSlRChwFTZLkxDjZWqFkua4FNbaNf1bJKLxc=";
148 # Avoid crash while parsing vCards from different threads
150 url = "https://salsa.debian.org/qt-kde-team/qt/qtpim/-/raw/360682f88457b5ae7c92f32f574e51ccc5edbea0/debian/patches/1002_Avoid-crash-while-parsing-vcards-from-different-threads.patch";
151 hash = "sha256-zhayAoWgcmKosEGVBy2k6a2e6BxyVwfGX18tBbzqEk8=";
153 # Adapt to JSON parser behavior change in Qt 5.15
155 url = "https://salsa.debian.org/qt-kde-team/qt/qtpim/-/raw/360682f88457b5ae7c92f32f574e51ccc5edbea0/debian/patches/1003_adapt_to_json_parser_change.patch";
156 hash = "sha256-qAIa48hmDd8vMH/ywqW+22vISKai76XnjgFuB+tQbIU=";
158 # Fix version being 0.0.0
160 url = "https://salsa.debian.org/qt-kde-team/qt/qtpim/-/raw/360682f88457b5ae7c92f32f574e51ccc5edbea0/debian/patches/2000_revert_module_version.patch";
161 hash = "sha256-6wg/eVu9J83yvIO428U1FX3otz58tAy6pCvp7fqOBKU=";
164 qtscript = [ ./qtscript.patch ];
165 qtserialport = [ ./qtserialport.patch ];
167 # Enable building with udisks support
169 url = "https://salsa.debian.org/qt-kde-team/qt/qtsystems/-/raw/a23fd92222c33479d7f3b59e48116def6b46894c/debian/patches/2001_build_with_udisk.patch";
170 hash = "sha256-B/z/+tai01RU/bAJSCp5a0/dGI8g36nwso8MiJv27YM=";
175 url = "https://raw.githubusercontent.com/Homebrew/formula-patches/a6f16c6daea3b5a1f7bc9f175d1645922c131563/qt5/qt5-webengine-python3.patch";
176 hash = "sha256-rUSDwTucXVP3Obdck7LRTeKZ+JYQSNhQ7+W31uHZ9yM=";
179 url = "https://raw.githubusercontent.com/Homebrew/formula-patches/7ae178a617d1e0eceb742557e63721af949bd28a/qt5/qt5-webengine-chromium-python3.patch";
181 extraPrefix = "src/3rdparty/";
182 hash = "sha256-MZGYeMdGzwypfKoSUaa56K3inbcGRx7he/+AFyk5ekA=";
185 url = "https://raw.githubusercontent.com/Homebrew/formula-patches/7ae178a617d1e0eceb742557e63721af949bd28a/qt5/qt5-webengine-gcc12.patch";
187 extraPrefix = "src/3rdparty/";
188 hash = "sha256-s4GsGMJTBNWw2gTJuIEP3tqT82AmTsR2mbj59m2p6rM=";
190 ./qtwebengine-link-pulseaudio.patch
191 ] ++ lib.optionals stdenv.isDarwin [
192 ./qtwebengine-darwin-no-platform-check.patch
193 ./qtwebengine-mac-dont-set-dsymutil-path.patch
194 ./qtwebengine-darwin-checks.patch
198 name = "qtwebkit-bison-3.7-build.patch";
199 url = "https://github.com/qtwebkit/qtwebkit/commit/d92b11fea65364fefa700249bd3340e0cd4c5b31.patch";
200 sha256 = "0h8ymfnwgkjkwaankr3iifiscsvngqpwb91yygndx344qdiw9y0n";
203 name = "qtwebkit-glib-2.68.patch";
204 url = "https://github.com/qtwebkit/qtwebkit/pull/1058/commits/5b698ba3faffd4e198a45be9fe74f53307395e4b.patch";
205 sha256 = "0a3xv0h4lv8wggckgy8cg8xnpkg7n9h45312pdjdnnwy87xvzss0";
208 name = "qtwebkit-darwin-handle.patch";
209 url = "https://github.com/qtwebkit/qtwebkit/commit/5c272a21e621a66862821d3ae680f27edcc64c19.patch";
210 sha256 = "9hjqLyABz372QDgoq7nXXXQ/3OXBGcYN1/92ekcC3WE=";
213 ./qtwebkit-icu68.patch
214 ] ++ lib.optionals stdenv.isDarwin [
215 ./qtwebkit-darwin-no-readline.patch
216 ./qtwebkit-darwin-no-qos-classes.patch
218 qttools = [ ./qttools.patch ];
223 qtModule = callPackage ../qtModule.nix {
225 # Use a variant of mkDerivation that does not include wrapQtApplications
226 # to avoid cyclic dependencies between Qt modules.
228 (callPackage ../mkDerivation.nix { wrapQtAppsHook = null; }) stdenv.mkDerivation;
231 callPackage = self.newScope { inherit qtCompatVersion qtModule srcs stdenv; };
234 inherit callPackage qtCompatVersion qtModule srcs;
236 mkDerivationWith = callPackage ../mkDerivation.nix { };
238 mkDerivation = callPackage ({ mkDerivationWith }: mkDerivationWith stdenv.mkDerivation) { };
240 qtbase = callPackage ../modules/qtbase.nix {
241 inherit (srcs.qtbase) src version;
242 patches = patches.qtbase;
243 inherit bison cups harfbuzz libGL;
244 withGtk3 = !stdenv.isDarwin; inherit dconf gtk3;
245 inherit developerBuild decryptSslTraffic;
246 inherit (darwin.apple_sdk_11_0.frameworks) AGL AppKit ApplicationServices AVFoundation Carbon Cocoa CoreAudio CoreBluetooth
247 CoreLocation CoreServices DiskArbitration Foundation OpenGL MetalKit IOKit;
248 libobjc = darwin.apple_sdk_11_0.objc4;
249 xcbuild = darwin.apple_sdk_11_0.xcodebuild;
252 qt3d = callPackage ../modules/qt3d.nix {};
253 qtcharts = callPackage ../modules/qtcharts.nix {};
254 qtconnectivity = callPackage ../modules/qtconnectivity.nix {
255 inherit (darwin.apple_sdk_11_0.frameworks) IOBluetooth;
257 qtdatavis3d = callPackage ../modules/qtdatavis3d.nix {};
258 qtdeclarative = callPackage ../modules/qtdeclarative.nix {};
259 qtdoc = callPackage ../modules/qtdoc.nix {};
260 qtgamepad = callPackage ../modules/qtgamepad.nix {
261 inherit (darwin.apple_sdk_11_0.frameworks) GameController;
263 qtgraphicaleffects = callPackage ../modules/qtgraphicaleffects.nix {};
264 qtimageformats = callPackage ../modules/qtimageformats.nix {};
265 qtlocation = callPackage ../modules/qtlocation.nix {};
266 qtlottie = callPackage ../modules/qtlottie.nix {};
267 qtmacextras = callPackage ../modules/qtmacextras.nix {};
268 qtmultimedia = callPackage ../modules/qtmultimedia.nix {
269 inherit gstreamer gst-plugins-base;
271 qtnetworkauth = callPackage ../modules/qtnetworkauth.nix {};
272 qtpim = callPackage ../modules/qtpim.nix {};
273 qtpositioning = callPackage ../modules/qtpositioning.nix {};
275 qtquickcontrols = callPackage ../modules/qtquickcontrols.nix {};
276 qtquickcontrols2 = callPackage ../modules/qtquickcontrols2.nix {};
277 qtremoteobjects = callPackage ../modules/qtremoteobjects.nix {};
278 qtscript = callPackage ../modules/qtscript.nix {};
279 qtsensors = callPackage ../modules/qtsensors.nix {};
280 qtserialbus = callPackage ../modules/qtserialbus.nix {};
281 qtserialport = callPackage ../modules/qtserialport.nix {};
282 qtspeech = callPackage ../modules/qtspeech.nix {};
283 qtsvg = callPackage ../modules/qtsvg.nix {};
284 qtsystems = callPackage ../modules/qtsystems.nix {};
285 qtscxml = callPackage ../modules/qtscxml.nix {};
286 qttools = callPackage ../modules/qttools.nix {};
287 qttranslations = callPackage ../modules/qttranslations.nix {};
288 qtvirtualkeyboard = callPackage ../modules/qtvirtualkeyboard.nix {};
289 qtwayland = callPackage ../modules/qtwayland.nix {};
290 qtwebchannel = callPackage ../modules/qtwebchannel.nix {};
291 qtwebengine = callPackage ../modules/qtwebengine.nix {
292 # The version of Chromium used by Qt WebEngine 5.15.x does not build with clang 16 due
293 # to the following errors:
294 # * -Wenum-constexpr-conversion: This is a downgradable error in clang 16, but it is planned
295 # to be made into a hard error in a future version of clang. Patches are not available for
296 # the version of v8 used by Chromium in Qt WebEngine, and fixing the code is non-trivial.
297 # * -Wincompatible-function-pointer-types: This is also a downgradable error generated
298 # starting with clang 16. Patches are available upstream that can be backported.
299 # Because the first error is non-trivial to fix and suppressing it risks future breakage,
300 # clang is pinned to clang 15. That also makes fixing the second set of errors unnecessary.
302 let stdenv' = if stdenv.cc.isClang then overrideLibcxx llvmPackages_15.stdenv else stdenv;
303 in if stdenv'.isDarwin then overrideSDK stdenv' "11.0" else stdenv';
304 inherit (srcs.qtwebengine) version;
307 # update catapult for python3 compatibility
308 rm -r src/3rdparty/chromium/third_party/catapult
309 cp -r ${srcs.catapult} src/3rdparty/chromium/third_party/catapult
311 inherit (darwin) cctools xnu;
312 inherit (darwin.apple_sdk_11_0) libpm libunwind;
313 inherit (darwin.apple_sdk_11_0.libs) sandbox;
314 inherit (darwin.apple_sdk_11_0.frameworks) ApplicationServices AVFoundation Foundation ForceFeedback GameController AppKit
315 ImageCaptureCore CoreBluetooth IOBluetooth CoreWLAN Quartz Cocoa LocalAuthentication
316 MediaPlayer MediaAccessibility SecurityInterface Vision CoreML OpenDirectory Accelerate;
317 libobjc = darwin.apple_sdk_11_0.objc4;
319 qtwebglplugin = callPackage ../modules/qtwebglplugin.nix {};
320 qtwebkit = callPackage ../modules/qtwebkit.nix {
321 inherit (darwin) ICU;
322 inherit (darwin.apple_sdk_11_0.frameworks) OpenGL;
324 qtwebsockets = callPackage ../modules/qtwebsockets.nix {};
325 qtwebview = callPackage ../modules/qtwebview.nix {
326 inherit (darwin.apple_sdk_11_0.frameworks) CoreFoundation WebKit;
328 qtx11extras = callPackage ../modules/qtx11extras.nix {};
329 qtxmlpatterns = callPackage ../modules/qtxmlpatterns.nix {};
331 env = callPackage ../qt-env.nix {};
332 full = callPackage ({ env, qtbase }: env "qt-full-${qtbase.version}") { }
333 # `with self` is ok to use here because having these spliced is unnecessary
335 qt3d qtcharts qtconnectivity qtdeclarative qtdoc qtgraphicaleffects
336 qtimageformats qtlocation qtmultimedia qtquickcontrols qtquickcontrols2
337 qtscript qtsensors qtserialport qtsvg qttools qttranslations
338 qtvirtualkeyboard qtwebchannel qtwebengine qtwebsockets
339 qtwebview qtx11extras qtxmlpatterns qtlottie qtdatavis3d
340 ] ++ lib.optional (!stdenv.isDarwin) qtwayland
341 ++ lib.optional (stdenv.isDarwin) qtmacextras);
343 qmake = callPackage ({ qtbase }: makeSetupHook {
345 ${if stdenv.buildPlatform == stdenv.hostPlatform
346 then "propagatedBuildInputs"
347 else "depsTargetTargetPropagated"} = [ qtbase.dev ];
350 fix_qmake_libtool = ../hooks/fix-qmake-libtool.sh;
352 } ../hooks/qmake-hook.sh) { };
354 wrapQtAppsHook = callPackage ({ makeBinaryWrapper, qtbase, qtwayland }: makeSetupHook {
355 name = "wrap-qt5-apps-hook";
356 propagatedBuildInputs = [ qtbase.dev makeBinaryWrapper ]
357 ++ lib.optional stdenv.isLinux qtwayland.dev;
358 } ../hooks/wrap-qt-apps-hook.sh) { };
361 baseScope = makeScopeWithSplicing' {
362 otherSplices = generateSplicesForMkScope "qt5";
366 bootstrapScope = baseScope.overrideScope(final: prev: {
367 qtbase = prev.qtbase.override { qttranslations = null; };
368 qtdeclarative = null;
371 finalScope = baseScope.overrideScope(final: prev: {
372 # qttranslations causes eval-time infinite recursion when
373 # cross-compiling; disabled for now.
375 if stdenv.buildPlatform == stdenv.hostPlatform
376 then bootstrapScope.qttranslations
378 qutebrowser = final.callPackage ../../../../applications/networking/browsers/qutebrowser { };