2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
cmake,
|
2024-09-19 14:19:46 +00:00
|
|
|
cups,
|
2024-06-05 15:53:02 +00:00
|
|
|
ninja,
|
|
|
|
python,
|
2024-09-19 14:19:46 +00:00
|
|
|
pythonImportsCheckHook,
|
2024-06-05 15:53:02 +00:00
|
|
|
moveBuildTree,
|
|
|
|
shiboken6,
|
2024-09-19 14:19:46 +00:00
|
|
|
llvmPackages,
|
|
|
|
symlinkJoin,
|
|
|
|
libGL,
|
|
|
|
darwin,
|
2023-05-24 13:37:59 +00:00
|
|
|
}:
|
2024-09-19 14:19:46 +00:00
|
|
|
let
|
|
|
|
packages = with python.pkgs.qt6; [
|
|
|
|
# required
|
|
|
|
python.pkgs.ninja
|
|
|
|
python.pkgs.packaging
|
|
|
|
python.pkgs.setuptools
|
|
|
|
qtbase
|
|
|
|
|
|
|
|
# optional
|
|
|
|
qt3d
|
|
|
|
qtcharts
|
|
|
|
qtconnectivity
|
|
|
|
qtdatavis3d
|
|
|
|
qtdeclarative
|
|
|
|
qthttpserver
|
|
|
|
qtmultimedia
|
|
|
|
qtnetworkauth
|
|
|
|
qtquick3d
|
|
|
|
qtremoteobjects
|
|
|
|
qtscxml
|
|
|
|
qtsensors
|
|
|
|
qtspeech
|
|
|
|
qtsvg
|
|
|
|
qtwebchannel
|
|
|
|
qtwebsockets
|
|
|
|
qtpositioning
|
|
|
|
qtlocation
|
|
|
|
qtshadertools
|
|
|
|
qtserialport
|
|
|
|
qtserialbus
|
|
|
|
qtgraphs
|
|
|
|
qttools
|
|
|
|
];
|
|
|
|
qt_linked = symlinkJoin {
|
|
|
|
name = "qt_linked";
|
|
|
|
paths = packages;
|
|
|
|
};
|
|
|
|
in
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2023-05-24 13:37:59 +00:00
|
|
|
pname = "pyside6";
|
|
|
|
|
|
|
|
inherit (shiboken6) version src;
|
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
sourceRoot = "pyside-setup-everywhere-src-${finalAttrs.version}/sources/pyside6";
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
# cmake/Macros/PySideModules.cmake supposes that all Qt frameworks on macOS
|
2023-05-24 13:37:59 +00:00
|
|
|
# reside in the same directory as QtCore.framework, which is not true for Nix.
|
2024-09-19 14:19:46 +00:00
|
|
|
# We therefore symLink all required and optional Qt modules in one directory tree ("qt_linked").
|
|
|
|
# Also we remove "Designer" from darwin build, due to linking failure
|
|
|
|
postPatch =
|
|
|
|
''
|
|
|
|
# Don't ignore optional Qt modules
|
|
|
|
substituteInPlace cmake/PySideHelpers.cmake \
|
|
|
|
--replace-fail \
|
|
|
|
'string(FIND "''${_module_dir}" "''${_core_abs_dir}" found_basepath)' \
|
|
|
|
'set (found_basepath 0)'
|
|
|
|
''
|
2024-09-26 11:04:55 +00:00
|
|
|
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
|
2024-09-19 14:19:46 +00:00
|
|
|
substituteInPlace cmake/PySideHelpers.cmake \
|
|
|
|
--replace-fail \
|
|
|
|
"Designer" ""
|
|
|
|
'';
|
|
|
|
|
|
|
|
# "Couldn't find libclang.dylib You will likely need to add it manually to PATH to ensure the build succeeds."
|
2024-09-26 11:04:55 +00:00
|
|
|
env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
|
|
|
|
LLVM_INSTALL_DIR = "${llvmPackages.libclang.lib}/lib";
|
|
|
|
};
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
ninja
|
|
|
|
python
|
2024-09-19 14:19:46 +00:00
|
|
|
pythonImportsCheckHook
|
2024-09-26 11:04:55 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ moveBuildTree ];
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
buildInputs =
|
2024-09-26 11:04:55 +00:00
|
|
|
if stdenv.hostPlatform.isLinux then
|
2024-09-19 14:19:46 +00:00
|
|
|
# qtwebengine fails under darwin
|
|
|
|
# see https://github.com/NixOS/nixpkgs/pull/312987
|
|
|
|
packages ++ [ python.pkgs.qt6.qtwebengine ]
|
|
|
|
else
|
|
|
|
with darwin.apple_sdk_11_0.frameworks;
|
|
|
|
[
|
|
|
|
qt_linked
|
|
|
|
libGL
|
|
|
|
cups
|
|
|
|
# frameworks
|
|
|
|
IOKit
|
|
|
|
DiskArbitration
|
|
|
|
CoreBluetooth
|
|
|
|
EventKit
|
|
|
|
AVFoundation
|
|
|
|
Contacts
|
|
|
|
AGL
|
|
|
|
AppKit
|
|
|
|
];
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs = [ shiboken6 ];
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
cmakeFlags = [ "-DBUILD_TESTS=OFF" ];
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
dontWrapQtApps = true;
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
postInstall = ''
|
|
|
|
cd ../../..
|
2023-11-16 04:20:00 +00:00
|
|
|
${python.pythonOnBuildForHost.interpreter} setup.py egg_info --build-type=pyside6
|
2023-10-09 19:29:22 +00:00
|
|
|
cp -r PySide6.egg-info $out/${python.sitePackages}/
|
|
|
|
'';
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
pythonImportsCheck = [ "PySide6" ];
|
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
meta = {
|
2023-05-24 13:37:59 +00:00
|
|
|
description = "Python bindings for Qt";
|
2024-06-24 18:47:55 +00:00
|
|
|
license = with lib.licenses; [
|
2024-06-05 15:53:02 +00:00
|
|
|
lgpl3Only
|
|
|
|
gpl2Only
|
|
|
|
gpl3Only
|
|
|
|
];
|
2023-05-24 13:37:59 +00:00
|
|
|
homepage = "https://wiki.qt.io/Qt_for_Python";
|
2024-06-24 18:47:55 +00:00
|
|
|
changelog = "https://code.qt.io/cgit/pyside/pyside-setup.git/tree/doc/changelogs/changes-${finalAttrs.version}?h=v${finalAttrs.version}";
|
2024-07-27 06:49:29 +00:00
|
|
|
maintainers = with lib.maintainers; [ gebner ];
|
2024-06-24 18:47:55 +00:00
|
|
|
platforms = lib.platforms.all;
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
2024-06-24 18:47:55 +00:00
|
|
|
})
|