Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, stdenv 3, buildPythonPackage 4, setuptools 5, isPy27 6, fetchPypi 7, pkg-config 8, dbus 9, lndir 10, dbus-python 11, sip 12, pyqt5_sip 13, pyqt-builder 14, libsForQt5 15, withConnectivity ? false 16, withMultimedia ? false 17, withWebKit ? false 18, withWebSockets ? false 19, withLocation ? false 20, withSerialPort ? false 21, withTools ? false 22}: 23 24buildPythonPackage rec { 25 pname = "PyQt5"; 26 version = "5.15.9"; 27 format = "pyproject"; 28 29 disabled = isPy27; 30 31 src = fetchPypi { 32 inherit pname version; 33 hash = "sha256-3EHoQBqQ3D4raStBG9VJKrVZrieidCTu1L05FVZOxMA="; 34 }; 35 36 patches = [ 37 # Fix some wrong assumptions by ./project.py 38 # TODO: figure out how to send this upstream 39 ./pyqt5-fix-dbus-mainloop-support.patch 40 # confirm license when installing via pyqt5_sip 41 ./pyqt5-confirm-license.patch 42 ]; 43 44 postPatch = 45 # be more verbose 46 '' 47 cat >> pyproject.toml <<EOF 48 [tool.sip.project] 49 verbose = true 50 '' 51 # Due to bug in SIP .whl name generation we have to bump minimal macos sdk upto 11.0 for 52 # aarch64-darwin. This patch can be removed once SIP will fix it in upstream, 53 # see https://github.com/NixOS/nixpkgs/pull/186612#issuecomment-1214635456. 54 + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) '' 55 minimum-macos-version = "11.0" 56 '' + '' 57 EOF 58 ''; 59 60 enableParallelBuilding = true; 61 # HACK: paralellize compilation of make calls within pyqt's setup.py 62 # pkgs/stdenv/generic/setup.sh doesn't set this for us because 63 # make gets called by python code and not its build phase 64 # format=pyproject means the pip-build-hook hook gets used to build this project 65 # pkgs/development/interpreters/python/hooks/pip-build-hook.sh 66 # does not use the enableParallelBuilding flag 67 postUnpack = '' 68 export MAKEFLAGS+="''${enableParallelBuilding:+-j$NIX_BUILD_CORES}" 69 ''; 70 71 outputs = [ "out" "dev" ]; 72 73 dontWrapQtApps = true; 74 75 nativeBuildInputs = with libsForQt5; [ 76 pkg-config 77 qmake 78 setuptools 79 lndir 80 sip 81 qtbase 82 qtsvg 83 qtdeclarative 84 qtwebchannel 85 ] 86 ++ lib.optional withConnectivity qtconnectivity 87 ++ lib.optional withMultimedia qtmultimedia 88 ++ lib.optional withWebKit qtwebkit 89 ++ lib.optional withWebSockets qtwebsockets 90 ++ lib.optional withLocation qtlocation 91 ++ lib.optional withSerialPort qtserialport 92 ++ lib.optional withTools qttools 93 ; 94 95 buildInputs = with libsForQt5; [ 96 dbus 97 qtbase 98 qtsvg 99 qtdeclarative 100 pyqt-builder 101 ] 102 ++ lib.optional withConnectivity qtconnectivity 103 ++ lib.optional withWebKit qtwebkit 104 ++ lib.optional withWebSockets qtwebsockets 105 ++ lib.optional withLocation qtlocation 106 ++ lib.optional withSerialPort qtserialport 107 ++ lib.optional withTools qttools 108 ; 109 110 propagatedBuildInputs = [ 111 dbus-python 112 pyqt5_sip 113 ]; 114 115 passthru = { 116 inherit sip pyqt5_sip; 117 multimediaEnabled = withMultimedia; 118 webKitEnabled = withWebKit; 119 WebSocketsEnabled = withWebSockets; 120 }; 121 122 dontConfigure = true; 123 124 # Checked using pythonImportsCheck 125 doCheck = false; 126 127 pythonImportsCheck = [ 128 "PyQt5" 129 "PyQt5.QtCore" 130 "PyQt5.QtQml" 131 "PyQt5.QtWidgets" 132 "PyQt5.QtGui" 133 ] 134 ++ lib.optional withWebSockets "PyQt5.QtWebSockets" 135 ++ lib.optional withWebKit "PyQt5.QtWebKit" 136 ++ lib.optional withMultimedia "PyQt5.QtMultimedia" 137 ++ lib.optional withConnectivity "PyQt5.QtBluetooth" 138 ++ lib.optional withLocation "PyQt5.QtPositioning" 139 ++ lib.optional withSerialPort "PyQt5.QtSerialPort" 140 ++ lib.optional withTools "PyQt5.QtDesigner" 141 ; 142 143 meta = with lib; { 144 description = "Python bindings for Qt5"; 145 homepage = "https://riverbankcomputing.com/"; 146 license = licenses.gpl3Only; 147 platforms = platforms.mesaPlatforms; 148 maintainers = with maintainers; [ sander ]; 149 }; 150}