How is XDG_DATA_DIRS set for some apps?

We do not have global location for schemas for the same reason we do not have other FHS structures like /usr/lib: incompatibilities between multiple different versions and conflicts. Instead, each program is responsible for pulling in the schemas it needs, see Packaging GNOME applications section of the Nixpkgs manual.

Of course, this does not work for programs that expect to see every schema installed on the system (e.g. dconf-editor). But since Nix has no concept that would match “installed” of traditional package managers that cannot really be implemented in the first place.

The closest thing would be packages linked by one of the profiles (see this comment for how to make gsettings program see those schemas) but that will lack schemas of (transitive) dependencies.