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