From 896e11b507aad6532a21d30af0ec329ccafb7958 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Wed, 25 Feb 2026 11:39:12 +0100 Subject: [PATCH] qt6.qtbase: fix incorrect substitution in setupHook --- .../development/libraries/qt-6/hooks/qtbase-setup-hook.sh | 8 ++++---- .../development/libraries/qt-6/modules/qtbase/default.nix | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/qt-6/hooks/qtbase-setup-hook.sh b/pkgs/development/libraries/qt-6/hooks/qtbase-setup-hook.sh index c70bf22759de1..f2cbd39ac6cd7 100644 --- a/pkgs/development/libraries/qt-6/hooks/qtbase-setup-hook.sh +++ b/pkgs/development/libraries/qt-6/hooks/qtbase-setup-hook.sh @@ -1,13 +1,13 @@ if [[ -n "${__nix_qtbase-}" ]]; then # Throw an error if a different version of Qt was already set up. - if [[ "$__nix_qtbase" != "@out@" ]]; then + if [[ "$__nix_qtbase" != "@qtbaseOut@" ]]; then echo >&2 "Error: detected mismatched Qt dependencies:" - echo >&2 " @out@" + echo >&2 " @qtbaseOut@" echo >&2 " $__nix_qtbase" exit 1 fi else # Only set up Qt once. - __nix_qtbase="@out@" + __nix_qtbase="@qtbaseOut@" qtPluginPrefix=@qtPluginPrefix@ qtQmlPrefix=@qtQmlPrefix@ @@ -16,7 +16,7 @@ else # Only set up Qt once. . @fix_qt_module_paths@ # Build tools are often confused if QMAKE is unset. - export QMAKE=@out@/bin/qmake + export QMAKE=@qtbaseOut@/bin/qmake export QMAKEPATH= diff --git a/pkgs/development/libraries/qt-6/modules/qtbase/default.nix b/pkgs/development/libraries/qt-6/modules/qtbase/default.nix index 040041f93b3c8..710c572ac59cf 100644 --- a/pkgs/development/libraries/qt-6/modules/qtbase/default.nix +++ b/pkgs/development/libraries/qt-6/modules/qtbase/default.nix @@ -321,6 +321,13 @@ stdenv.mkDerivation { moveToOutput "mkspecs/modules" "$dev" fixQtModulePaths "$dev/mkspecs/modules" 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. + # Use a different placeholder and explicitly substitute this + # to keep compatibility with __structuredAttrs and avoid substituteAll. + substituteInPlace "''${!outputDev}/nix-support/setup-hook" \ + --replace-fail "@qtbaseOut@" $out '' + lib.optionalString stdenv.hostPlatform.isLinux '' # FIXME: not sure why this isn't added automatically?