How does nix add packages to XDG_DATA_DIRS

I have a package that build with a /share subdir however if I install with, say, nix-env or with nix-shell it does not get added to XDG_DATA_DIRS.
What should I do to add it to the variable, considering other packages do it automagically?
https://github.com/NixOS/nixpkgs/pull/146774

Can you share an example of a program that adds itself and how you get it to do that?

echo $XDG_DATA_DIRS will give you plenty of examples, but like I’ve sain in that pr even after a nix profile install ... echo $XDG_DATA_DIRS|grep lightly give me nothing.
echo $XDG_DATA_DIRS | grep yakuake will instead highlight the portion of the var coming from yakuake.

ok I was dumb
all the various programs get linked together in a single direcrtory ,linked in .nix-profile