Files
1def69720c libglycin: Introduce setup hook for adding loader paths to wrapper
This setup hook discovers glycin loaders in the inputs list it is placed into, and adds them to `gappsWrapperArgs`. This should simplify glycin-dependent programs’ expressions.

Just add `libglycin.setupHook` (for Rust programs) or `libglycin` (for other languages) to `buildInputs`. The latter will also pull in the setup hook.

Note, the setup hook needs to go to the `buildInputs` since we cannot have a different offset when used as standalone hook instead of propagated from `libglycin`. We chose `hostOffset` to make it work with the proper placement of `libglycin` in `buildInputs`.

Co-authored-by: Seth Flynn <getchoo@tuta.io>
Co-authored-by: Jan Tojnar <jtojnar@gmail.com>
2026-01-19 02:18:28 +01:00

19 lines
495 B
Bash

find_glycin_loader_paths() {
if [ -d "$1/share/glycin-loaders" ]; then
addToSearchPath NIX_GLYCIN_LOADER_PATHS $1/share
fi
}
addEnvHooks "$hostOffset" find_glycin_loader_paths
glycinLoadersWrapperArgsHook() {
echo "executing glycinLoadersWrapperArgsHook"
if [[ -n "$NIX_GLYCIN_LOADER_PATHS" ]]; then
gappsWrapperArgs+=(--prefix XDG_DATA_DIRS : "$NIX_GLYCIN_LOADER_PATHS")
fi
}
if [[ -z ${dontWrapGlycinLoaders:-} ]]; then
preFixupPhases+=(glycinLoadersWrapperArgsHook)
fi