nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 151 lines 3.6 kB view raw
1{ 2 lib, 3 stdenv, 4 cmake, 5 cups, 6 ninja, 7 python, 8 pythonImportsCheckHook, 9 moveBuildTree, 10 shiboken6, 11 llvmPackages, 12 symlinkJoin, 13 fetchpatch, 14}: 15let 16 packages = with python.pkgs.qt6; [ 17 # required 18 python.pkgs.ninja 19 python.pkgs.packaging 20 python.pkgs.setuptools 21 qtbase 22 23 # optional 24 qt3d 25 qtcharts 26 qtconnectivity 27 qtdatavis3d 28 qtdeclarative 29 qthttpserver 30 qtmultimedia 31 qtnetworkauth 32 qtquick3d 33 qtremoteobjects 34 qtscxml 35 qtsensors 36 qtspeech 37 qtsvg 38 qtwebchannel 39 qtwebsockets 40 qtwebview 41 qtpositioning 42 qtlocation 43 qtshadertools 44 qtserialport 45 qtserialbus 46 qtgraphs 47 qttools 48 ]; 49 qt_linked = symlinkJoin { 50 name = "qt_linked"; 51 paths = packages; 52 }; 53in 54 55stdenv.mkDerivation (finalAttrs: { 56 pname = "pyside6"; 57 58 inherit (shiboken6) version src; 59 60 sourceRoot = "${finalAttrs.src.name}/sources/pyside6"; 61 62 patches = [ 63 # revert commit that breaks generated cmake files 64 (fetchpatch { 65 url = "https://code.qt.io/cgit/pyside/pyside-setup.git/patch/?id=05e328476f2d6ef8a0f3f44aca1e5b1cdb7499fc"; 66 revert = true; 67 stripLen = 2; 68 hash = "sha256-PPLV5K+xp7ZdG0Tah1wpBdNWN7fsXvZh14eBzO0R55c="; 69 }) 70 ]; 71 72 # Qt Designer plugin moved to a separate output to reduce closure size 73 # for downstream things 74 outputs = [ 75 "out" 76 "devtools" 77 ]; 78 79 # cmake/Macros/PySideModules.cmake supposes that all Qt frameworks on macOS 80 # reside in the same directory as QtCore.framework, which is not true for Nix. 81 # We therefore symLink all required and optional Qt modules in one directory tree ("qt_linked"). 82 postPatch = '' 83 # Don't ignore optional Qt modules 84 substituteInPlace cmake/PySideHelpers.cmake \ 85 --replace-fail \ 86 'string(FIND "''${_module_dir}" "''${_core_abs_dir}" found_basepath)' \ 87 'set (found_basepath 0)' 88 '' 89 + lib.optionalString stdenv.hostPlatform.isDarwin '' 90 substituteInPlace cmake/PySideHelpers.cmake \ 91 --replace-fail \ 92 "Designer" "" 93 ''; 94 95 # "Couldn't find libclang.dylib You will likely need to add it manually to PATH to ensure the build succeeds." 96 env = lib.optionalAttrs stdenv.hostPlatform.isDarwin { 97 LLVM_INSTALL_DIR = "${lib.getLib llvmPackages.libclang}/lib"; 98 }; 99 100 nativeBuildInputs = [ 101 cmake 102 ninja 103 python 104 pythonImportsCheckHook 105 ] 106 ++ lib.optionals stdenv.hostPlatform.isDarwin [ moveBuildTree ]; 107 108 buildInputs = ( 109 if stdenv.hostPlatform.isLinux then 110 # qtwebengine fails under darwin 111 # see https://github.com/NixOS/nixpkgs/pull/312987 112 packages ++ [ python.pkgs.qt6.qtwebengine ] 113 else 114 python.pkgs.qt6.darwinVersionInputs 115 ++ [ 116 qt_linked 117 cups 118 ] 119 ); 120 121 propagatedBuildInputs = [ shiboken6 ]; 122 123 cmakeFlags = [ "-DBUILD_TESTS=OFF" ]; 124 125 dontWrapQtApps = true; 126 127 postInstall = '' 128 cd ../../.. 129 chmod +w . 130 ${python.pythonOnBuildForHost.interpreter} setup.py egg_info --build-type=pyside6 131 cp -r PySide6.egg-info $out/${python.sitePackages}/ 132 133 mkdir -p "$devtools" 134 moveToOutput "${python.pkgs.qt6.qtbase.qtPluginPrefix}/designer" "$devtools" 135 ''; 136 137 pythonImportsCheck = [ "PySide6" ]; 138 139 meta = { 140 description = "Python bindings for Qt"; 141 license = with lib.licenses; [ 142 lgpl3Only 143 gpl2Only 144 gpl3Only 145 ]; 146 homepage = "https://wiki.qt.io/Qt_for_Python"; 147 changelog = "https://code.qt.io/cgit/pyside/pyside-setup.git/tree/doc/changelogs/changes-${finalAttrs.version}?h=v${finalAttrs.version}"; 148 maintainers = [ ]; 149 platforms = lib.platforms.all; 150 }; 151})