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