1{
2 newScope,
3 lib,
4 stdenv,
5 generateSplicesForMkScope,
6 makeScopeWithSplicing',
7 fetchurl,
8 fetchpatch2,
9 makeSetupHook,
10 makeWrapper,
11 runCommand,
12 gst_all_1,
13 libglvnd,
14 darwin,
15 apple-sdk_15,
16 darwinMinVersionHook,
17 buildPackages,
18 python3,
19 config,
20}:
21
22let
23 srcs = import ./srcs.nix {
24 inherit fetchurl;
25 mirror = "mirror://qt";
26 };
27
28 addPackages =
29 self:
30 let
31 callPackage = self.newScope ({
32 inherit (self) qtModule;
33 inherit srcs python3 stdenv;
34 });
35
36 # Per <https://doc.qt.io/qt-6/macos.html#supported-versions>.
37 # This should reflect the highest “Build Environment” and the
38 # lowest “Target Platform”.
39 darwinVersionInputs = [
40 apple-sdk_15
41 (darwinMinVersionHook "12.0")
42 ];
43
44 onlyPluginsAndQml =
45 drv:
46 let
47 drv' = drv.__spliced.targetTarget or drv;
48 inherit (self.qtbase) qtPluginPrefix qtQmlPrefix;
49 in
50 (runCommand "${drv'.name}-only-plugins-qml" { } ''
51 mkdir -p $(dirname "$out/${qtPluginPrefix}")
52 test -d "${drv'}/${qtPluginPrefix}" && ln -s "${drv'}/${qtPluginPrefix}" "$out/${qtPluginPrefix}" || true
53 test -d "${drv'}/${qtQmlPrefix}" && ln -s "${drv'}/${qtQmlPrefix}" "$out/${qtQmlPrefix}" || true
54 '');
55 in
56 {
57
58 inherit callPackage srcs darwinVersionInputs;
59
60 qtModule = callPackage ./qtModule.nix {
61 inherit darwinVersionInputs;
62 };
63
64 qtbase = callPackage ./modules/qtbase {
65 withGtk3 = !stdenv.hostPlatform.isMinGW;
66 inherit darwinVersionInputs;
67 inherit (srcs.qtbase) src version;
68 };
69 env = callPackage ./qt-env.nix { };
70 full = callPackage (
71 { env, qtbase }:
72 env "qt-full-${qtbase.version}"
73 # `with self` is ok to use here because having these spliced is unnecessary
74 (
75 with self;
76 [
77 qt3d
78 qt5compat
79 qtcharts
80 qtconnectivity
81 qtdatavis3d
82 qtdeclarative
83 qtdoc
84 qtgraphs
85 qtgrpc
86 qthttpserver
87 qtimageformats
88 qtlanguageserver
89 qtlocation
90 qtlottie
91 qtmultimedia
92 qtmqtt
93 qtnetworkauth
94 qtpositioning
95 qtsensors
96 qtserialbus
97 qtserialport
98 qtshadertools
99 qtspeech
100 qtquick3d
101 qtquick3dphysics
102 qtquickeffectmaker
103 qtquicktimeline
104 qtremoteobjects
105 qtsvg
106 qtscxml
107 qttools
108 qttranslations
109 qtvirtualkeyboard
110 qtwebchannel
111 qtwebengine
112 qtwebsockets
113 qtwebview
114 ]
115 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
116 qtwayland
117 libglvnd
118 ]
119 )
120 ) { };
121
122 qt3d = callPackage ./modules/qt3d.nix { };
123 qt5compat = callPackage ./modules/qt5compat.nix { };
124 qtcharts = callPackage ./modules/qtcharts.nix { };
125 qtconnectivity = callPackage ./modules/qtconnectivity.nix { };
126 qtdatavis3d = callPackage ./modules/qtdatavis3d.nix { };
127 qtdeclarative = callPackage ./modules/qtdeclarative { };
128 qtdoc = callPackage ./modules/qtdoc.nix { };
129 qtgraphs = callPackage ./modules/qtgraphs.nix { };
130 qtgrpc = callPackage ./modules/qtgrpc.nix { };
131 qthttpserver = callPackage ./modules/qthttpserver.nix { };
132 qtimageformats = callPackage ./modules/qtimageformats.nix { };
133 qtlanguageserver = callPackage ./modules/qtlanguageserver.nix { };
134 qtlocation = callPackage ./modules/qtlocation.nix { };
135 qtlottie = callPackage ./modules/qtlottie.nix { };
136 qtmultimedia = callPackage ./modules/qtmultimedia {
137 inherit (gst_all_1)
138 gstreamer
139 gst-plugins-bad
140 gst-plugins-base
141 gst-plugins-good
142 gst-libav
143 gst-vaapi
144 ;
145 };
146 qtmqtt = callPackage ./modules/qtmqtt.nix { };
147 qtnetworkauth = callPackage ./modules/qtnetworkauth.nix { };
148 qtpositioning = callPackage ./modules/qtpositioning.nix { };
149 qtsensors = callPackage ./modules/qtsensors.nix { };
150 qtserialbus = callPackage ./modules/qtserialbus.nix { };
151 qtserialport = callPackage ./modules/qtserialport.nix { };
152 qtshadertools = callPackage ./modules/qtshadertools.nix { };
153 qtspeech = callPackage ./modules/qtspeech.nix { };
154 qtquick3d = callPackage ./modules/qtquick3d.nix { };
155 qtquick3dphysics = callPackage ./modules/qtquick3dphysics.nix { };
156 qtquickeffectmaker = callPackage ./modules/qtquickeffectmaker.nix { };
157 qtquicktimeline = callPackage ./modules/qtquicktimeline.nix { };
158 qtremoteobjects = callPackage ./modules/qtremoteobjects.nix { };
159 qtsvg = callPackage ./modules/qtsvg.nix { };
160 qtscxml = callPackage ./modules/qtscxml.nix { };
161 qttools = callPackage ./modules/qttools { };
162 qttranslations = callPackage ./modules/qttranslations.nix {
163 qttools = self.qttools.override {
164 qtbase = self.qtbase.override { qttranslations = null; };
165 qtdeclarative = null;
166 };
167 };
168 qtvirtualkeyboard = callPackage ./modules/qtvirtualkeyboard.nix { };
169 qtwayland = callPackage ./modules/qtwayland.nix { };
170 qtwebchannel = callPackage ./modules/qtwebchannel.nix { };
171 qtwebengine = callPackage ./modules/qtwebengine {
172 inherit (darwin) bootstrap_cmds;
173 };
174 qtwebsockets = callPackage ./modules/qtwebsockets.nix { };
175 qtwebview = callPackage ./modules/qtwebview.nix { };
176
177 wrapQtAppsHook = callPackage (
178 {
179 makeBinaryWrapper,
180 qtwayland,
181 qtbase,
182 }:
183 makeSetupHook {
184 name = "wrap-qt6-apps-hook";
185 propagatedBuildInputs = [ makeBinaryWrapper ];
186 depsTargetTargetPropagated = [
187 (onlyPluginsAndQml qtbase)
188 ]
189 ++ lib.optionals (lib.meta.availableOn stdenv.targetPlatform qtwayland) [
190 (onlyPluginsAndQml qtwayland)
191 ];
192 } ./hooks/wrap-qt-apps-hook.sh
193 ) { };
194
195 wrapQtAppsNoGuiHook = callPackage (
196 { makeBinaryWrapper, qtbase }:
197 makeSetupHook {
198 name = "wrap-qt6-apps-no-gui-hook";
199 propagatedBuildInputs = [ makeBinaryWrapper ];
200 depsTargetTargetPropagated = [
201 (onlyPluginsAndQml qtbase)
202 ];
203 } ./hooks/wrap-qt-apps-hook.sh
204 ) { };
205
206 qmake = callPackage (
207 { qtbase }:
208 makeSetupHook {
209 name = "qmake6-hook";
210 propagatedBuildInputs = [ qtbase.dev ];
211 substitutions = {
212 fix_qmake_libtool = ./hooks/fix-qmake-libtool.sh;
213 };
214 } ./hooks/qmake-hook.sh
215 ) { };
216 };
217
218 baseScope = makeScopeWithSplicing' {
219 otherSplices = generateSplicesForMkScope "qt6";
220 f = addPackages;
221 };
222in
223baseScope