From a0ee89704420278abb4c28c7b974500b0d19d39c Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Sun, 19 Apr 2026 11:24:01 +0200 Subject: [PATCH] wrapGAppsHook: prepare for structuredAttrs This hook is called in the fixupPhase via ``` local output for output in $(getAllOutputNames); do prefix="${!output}" runHook fixupOutput done ``` Without `__structuredAttrs`, `getAllOutputNames` returns the `output` array, in order. However, with `__structuredAttrs`, it returns the keys of the `output` associative array, which are no longer necessarily ordered in the same way. In the case of some packages (e.g. `mate-panel-with-applets`) this means that instead of `[ "out" "man" ]`, we process `[ "man" "out" ]`. Running the hook for `"man"` then sets `wrapGAppsHookHasRun` and no wrapping is done for `"out"`, which is what was really needed. Instead, keep track of whether the hook has run on a per-output basis. That way, the order does not matter and any executables that are spread around multiple outputs are wrapped. --- .../setup-hooks/wrap-gapps-hook/wrap-gapps-hook.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook/wrap-gapps-hook.sh b/pkgs/build-support/setup-hooks/wrap-gapps-hook/wrap-gapps-hook.sh index 7487dabd5aad..ea3e81bfdf27 100644 --- a/pkgs/build-support/setup-hooks/wrap-gapps-hook/wrap-gapps-hook.sh +++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook/wrap-gapps-hook.sh @@ -42,11 +42,13 @@ wrapGApp() { wrapProgram "$program" "${gappsWrapperArgs[@]}" "$@" } +declare -gA wrapGAppsHookHasRunForOutput + # Note: $gappsWrapperArgs still gets defined even if ${dontWrapGApps-} is set. wrapGAppsHook() { - # guard against running multiple times (e.g. due to propagation) - [ -z "$wrapGAppsHookHasRun" ] || return 0 - wrapGAppsHookHasRun=1 + # guard against running multiple times for the same output (e.g. due to propagation) + [ "${wrapGAppsHookHasRunForOutput["$output"]:-}" = 1 ] && return 0 + wrapGAppsHookHasRunForOutput["$output"]=1 if [[ -z "${dontWrapGApps:-}" ]]; then targetDirsThatExist=()