at 25.11-pre 3.1 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}: 14let 15 packages = with python.pkgs.qt6; [ 16 # required 17 python.pkgs.ninja 18 python.pkgs.packaging 19 python.pkgs.setuptools 20 qtbase 21 22 # optional 23 qt3d 24 qtcharts 25 qtconnectivity 26 qtdatavis3d 27 qtdeclarative 28 qthttpserver 29 qtmultimedia 30 qtnetworkauth 31 qtquick3d 32 qtremoteobjects 33 qtscxml 34 qtsensors 35 qtspeech 36 qtsvg 37 qtwebchannel 38 qtwebsockets 39 qtpositioning 40 qtlocation 41 qtshadertools 42 qtserialport 43 qtserialbus 44 qtgraphs 45 qttools 46 ]; 47 qt_linked = symlinkJoin { 48 name = "qt_linked"; 49 paths = packages; 50 }; 51in 52 53stdenv.mkDerivation (finalAttrs: { 54 pname = "pyside6"; 55 56 inherit (shiboken6) version src; 57 58 sourceRoot = "pyside-setup-everywhere-src-${finalAttrs.version}/sources/pyside6"; 59 60 # cmake/Macros/PySideModules.cmake supposes that all Qt frameworks on macOS 61 # reside in the same directory as QtCore.framework, which is not true for Nix. 62 # We therefore symLink all required and optional Qt modules in one directory tree ("qt_linked"). 63 postPatch = 64 '' 65 # Don't ignore optional Qt modules 66 substituteInPlace cmake/PySideHelpers.cmake \ 67 --replace-fail \ 68 'string(FIND "''${_module_dir}" "''${_core_abs_dir}" found_basepath)' \ 69 'set (found_basepath 0)' 70 '' 71 + lib.optionalString stdenv.hostPlatform.isDarwin '' 72 substituteInPlace cmake/PySideHelpers.cmake \ 73 --replace-fail \ 74 "Designer" "" 75 ''; 76 77 # "Couldn't find libclang.dylib You will likely need to add it manually to PATH to ensure the build succeeds." 78 env = lib.optionalAttrs stdenv.hostPlatform.isDarwin { 79 LLVM_INSTALL_DIR = "${lib.getLib llvmPackages.libclang}/lib"; 80 }; 81 82 nativeBuildInputs = [ 83 cmake 84 ninja 85 python 86 pythonImportsCheckHook 87 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ moveBuildTree ]; 88 89 buildInputs = ( 90 if stdenv.hostPlatform.isLinux then 91 # qtwebengine fails under darwin 92 # see https://github.com/NixOS/nixpkgs/pull/312987 93 packages ++ [ python.pkgs.qt6.qtwebengine ] 94 else 95 python.pkgs.qt6.darwinVersionInputs 96 ++ [ 97 qt_linked 98 cups 99 ] 100 ); 101 102 propagatedBuildInputs = [ shiboken6 ]; 103 104 cmakeFlags = [ "-DBUILD_TESTS=OFF" ]; 105 106 dontWrapQtApps = true; 107 108 postInstall = '' 109 cd ../../.. 110 ${python.pythonOnBuildForHost.interpreter} setup.py egg_info --build-type=pyside6 111 cp -r PySide6.egg-info $out/${python.sitePackages}/ 112 ''; 113 114 pythonImportsCheck = [ "PySide6" ]; 115 116 meta = { 117 description = "Python bindings for Qt"; 118 license = with lib.licenses; [ 119 lgpl3Only 120 gpl2Only 121 gpl3Only 122 ]; 123 homepage = "https://wiki.qt.io/Qt_for_Python"; 124 changelog = "https://code.qt.io/cgit/pyside/pyside-setup.git/tree/doc/changelogs/changes-${finalAttrs.version}?h=v${finalAttrs.version}"; 125 maintainers = with lib.maintainers; [ ]; 126 platforms = lib.platforms.all; 127 }; 128})