I'm working on packaging goldendict, a dictionary reader, along with many free dictionaries in various languages. This essentially requires "optional dependencies", a concept alien to Guix's functional model. However some by default goldendict checks directories such as /usr/share/stardict/dicfor dictionaries, but Guix has 2 other locations dictionaries may be found; /run/current-system/profile/share/..., and $GUIX_PROFILE/share/... A couple packages like ibus and aspell solve this using 'native-search-paths' which seems to require the program to have an environment variable it checks for search paths, which goldendict doesn't. There isn't much documentation on native-search-paths so I don't know what it actually does. libxt has a patch that hard codes the rule to check /run/current-system/profile, and if GUIX_PROFILE exists, check that, otherwise if HOME exists check $HOME/.guix-profile/... That's the only solution I can see working unless anyone has a better suggestion, I'd like to ask for some help writing the patch though since I've never written any C/C++ before, I was stuck figuring out how to define a string :(.
I think it can be done by making a copy of this code block and wrapping it in the above logic: https://github.com/goldendict/goldendict/blob/master/config.cc#L335 It would be good to keep the original /usr/share search paths so that goldendict will interoperate if guix is installed on a foreign distro.