nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1/*
2 # Updates
3
4 Run `./fetch.sh` to update package sources from Git.
5 Check for any minor version changes.
6*/
7
8{
9 makeScopeWithSplicing',
10 generateSplicesForMkScope,
11 lib,
12 stdenv,
13 gcc14Stdenv,
14 fetchurl,
15 fetchgit,
16 fetchpatch,
17 fetchFromGitHub,
18 makeSetupHook,
19 makeWrapper,
20 bison,
21 cups ? null,
22 harfbuzz,
23 libGL,
24 perl,
25 python3,
26 gstreamer,
27 gst-plugins-base,
28 gtk3,
29 dconf,
30 llvmPackages_19,
31 darwin,
32
33 # options
34 developerBuild ? false,
35 decryptSslTraffic ? false,
36 debug ? false,
37 config,
38}:
39
40let
41
42 srcs = import ./srcs.nix { inherit lib fetchgit fetchFromGitHub; };
43
44 qtCompatVersion = srcs.qtbase.version;
45
46 patches = {
47 qtbase = [
48 ./qtbase.patch.d/0003-qtbase-mkspecs.patch
49 ./qtbase.patch.d/0004-qtbase-replace-libdir.patch
50 ./qtbase.patch.d/0005-qtbase-cmake.patch
51 ./qtbase.patch.d/0006-qtbase-gtk3.patch
52 ./qtbase.patch.d/0007-qtbase-xcursor.patch
53 ./qtbase.patch.d/0008-qtbase-tzdir.patch
54 ./qtbase.patch.d/0009-qtbase-qtpluginpath.patch
55 ./qtbase.patch.d/0010-qtbase-assert.patch
56 ./qtbase.patch.d/0011-fix-header_module.patch
57 (fetchpatch {
58 name = "0012-qtbase-loongarch64.patch";
59 url = "https://gitlab.alpinelinux.org/alpine/aports/-/raw/81b14ae4eed038662b53cd20786fd5e0816279ec/community/qt5-qtbase/loongarch64.patch";
60 hash = "sha256-BnpejF6/L73kVVts0R0/OMbVN8G4DXVFwBMJPLU9QbE=";
61 })
62 ];
63 qtdeclarative = [
64 ./qtdeclarative.patch
65 # prevent headaches from stale qmlcache data
66 ./qtdeclarative-default-disable-qmlcache.patch
67 # add version specific QML import path
68 ./qtdeclarative-qml-paths.patch
69 ];
70 qtlocation = lib.optionals stdenv.cc.isClang [
71 # Fix build with Clang 16
72 (fetchpatch {
73 url = "https://github.com/boostorg/numeric_conversion/commit/50a1eae942effb0a9b90724323ef8f2a67e7984a.patch";
74 stripLen = 1;
75 extraPrefix = "src/3rdparty/mapbox-gl-native/deps/boost/1.65.1/";
76 hash = "sha256-UEvIXzn387f9BAeBdhheStD/4M7en+rmqX8C6gstl6k=";
77 })
78 ];
79 qtpim = [
80 ## Upstream patches after the Qt6 transition that apply without problems & fix bugs
81
82 # Fixes QList -> QSet conversion
83 (fetchpatch {
84 url = "https://github.com/qt/qtpim/commit/f337e281e28904741a3b1ac23d15c3a83ef2bbc9.patch";
85 hash = "sha256-zlxD45JnbhIgdJxMmGxGMUBcQPcgzpu3s4bLX939jL0=";
86 })
87 # Fixes invalid syntax from a previous bad patch in tests
88 (fetchpatch {
89 url = "https://github.com/qt/qtpim/commit/2aefdd8bd28a4decf9ef8381f5b255f39f1ee90c.patch";
90 hash = "sha256-mg93QF3hi50igw1/Ok7fEs9iCaN6co1+p2/5fQtxTmc=";
91 })
92 # Unit test account for QList index change
93 (fetchpatch {
94 url = "https://github.com/qt/qtpim/commit/79b41af6a4117f5efb0298289e20c30b4d0b0b2e.patch";
95 hash = "sha256-u+cLl4lu6r2+j5GAiasqbB6/OZPz5A6GpSB33vd/VBg=";
96 })
97 # Remove invalid method overload which confuses the QML engine
98 (fetchpatch {
99 url = "https://github.com/qt/qtpim/commit/5679a6141c76ae7d64c3acc8a87b1adb048289e0.patch";
100 hash = "sha256-z8f8kLhC9CqBOfGPL8W9KJq7MwALAAicXfRkHiQEVJ4=";
101 })
102 # Specify enum flag type properly in unit test
103 (fetchpatch {
104 url = "https://github.com/qt/qtpim/commit/a43cc24e57db8d3c3939fa540d67da3294dcfc5c.patch";
105 hash = "sha256-SsYkxX6prxi8VRZr4az+wqawcRN8tR3UuIFswJL+3T4=";
106 })
107 # Update qHash methods to return size_t instead of uint
108 (fetchpatch {
109 url = "https://github.com/qt/qtpim/commit/9c698155d82fc2b68a87c59d0443c33f9085b117.patch";
110 hash = "sha256-rb8D8taaglhQikYSAPrtLvazgIw8Nga/a9+J21k8gIo=";
111 })
112 # Mark virtual methods with override keyword
113 (fetchpatch {
114 url = "https://github.com/qt/qtpim/commit/f34cf2ff2b0f428d5b8a70763b29088075ebbd1c.patch";
115 hash = "sha256-tNPOEVpx1eqHx5T23ueW32KxMQ/SB+TBCJ4PZ6SA3LI=";
116 })
117 # Fix calendardemo example
118 (fetchpatch {
119 url = "https://github.com/qt/qtpim/commit/a66590d473753bc49105d3132fb9e4150c92a14a.patch";
120 hash = "sha256-RPRtGQ24NQYewnv6+IqYITpwD/XxuK68a1iKgFmKm3c=";
121 })
122 # Make the tests pass on big endian systems
123 (fetchpatch {
124 url = "https://github.com/qt/qtpim/commit/7802f038ed1391078e27fa3f37d785a69314537b.patch";
125 hash = "sha256-hogUXyPXjGE0q53PWOjiQbQ2YzOsvrJ7mo9djGIbjVQ=";
126 })
127 # Fix some deprecated QChar constructor issues in unit tests
128 (fetchpatch {
129 url = "https://github.com/qt/qtpim/commit/114615812dcf9398c957b0833e860befe15f840f.patch";
130 hash = "sha256-yZ1qs8y5DSq8FDXRPyuSPRIzjEUTWAhpVide/b+xaLQ=";
131 })
132 # Provide interface for accessing all extended metadata from collections
133 (fetchpatch {
134 url = "https://github.com/qt/qtpim/commit/5bdfb9127b3f6c9863def0578c7a8734a5156ea9.patch";
135 hash = "sha256-asJNa8tcdtovVE579FjZg1CHeCmvRJ8otQeSrEdrXdQ=";
136 })
137 # Accessors should be const
138 (fetchpatch {
139 url = "https://github.com/qt/qtpim/commit/a2bf7cdf05c264b5dd2560f799760b5508f154e4.patch";
140 hash = "sha256-+YfPrKyOKnPkqFokwW/aDsEivg4TzdJwQpDdAtM+rQE=";
141 })
142 # Enforce detail access constraints in contact operations by default
143 (fetchpatch {
144 url = "https://github.com/qt/qtpim/commit/8765a35233aa21a932ee92bbbb92a5f8edd4dc68.patch";
145 hash = "sha256-vp/enerVecEXz4zyxQ66DG+fVVWxI4bYnLj92qaaqNk=";
146 })
147 # Fixes broken file generation, which breaks reverse dependencies that try to find one of its modules
148 (fetchpatch {
149 url = "https://github.com/qt/qtpim/commit/4b2bdce30bd0629c9dc0567af6eeaa1d038f3152.patch";
150 hash = "sha256-2dXhkZyxPvY2KQq2veerAlpXkpU5/FeArWRlm1aOcEY=";
151 })
152
153 ## Patches that haven't been upstreamed
154
155 # Fix tst_QContactManager::compareVariant_data test
156 (fetchpatch {
157 url = "https://salsa.debian.org/qt-kde-team/qt/qtpim/-/raw/360682f88457b5ae7c92f32f574e51ccc5edbea0/debian/patches/1001_fix-qtdatetime-null-comparison.patch";
158 hash = "sha256-k/rO9QjwSlRChwFTZLkxDjZWqFkua4FNbaNf1bJKLxc=";
159 })
160 # Avoid crash while parsing vCards from different threads
161 (fetchpatch {
162 url = "https://salsa.debian.org/qt-kde-team/qt/qtpim/-/raw/360682f88457b5ae7c92f32f574e51ccc5edbea0/debian/patches/1002_Avoid-crash-while-parsing-vcards-from-different-threads.patch";
163 hash = "sha256-zhayAoWgcmKosEGVBy2k6a2e6BxyVwfGX18tBbzqEk8=";
164 })
165 # Adapt to JSON parser behavior change in Qt 5.15
166 (fetchpatch {
167 url = "https://salsa.debian.org/qt-kde-team/qt/qtpim/-/raw/360682f88457b5ae7c92f32f574e51ccc5edbea0/debian/patches/1003_adapt_to_json_parser_change.patch";
168 hash = "sha256-qAIa48hmDd8vMH/ywqW+22vISKai76XnjgFuB+tQbIU=";
169 })
170 # Fix version being 0.0.0
171 (fetchpatch {
172 url = "https://salsa.debian.org/qt-kde-team/qt/qtpim/-/raw/360682f88457b5ae7c92f32f574e51ccc5edbea0/debian/patches/2000_revert_module_version.patch";
173 hash = "sha256-6wg/eVu9J83yvIO428U1FX3otz58tAy6pCvp7fqOBKU=";
174 })
175 ];
176 qtscript = [
177 ./qtscript.patch
178 (fetchpatch {
179 name = "qtscript-loongarch64.patch";
180 url = "https://gitlab.alpinelinux.org/alpine/aports/-/raw/2fa4f3b28affc29835fcca5c75431f19ff3754a3/community/qt5-qtscript/qtscript-loongarch64.patch";
181 hash = "sha256-DUTXX20ClqGRYat8zk3/Facc1IyAw58qCXrbUaDLyiM=";
182 })
183 ];
184 qtserialport = [ ./qtserialport.patch ];
185 qtsystems = [
186 # Fix crash if no X11 display available
187 (fetchpatch {
188 url = "https://salsa.debian.org/qt-kde-team/qt/qtsystems/-/raw/1a4df40671d6f1bb0657a9dfdae4cd9bd48fcf21/debian/patches/1005_check_XOpenDisplay.patch";
189 hash = "sha256-/onla2nlUSySEgz2IYOYajx/LZkJzAKDyxwAZzy0Ivs=";
190 })
191
192 # Enable building with udisks support
193 (fetchpatch {
194 url = "https://salsa.debian.org/qt-kde-team/qt/qtsystems/-/raw/a23fd92222c33479d7f3b59e48116def6b46894c/debian/patches/2001_build_with_udisk.patch";
195 hash = "sha256-B/z/+tai01RU/bAJSCp5a0/dGI8g36nwso8MiJv27YM=";
196 })
197 ];
198 qtwebengine = [
199 ./qtwebengine-link-pulseaudio.patch
200 # Fixes Chromium build failure with Ninja 1.12.
201 # See: https://bugreports.qt.io/browse/QTBUG-124375
202 # Backport of: https://code.qt.io/cgit/qt/qtwebengine-chromium.git/commit/?id=a766045f65f934df3b5f1aa63bc86fbb3e003a09
203 ./qtwebengine-ninja-1.12.patch
204 ]
205 ++ lib.optionals stdenv.hostPlatform.isDarwin [
206 ./qtwebengine-darwin-no-platform-check.patch
207 ./qtwebengine-mac-dont-set-dsymutil-path.patch
208 ./qtwebengine-darwin-checks.patch
209 ];
210 qtwebkit = [
211 (fetchpatch {
212 name = "qtwebkit-python39-json.patch";
213 url = "https://github.com/qtwebkit/qtwebkit/commit/78360c01c796b6260bf828bc9c8a0ef73c5132fd.patch";
214 sha256 = "yCX/UL666BPxjnxT6rIsUrJsPcSWHhZwMFJfuHhbkhk=";
215 })
216 (fetchpatch {
217 name = "qtwebkit-bison-3.7-build.patch";
218 url = "https://github.com/qtwebkit/qtwebkit/commit/d92b11fea65364fefa700249bd3340e0cd4c5b31.patch";
219 sha256 = "0h8ymfnwgkjkwaankr3iifiscsvngqpwb91yygndx344qdiw9y0n";
220 })
221 (fetchpatch {
222 name = "qtwebkit-glib-2.68.patch";
223 url = "https://github.com/qtwebkit/qtwebkit/pull/1058/commits/5b698ba3faffd4e198a45be9fe74f53307395e4b.patch";
224 sha256 = "0a3xv0h4lv8wggckgy8cg8xnpkg7n9h45312pdjdnnwy87xvzss0";
225 })
226 (fetchpatch {
227 name = "qtwebkit-darwin-handle.patch";
228 url = "https://github.com/qtwebkit/qtwebkit/commit/5c272a21e621a66862821d3ae680f27edcc64c19.patch";
229 sha256 = "9hjqLyABz372QDgoq7nXXXQ/3OXBGcYN1/92ekcC3WE=";
230 })
231 (fetchpatch {
232 name = "qtwebkit-libxml2-api-change.patch";
233 url = "https://github.com/WebKit/WebKit/commit/1bad176b2496579d760852c80cff3ad9fb7c3a4b.patch";
234 sha256 = "WZEj+UuKhgJBM7auhND3uddk1wWdTY728jtiWVe7CSI=";
235 })
236 ./qtwebkit.patch
237 ./qtwebkit-icu68.patch
238 ./qtwebkit-cstdint.patch
239 ]
240 ++ lib.optionals stdenv.hostPlatform.isDarwin [
241 ./qtwebkit-darwin-no-readline.patch
242 ./qtwebkit-darwin-no-qos-classes.patch
243 ];
244 qttools = [ ./qttools.patch ];
245 };
246
247 addPackages =
248 self:
249 let
250 qtModuleWithStdenv =
251 stdenv:
252 callPackage ../qtModule.nix {
253 inherit patches;
254 # Use a variant of mkDerivation that does not include wrapQtApplications
255 # to avoid cyclic dependencies between Qt modules.
256 mkDerivation = (callPackage ../mkDerivation.nix { wrapQtAppsHook = null; }) stdenv.mkDerivation;
257 };
258 qtModule = qtModuleWithStdenv stdenv;
259
260 callPackage = self.newScope {
261 inherit
262 qtCompatVersion
263 qtModule
264 srcs
265 stdenv
266 ;
267 };
268 in
269 {
270
271 inherit
272 callPackage
273 qtCompatVersion
274 qtModule
275 srcs
276 ;
277
278 mkDerivationWith = callPackage ../mkDerivation.nix { };
279
280 mkDerivation = callPackage ({ mkDerivationWith }: mkDerivationWith stdenv.mkDerivation) { };
281
282 qtbase = callPackage ../modules/qtbase.nix {
283 inherit (srcs.qtbase) src version;
284 patches = patches.qtbase;
285 inherit
286 bison
287 cups
288 harfbuzz
289 libGL
290 ;
291 withGtk3 = !stdenv.hostPlatform.isDarwin;
292 inherit dconf gtk3;
293 inherit developerBuild decryptSslTraffic;
294 };
295
296 qt3d = callPackage ../modules/qt3d.nix { };
297 qtcharts = callPackage ../modules/qtcharts.nix { };
298 qtconnectivity = callPackage ../modules/qtconnectivity.nix { };
299 qtdatavis3d = callPackage ../modules/qtdatavis3d.nix { };
300 qtdeclarative = callPackage ../modules/qtdeclarative.nix { };
301 qtdoc = callPackage ../modules/qtdoc.nix { };
302 qtgamepad = callPackage ../modules/qtgamepad.nix { };
303 qtgraphicaleffects = callPackage ../modules/qtgraphicaleffects.nix { };
304 qtimageformats = callPackage ../modules/qtimageformats.nix { };
305 qtlocation = callPackage ../modules/qtlocation.nix { };
306 qtlottie = callPackage ../modules/qtlottie.nix { };
307 qtmacextras = callPackage ../modules/qtmacextras.nix { };
308 qtmultimedia = callPackage ../modules/qtmultimedia.nix {
309 inherit gstreamer gst-plugins-base;
310 };
311 qtnetworkauth = callPackage ../modules/qtnetworkauth.nix { };
312 qtpim = callPackage ../modules/qtpim.nix { };
313 qtpositioning = callPackage ../modules/qtpositioning.nix { };
314 qtpurchasing = callPackage ../modules/qtpurchasing.nix { };
315 qtquick1 = null;
316 qtquick3d = callPackage ../modules/qtquick3d.nix { };
317 qtquickcontrols = callPackage ../modules/qtquickcontrols.nix { };
318 qtquickcontrols2 = callPackage ../modules/qtquickcontrols2.nix { };
319 qtremoteobjects = callPackage ../modules/qtremoteobjects.nix { };
320 qtscript = callPackage ../modules/qtscript.nix { };
321 qtsensors = callPackage ../modules/qtsensors.nix { };
322 qtserialbus = callPackage ../modules/qtserialbus.nix { };
323 qtserialport = callPackage ../modules/qtserialport.nix { };
324 qtspeech = callPackage ../modules/qtspeech.nix { };
325 qtsvg = callPackage ../modules/qtsvg.nix { };
326 qtsystems = callPackage ../modules/qtsystems.nix { };
327 qtscxml = callPackage ../modules/qtscxml.nix { };
328 qttools = callPackage ../modules/qttools.nix { };
329 qttranslations = callPackage ../modules/qttranslations.nix { };
330 qtvirtualkeyboard = callPackage ../modules/qtvirtualkeyboard.nix { };
331 qtwayland = callPackage ../modules/qtwayland.nix { };
332 qtwebchannel = callPackage ../modules/qtwebchannel.nix { };
333 qtwebengine =
334 # Actually propagating stdenv change
335 let
336 # Won’t build with Clang 20, as `-Wenum-constexpr-conversion`
337 # was made a hard error.
338 # qt5webengine no longer maintained, FTBFS with GCC 15
339 stdenv' = if stdenv.cc.isClang then llvmPackages_19.stdenv else gcc14Stdenv;
340 qtModule' = qtModuleWithStdenv stdenv';
341 in
342 callPackage ../modules/qtwebengine.nix {
343 inherit (srcs.qtwebengine) version;
344 inherit (darwin) bootstrap_cmds;
345 stdenv = stdenv';
346 qtModule = qtModule';
347 python = python3;
348 };
349 qtwebglplugin = callPackage ../modules/qtwebglplugin.nix { };
350 qtwebkit = callPackage ../modules/qtwebkit.nix { };
351 qtwebsockets = callPackage ../modules/qtwebsockets.nix { };
352 qtwebview = callPackage ../modules/qtwebview.nix { };
353 qtx11extras = callPackage ../modules/qtx11extras.nix { };
354 qtxmlpatterns = callPackage ../modules/qtxmlpatterns.nix { };
355
356 env = callPackage ../qt-env.nix { };
357
358 qmake = callPackage (
359 { qtbase }:
360 makeSetupHook {
361 name = "qmake-hook";
362 ${
363 if stdenv.buildPlatform == stdenv.hostPlatform then
364 "propagatedBuildInputs"
365 else
366 "depsTargetTargetPropagated"
367 } =
368 [ qtbase.dev ];
369 substitutions = {
370 inherit debug;
371 fix_qmake_libtool = ../hooks/fix-qmake-libtool.sh;
372 };
373 } ../hooks/qmake-hook.sh
374 ) { };
375
376 wrapQtAppsHook = callPackage (
377 {
378 makeBinaryWrapper,
379 qtbase,
380 qtwayland,
381 }:
382 makeSetupHook {
383 name = "wrap-qt5-apps-hook";
384 propagatedBuildInputs = [
385 qtbase.dev
386 makeBinaryWrapper
387 ]
388 ++ lib.optional stdenv.hostPlatform.isLinux qtwayland.dev;
389 } ../hooks/wrap-qt-apps-hook.sh
390 ) { };
391 }
392 // lib.optionalAttrs config.allowAliases {
393 full = throw "libsForQt5.full has been removed. Please use individual packages instead."; # Added 2025-10-18
394 };
395
396 baseScope = makeScopeWithSplicing' {
397 otherSplices = generateSplicesForMkScope "qt5";
398 f = addPackages;
399 };
400
401 bootstrapScope = baseScope.overrideScope (
402 final: prev: {
403 qtbase = prev.qtbase.override { qttranslations = null; };
404 qtdeclarative = null;
405 }
406 );
407
408 finalScope = baseScope.overrideScope (
409 final: prev: {
410 # qttranslations causes eval-time infinite recursion when
411 # cross-compiling; disabled for now.
412 qttranslations =
413 if stdenv.buildPlatform == stdenv.hostPlatform then bootstrapScope.qttranslations else null;
414 }
415 );
416in
417finalScope