summaryrefslogtreecommitdiffstats
path: root/pkgs/development/libraries/qt-6/default.nix
blob: 6f1489005a1226ab048ad9dadbb84f3a0fdf3a49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
{
  newScope,
  lib,
  stdenv,
  callPackages,
  generateSplicesForMkScope,
  makeScopeWithSplicing',
  fetchurl,
  fetchpatch2,
  makeSetupHook,
  makeWrapper,
  runCommand,
  gst_all_1,
  libglvnd,
  darwin,
  apple-sdk_15,
  darwinMinVersionHook,
  buildPackages,
  python3,
  config,
}:

let
  srcs = import ./srcs.nix {
    inherit fetchurl;
    mirror = "mirror://qt";
  };

  addPackages =
    self:
    let
      callPackage = self.newScope {
        inherit (self) qtModule;
        inherit srcs python3 stdenv;
      };

      # Per <https://doc.qt.io/qt-6/macos.html#supported-versions>.
      # This should reflect the highest “Build Environment” and the
      # lowest “Target Platform”.
      darwinVersionInputs = [
        apple-sdk_15
        (darwinMinVersionHook "12.0")
      ];

      onlyPluginsAndQml =
        drv:
        let
          drv' = drv.__spliced.targetTarget or drv;
          inherit (self.qtbase) qtPluginPrefix qtQmlPrefix;
        in
        (runCommand "${drv'.name}-only-plugins-qml" { } ''
          mkdir -p $(dirname "$out/${qtPluginPrefix}")
          test -d "${drv'}/${qtPluginPrefix}" && ln -s "${drv'}/${qtPluginPrefix}" "$out/${qtPluginPrefix}" || true
          test -d "${drv'}/${qtQmlPrefix}" && ln -s "${drv'}/${qtQmlPrefix}" "$out/${qtQmlPrefix}" || true
        '');
    in
    {

      inherit callPackage srcs darwinVersionInputs;

      qtModule = callPackage ./qtModule.nix {
        inherit darwinVersionInputs;
      };

      qtbase = callPackage ./modules/qtbase {
        withGtk3 = !stdenv.hostPlatform.isMinGW;
        inherit darwinVersionInputs;
        inherit (srcs.qtbase) src version;
      };
      env = callPackage ./qt-env.nix { };
      qt3d = callPackage ./modules/qt3d.nix { };
      qt5compat = callPackage ./modules/qt5compat.nix { };
      qtcharts = callPackage ./modules/qtcharts.nix { };
      qtconnectivity = callPackage ./modules/qtconnectivity.nix { };
      qtdatavis3d = callPackage ./modules/qtdatavis3d.nix { };
      qtdeclarative = callPackage ./modules/qtdeclarative { };
      qtdoc = callPackage ./modules/qtdoc.nix { };
      qtgraphs = callPackage ./modules/qtgraphs.nix { };
      qtgrpc = callPackage ./modules/qtgrpc.nix { };
      qthttpserver = callPackage ./modules/qthttpserver.nix { };
      qtimageformats = callPackage ./modules/qtimageformats.nix { };
      qtlanguageserver = callPackage ./modules/qtlanguageserver.nix { };
      qtlocation = callPackage ./modules/qtlocation.nix { };
      qtlottie = callPackage ./modules/qtlottie.nix { };
      qtmultimedia = callPackage ./modules/qtmultimedia {
        inherit (gst_all_1)
          gstreamer
          gst-plugins-bad
          gst-plugins-base
          gst-plugins-good
          gst-libav
          ;
      };
      qtmqtt = callPackage ./modules/qtmqtt.nix { };
      qtnetworkauth = callPackage ./modules/qtnetworkauth.nix { };
      qtpositioning = callPackage ./modules/qtpositioning.nix { };
      qtsensors = callPackage ./modules/qtsensors.nix { };
      qtserialbus = callPackage ./modules/qtserialbus.nix { };
      qtserialport = callPackage ./modules/qtserialport.nix { };
      qtshadertools = callPackage ./modules/qtshadertools.nix { };
      qtspeech = callPackage ./modules/qtspeech.nix { };
      qtquick3d = callPackage ./modules/qtquick3d.nix { };
      qtquick3dphysics = callPackage ./modules/qtquick3dphysics.nix { };
      qtquickeffectmaker = callPackage ./modules/qtquickeffectmaker.nix { };
      qtquicktimeline = callPackage ./modules/qtquicktimeline.nix { };
      qtremoteobjects = callPackage ./modules/qtremoteobjects.nix { };
      qtsvg = callPackage ./modules/qtsvg.nix { };
      qtscxml = callPackage ./modules/qtscxml.nix { };
      qttools = callPackage ./modules/qttools { };
      qttranslations = callPackage ./modules/qttranslations.nix {
        qttools = self.qttools.override {
          qtbase = self.qtbase.override { qttranslations = null; };
          qtdeclarative = null;
        };
      };
      qtvirtualkeyboard = callPackage ./modules/qtvirtualkeyboard.nix { };
      qtwayland = callPackage ./modules/qtwayland.nix { };
      qtwebchannel = callPackage ./modules/qtwebchannel.nix { };
      qtwebengine = callPackage ./modules/qtwebengine {
        inherit (darwin) bootstrap_cmds;
      };
      qtwebsockets = callPackage ./modules/qtwebsockets.nix { };
      qtwebview = callPackage ./modules/qtwebview.nix { };

      wrapQtAppsHook = callPackage (
        {
          wrapQtAppsHook,
          makeBinaryWrapper,
          qtwayland,
          qtbase,
        }:
        makeSetupHook {
          name = "wrap-qt6-apps-hook";
          propagatedBuildInputs = [ makeBinaryWrapper ];
          depsTargetTargetPropagated = [
            (onlyPluginsAndQml qtbase)
          ];
          passthru.tests = callPackages ./tests/wrap-qt-apps-hook.nix {
            inherit qtbase wrapQtAppsHook;
          };
          meta.license = lib.licenses.mit;
        } ./hooks/wrap-qt-apps-hook.sh
      ) { };

      qmake = callPackage (
        { qtbase }:
        makeSetupHook {
          name = "qmake6-hook";
          propagatedBuildInputs = [ qtbase.dev ];
          substitutions = {
            fix_qmake_libtool = ./hooks/fix-qmake-libtool.sh;
          };
          meta.license = lib.licenses.mit;
        } ./hooks/qmake-hook.sh
      ) { };
    }
    // lib.optionalAttrs config.allowAliases {
      full = throw "qt6.full has been removed. Please use individual packages instead."; # Added 2025-10-21
      wrapQtAppsNoGuiHook = lib.warn "wrapQtAppsNoGuiHook is deprecated, use wrapQtAppsHook instead" self.wrapQtAppsHook;
    };

  baseScope = makeScopeWithSplicing' {
    otherSplices = generateSplicesForMkScope "qt6";
    f = addPackages;
  };
in
baseScope