Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkgs/by-name/ge/gepetto-viewer/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ let
maintainers = [ lib.maintainers.nim65s ];
mainProgram = "gepetto-gui";
platforms = lib.platforms.unix;
broken = true;
};
});
in
Expand Down
102 changes: 82 additions & 20 deletions pkgs/development/libraries/python-qt/default.nix
Original file line number Diff line number Diff line change
@@ -1,37 +1,94 @@
{
lib,
stdenv,

fetchFromGitHub,

python3,
qmake,
qtwebengine,
qtxmlpatterns,

qt5compat ? null,
qtbase,
qtdeclarative,
qtsvg,
qttools,
qtwebengine,
qtxmlpatterns ? null,

qt6Support ? false,
}:

let
qtVersion = lib.getVersion qtbase;
pyVersion = lib.getVersion python3;
versions = "Qt${lib.versions.major qtVersion}-Python${lib.versions.majorMinor pyVersion}";
in
stdenv.mkDerivation (finalAttrs: {
pname = "python-qt";
version = "3.6.1";
pname = "python${lib.versions.majorMinor pyVersion}-qt${lib.versions.major qtVersion}";
version = "3.6.1-unstable-2025-11-20";

src = fetchFromGitHub {
owner = "MeVisLab";
repo = "pythonqt";
rev = "v${finalAttrs.version}";
hash = "sha256-OYFQtDGq+d32RQ0vChRKH//O9QgQPLMd1he8X3zCi+U=";
# tag = "v${finalAttrs.version}";
rev = "fd97b4b2ca5fc94a3219b002aadfbe2e8c89f59d";
hash = "sha256-BAuvs23VBKt6g5gpAtMUPyikL+D3sMEpch1BLICUotc=";
};

nativeBuildInputs = [
qmake
];

buildInputs = [
python3
qtdeclarative
qtsvg
qttools
]
++ lib.optionals qt6Support [
qt5compat
qtwebengine # optional and vulnerable in Qt5
]
++ lib.optionals (!qt6Support) [
qtxmlpatterns
qtwebengine
];

buildInputs = [ python3 ];
env.QTDIR = "${qtbase}"; # Used to find qtcoreversion.h

postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace src/src.pro --replace-fail \
"QMAKE_APPLE_DEVICE_ARCHS = x86_64 arm64" \
"QMAKE_APPLE_DEVICE_ARCHS = ${stdenv.hostPlatform.darwinArch}"
'';

# generated cpp is available for many Qt5 versions but not Qt6
# ref. https://github.com/MeVisLab/pythonqt#binding-generator
preConfigure = lib.optionalString qt6Support (
let
includePaths = lib.concatMapStringsSep ":" (p: "${p}/include") [
qtbase
qtdeclarative
qtsvg
qttools
qtwebengine
];
in
''
pushd generator
qmake $qmakeFlags CONFIG+=Release generator.pro
make -j $NIX_BUILD_CORES
./pythonqt_generator \
--include-paths=${includePaths} \
--qt-version=${qtVersion} \
qtscript_masterinclude.h \
build_all.txt
popd
''
);

qmakeFlags = [
"PYTHON_DIR=${python3}"
"PYTHON_VERSION=3.${python3.sourceVersion.minor}"
"PYTHON_VERSION=${lib.versions.majorMinor pyVersion}"
];

dontWrapQtApps = true;
Expand All @@ -45,22 +102,27 @@ stdenv.mkDerivation (finalAttrs: {
'';

preFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
install_name_tool -id \
$out/lib/libPythonQt-Qt5-Python3.${python3.sourceVersion.minor}.dylib \
$out/lib/libPythonQt-Qt5-Python3.${python3.sourceVersion.minor}.dylib
install_name_tool -change \
libPythonQt-Qt5-Python3.${python3.sourceVersion.minor}.3.dylib \
$out/lib/libPythonQt-Qt5-Python3.${python3.sourceVersion.minor}.3.dylib \
-id \
$out/lib/libPythonQt_QtAll-Qt5-Python3.${python3.sourceVersion.minor}.dylib \
$out/lib/libPythonQt_QtAll-Qt5-Python3.${python3.sourceVersion.minor}.dylib
install_name_tool \
-id $out/lib/libPythonQt-${versions}.dylib \
$out/lib/libPythonQt-${versions}.dylib

install_name_tool \
-change libPythonQt-${versions}.3.dylib \
$out/lib/libPythonQt-${versions}.3.dylib \
-id $out/lib/libPythonQt_QtAll-${versions}.dylib \
$out/lib/libPythonQt_QtAll-${versions}.dylib
'';

meta = {
description = "PythonQt is a dynamic Python binding for the Qt framework. It offers an easy way to embed the Python scripting language into your C++ Qt applications";
homepage = "https://pythonqt.sourceforge.net/";
homepage = "https://mevislab.github.io/pythonqt/";
license = lib.licenses.lgpl21;
platforms = lib.platforms.all;
maintainers = with lib.maintainers; [ hlolli ];
maintainers = with lib.maintainers; [
hlolli
nim65s
];
# ref. https://github.com/MeVisLab/pythonqt/issues/276
broken = stdenv.hostPlatform.isDarwin && qt6Support;
};
})
2 changes: 2 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15403,6 +15403,8 @@ self: super: with self; {

python-qt = toPythonModule (pkgs.python-qt.override { python3 = self.python; });

python-qt-qt6 = toPythonModule (pkgs.qt6Packages.python-qt.override { python3 = self.python; });

python-rabbitair = callPackage ../development/python-modules/python-rabbitair { };

python-rapidjson = callPackage ../development/python-modules/python-rapidjson { };
Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/qt5-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ makeScopeWithSplicing' {

pulseaudio-qt = callPackage ../development/libraries/pulseaudio-qt { };

python-qt = callPackage ../development/libraries/python-qt { };

qca = callPackage ../development/libraries/qca {
inherit (libsForQt5) qtbase;
};
Expand Down
4 changes: 4 additions & 0 deletions pkgs/top-level/qt6-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ makeScopeWithSplicing' {
suffix = "qt6";
};

python-qt = callPackage ../development/libraries/python-qt {
qt6Support = true;
};

sailfish-access-control-plugin =
callPackage ../development/libraries/sailfish-access-control-plugin
{ };
Expand Down
Loading