1{
2 lib,
3 stdenv,
4 cmake,
5 ninja,
6 python,
7 moveBuildTree,
8 shiboken6,
9}:
10
11stdenv.mkDerivation rec {
12 pname = "pyside6";
13
14 inherit (shiboken6) version src;
15
16 sourceRoot = "pyside-setup-everywhere-src-${version}/sources/${pname}";
17
18 # FIXME: cmake/Macros/PySideModules.cmake supposes that all Qt frameworks on macOS
19 # reside in the same directory as QtCore.framework, which is not true for Nix.
20 postPatch = lib.optionalString stdenv.isLinux ''
21 # Don't ignore optional Qt modules
22 substituteInPlace cmake/PySideHelpers.cmake \
23 --replace-fail \
24 'string(FIND "''${_module_dir}" "''${_core_abs_dir}" found_basepath)' \
25 'set (found_basepath 0)'
26 '';
27
28 nativeBuildInputs = [
29 cmake
30 ninja
31 python
32 ] ++ lib.optionals stdenv.isDarwin [ moveBuildTree ];
33
34 buildInputs =
35 with python.pkgs.qt6;
36 [
37 # required
38 qtbase
39 python.pkgs.ninja
40 python.pkgs.packaging
41 python.pkgs.setuptools
42 ]
43 ++ lib.optionals stdenv.isLinux [
44 # optional
45 qt3d
46 qtcharts
47 qtconnectivity
48 qtdatavis3d
49 qtdeclarative
50 qthttpserver
51 qtmultimedia
52 qtnetworkauth
53 qtquick3d
54 qtremoteobjects
55 qtscxml
56 qtsensors
57 qtspeech
58 qtsvg
59 qttools
60 qtwebchannel
61 qtwebengine
62 qtwebsockets
63 ];
64
65 propagatedBuildInputs = [ shiboken6 ];
66
67 cmakeFlags = [ "-DBUILD_TESTS=OFF" ];
68
69 dontWrapQtApps = true;
70
71 postInstall = ''
72 cd ../../..
73 ${python.pythonOnBuildForHost.interpreter} setup.py egg_info --build-type=pyside6
74 cp -r PySide6.egg-info $out/${python.sitePackages}/
75 '';
76
77 meta = with lib; {
78 description = "Python bindings for Qt";
79 license = with licenses; [
80 lgpl3Only
81 gpl2Only
82 gpl3Only
83 ];
84 homepage = "https://wiki.qt.io/Qt_for_Python";
85 maintainers = with maintainers; [
86 gebner
87 Enzime
88 ];
89 platforms = platforms.all;
90 };
91}