1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchurl,
6 pkg-config,
7 dbus,
8 lndir,
9 setuptools,
10 dbus-python,
11 sip,
12 pyqt6-sip,
13 pyqt-builder,
14 qt6Packages,
15 pythonOlder,
16 withMultimedia ? true,
17 withWebSockets ? true,
18 withLocation ? true,
19 # Not currently part of PyQt6
20 #, withConnectivity ? true
21 withPrintSupport ? true,
22 cups,
23}:
24
25buildPythonPackage rec {
26 pname = "pyqt6";
27 version = "6.7.0.dev2404081550";
28 format = "pyproject";
29
30 disabled = pythonOlder "3.6";
31
32 src = fetchurl {
33 urls = [
34 "https://riverbankcomputing.com/pypi/packages/PyQt6/PyQt6-${version}.tar.gz"
35 "http://web.archive.org/web/20240411124842if_/https://riverbankcomputing.com/pypi/packages/PyQt6/PyQt6-${version}.tar.gz"
36 ];
37 hash = "sha256-H5qZ/rnruGh+UVSXLZyTSvjagmmli/iYq+7BaIzl1YQ=";
38 };
39
40 patches = [
41 # Fix some wrong assumptions by ./project.py
42 # TODO: figure out how to send this upstream
43 # FIXME: make a version for PyQt6?
44 # ./pyqt5-fix-dbus-mainloop-support.patch
45 # confirm license when installing via pyqt6_sip
46 ./pyqt5-confirm-license.patch
47 ];
48
49 # be more verbose
50 # and normalize version
51 postPatch = ''
52 cat >> pyproject.toml <<EOF
53 [tool.sip.project]
54 verbose = true
55 EOF
56
57 substituteInPlace pyproject.toml \
58 --replace-fail 'version = "${version}"' 'version = "${lib.versions.pad 3 version}"'
59 '';
60
61 enableParallelBuilding = true;
62 # HACK: paralellize compilation of make calls within pyqt's setup.py
63 # pkgs/stdenv/generic/setup.sh doesn't set this for us because
64 # make gets called by python code and not its build phase
65 # format=pyproject means the pip-build-hook hook gets used to build this project
66 # pkgs/development/interpreters/python/hooks/pip-build-hook.sh
67 # does not use the enableParallelBuilding flag
68 postUnpack = ''
69 export MAKEFLAGS+="''${enableParallelBuilding:+-j$NIX_BUILD_CORES}"
70 '';
71
72 outputs = [
73 "out"
74 "dev"
75 ];
76
77 dontWrapQtApps = true;
78
79 nativeBuildInputs =
80 with qt6Packages;
81 [
82 pkg-config
83 lndir
84 sip
85 qtbase
86 qtsvg
87 qtdeclarative
88 qtwebchannel
89 qmake
90 qtquick3d
91 qtquicktimeline
92 ]
93 # ++ lib.optional withConnectivity qtconnectivity
94 ++ lib.optional withMultimedia qtmultimedia
95 ++ lib.optional withWebSockets qtwebsockets
96 ++ lib.optional withLocation qtlocation;
97
98 buildInputs =
99 with qt6Packages;
100 [
101 dbus
102 qtbase
103 qtsvg
104 qtdeclarative
105 pyqt-builder
106 qtquick3d
107 qtquicktimeline
108 ]
109 # ++ lib.optional withConnectivity qtconnectivity
110 ++ lib.optional withWebSockets qtwebsockets
111 ++ lib.optional withLocation qtlocation;
112
113 propagatedBuildInputs =
114 [
115 dbus-python
116 pyqt6-sip
117 setuptools
118 ]
119 # ld: library not found for -lcups
120 ++ lib.optionals (withPrintSupport && stdenv.isDarwin) [ cups ];
121
122 passthru = {
123 inherit sip pyqt6-sip;
124 multimediaEnabled = withMultimedia;
125 WebSocketsEnabled = withWebSockets;
126 };
127
128 dontConfigure = true;
129
130 # Checked using pythonImportsCheck, has no tests
131 doCheck = true;
132
133 pythonImportsCheck =
134 [
135 "PyQt6"
136 "PyQt6.QtCore"
137 "PyQt6.QtQml"
138 "PyQt6.QtWidgets"
139 "PyQt6.QtGui"
140 "PyQt6.QtQuick"
141 ]
142 ++ lib.optional withWebSockets "PyQt6.QtWebSockets"
143 ++ lib.optional withMultimedia "PyQt6.QtMultimedia"
144 # ++ lib.optional withConnectivity "PyQt6.QtConnectivity"
145 ++ lib.optional withLocation "PyQt6.QtPositioning";
146
147 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-Wno-address-of-temporary";
148
149 meta = with lib; {
150 description = "Python bindings for Qt6";
151 homepage = "https://riverbankcomputing.com/";
152 license = licenses.gpl3Only;
153 platforms = platforms.mesaPlatforms;
154 maintainers = with maintainers; [ LunNova ];
155 };
156}