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