Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at r-updates 138 lines 3.3 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 # Qt Designer plugin moved to a separate output to reduce closure size 61 # for downstream things 62 outputs = [ 63 "out" 64 "devtools" 65 ]; 66 67 # cmake/Macros/PySideModules.cmake supposes that all Qt frameworks on macOS 68 # reside in the same directory as QtCore.framework, which is not true for Nix. 69 # We therefore symLink all required and optional Qt modules in one directory tree ("qt_linked"). 70 postPatch = '' 71 # Don't ignore optional Qt modules 72 substituteInPlace cmake/PySideHelpers.cmake \ 73 --replace-fail \ 74 'string(FIND "''${_module_dir}" "''${_core_abs_dir}" found_basepath)' \ 75 'set (found_basepath 0)' 76 '' 77 + lib.optionalString stdenv.hostPlatform.isDarwin '' 78 substituteInPlace cmake/PySideHelpers.cmake \ 79 --replace-fail \ 80 "Designer" "" 81 ''; 82 83 # "Couldn't find libclang.dylib You will likely need to add it manually to PATH to ensure the build succeeds." 84 env = lib.optionalAttrs stdenv.hostPlatform.isDarwin { 85 LLVM_INSTALL_DIR = "${lib.getLib llvmPackages.libclang}/lib"; 86 }; 87 88 nativeBuildInputs = [ 89 cmake 90 ninja 91 python 92 pythonImportsCheckHook 93 ] 94 ++ lib.optionals stdenv.hostPlatform.isDarwin [ moveBuildTree ]; 95 96 buildInputs = ( 97 if stdenv.hostPlatform.isLinux then 98 # qtwebengine fails under darwin 99 # see https://github.com/NixOS/nixpkgs/pull/312987 100 packages ++ [ python.pkgs.qt6.qtwebengine ] 101 else 102 python.pkgs.qt6.darwinVersionInputs 103 ++ [ 104 qt_linked 105 cups 106 ] 107 ); 108 109 propagatedBuildInputs = [ shiboken6 ]; 110 111 cmakeFlags = [ "-DBUILD_TESTS=OFF" ]; 112 113 dontWrapQtApps = true; 114 115 postInstall = '' 116 cd ../../.. 117 ${python.pythonOnBuildForHost.interpreter} setup.py egg_info --build-type=pyside6 118 cp -r PySide6.egg-info $out/${python.sitePackages}/ 119 120 mkdir -p "$devtools" 121 moveToOutput "${python.pkgs.qt6.qtbase.qtPluginPrefix}/designer" "$devtools" 122 ''; 123 124 pythonImportsCheck = [ "PySide6" ]; 125 126 meta = { 127 description = "Python bindings for Qt"; 128 license = with lib.licenses; [ 129 lgpl3Only 130 gpl2Only 131 gpl3Only 132 ]; 133 homepage = "https://wiki.qt.io/Qt_for_Python"; 134 changelog = "https://code.qt.io/cgit/pyside/pyside-setup.git/tree/doc/changelogs/changes-${finalAttrs.version}?h=v${finalAttrs.version}"; 135 maintainers = with lib.maintainers; [ ]; 136 platforms = lib.platforms.all; 137 }; 138})