From 6e58884bf2f556471a83ac74eef646371d86cedb Mon Sep 17 00:00:00 2001 From: Nathan Henrie Date: Thu, 11 Jun 2026 17:27:05 -0600 Subject: [PATCH] qt6.qtbase: fix darwin permissions for statically linked plugins Assisted-by: Claude (Fable) Fixes https://github.com/NixOS/nixpkgs/issues/530884 --- .../libraries/qt-6/modules/qtbase/default.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/qt-6/modules/qtbase/default.nix b/pkgs/development/libraries/qt-6/modules/qtbase/default.nix index fa3ae210d281..bc27472bba7a 100644 --- a/pkgs/development/libraries/qt-6/modules/qtbase/default.nix +++ b/pkgs/development/libraries/qt-6/modules/qtbase/default.nix @@ -275,6 +275,13 @@ stdenv.mkDerivation { --replace-quiet /usr/libexec/PlistBuddy '${lib.getExe' xcbuild "PlistBuddy"}' done + # Unlike Apple's PlistBuddy, xcbuild's only accepts capitalized commands, + # so the usage-description probe in permissions.prf always fails and the + # darwin permission plugins (Bluetooth, camera, ...) are silently never + # linked into qmake-built apps. + substituteInPlace mkspecs/features/permissions.prf \ + --replace-fail "-c 'print " "-c 'Print " + substituteInPlace mkspecs/common/macx.conf \ --replace-fail 'CONFIG += ' 'CONFIG += no_default_rpath ' ''; @@ -332,7 +339,12 @@ stdenv.mkDerivation { postFixup = '' moveToOutput "mkspecs/modules" "$dev" fixQtModulePaths "$dev/mkspecs/modules" - fixQtBuiltinPaths "$out" '*.pr?' + # fixQtBuiltinPaths reads qtPluginPrefix/qtQmlPrefix from the environment, + # but the setup hook only exports them for downstream packages; without + # them e.g. $$[QT_INSTALL_PLUGINS] in qt.prf is rewritten to "$out/" + # instead of "$out/${qtPluginPrefix}", breaking static plugin linking. + qtPluginPrefix=${qtPluginPrefix} qtQmlPrefix=${qtQmlPrefix} \ + fixQtBuiltinPaths "$out" '*.pr?' # @out@ would be automagically replaced inside makeSetupHook by the output of that derivation, # but we need it to be the output of this derivation.