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