1{
2 python,
3 pythonAtLeast,
4 disabledIf,
5 fetchurl,
6 lib,
7 stdenv,
8 cmake,
9 libxcrypt,
10 ninja,
11 qt5,
12 shiboken2,
13}:
14stdenv.mkDerivation rec {
15 pname = "pyside2";
16 version = "5.15.11";
17
18 src = fetchurl {
19 url = "https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-${version}-src/pyside-setup-opensource-src-${version}.tar.xz";
20 sha256 = "sha256-2lZ807eFTSegtK/j6J3osvmLem1XOTvlbx/BP3cPryk=";
21 };
22
23 patches = [ ./dont_ignore_optional_modules.patch ];
24
25 postPatch = ''
26 cd sources/pyside2
27 '';
28
29 cmakeFlags = [
30 "-DBUILD_TESTS=OFF"
31 "-DPYTHON_EXECUTABLE=${python.interpreter}"
32 ];
33
34 env.NIX_CFLAGS_COMPILE = "-I${qt5.qtdeclarative.dev}/include/QtQuick/${qt5.qtdeclarative.version}/QtQuick";
35
36 nativeBuildInputs = [
37 cmake
38 ninja
39 qt5.qmake
40 python
41 ];
42
43 buildInputs =
44 (with qt5; [
45 qtbase
46 qtxmlpatterns
47 qtmultimedia
48 qttools
49 qtx11extras
50 qtlocation
51 qtscript
52 qtwebsockets
53 qtwebengine
54 qtwebchannel
55 qtcharts
56 qtsensors
57 qtsvg
58 qt3d
59 ])
60 ++ (with python.pkgs; [ setuptools ])
61 ++ (lib.optionals (python.pythonOlder "3.9") [
62 # see similar issue: 202262
63 # libxcrypt is required for crypt.h for building older python modules
64 libxcrypt
65 ]);
66
67 propagatedBuildInputs = [ shiboken2 ];
68
69 dontWrapQtApps = true;
70
71 postInstall = ''
72 cd ../../..
73 ${python.pythonOnBuildForHost.interpreter} setup.py egg_info --build-type=pyside2
74 cp -r PySide2.egg-info $out/${python.sitePackages}/
75 '';
76
77 meta = with lib; {
78 description = "LGPL-licensed Python bindings for Qt";
79 license = licenses.lgpl21;
80 homepage = "https://wiki.qt.io/Qt_for_Python";
81 maintainers = with maintainers; [ gebner ];
82 };
83}