I see people mentioning here that there doesn't seem to be a general solution to be included in Guix for this, but I als do not understand what the particular solution (for my machine, for example) is supposed to be.
I'm a new user to Guix and also not technically very experienced with Linux OS's, so feel free to point me out something obvious I have missed.

I currently have Guix on top of Ubuntu 20.04, and I have this exact problem with XDG_DATA_DIRS being exported on startup of Gnome and breaking it, and i happend when this variable is added to ~/.guix-profile/etc/profile when installing certain packages; the ones detected so far where python-ipython, python-ipykernel and python-notebook.

As far as I unedrstand, when Ubuntu starts up, it runs /etc/profile, which in turn reads through all scripts inside /etc/profile.d. In that dir, we have guix.sh, which I will paste here:

# _GUIX_PROFILE: `guix pull` profile
export PATH="$_GUIX_PROFILE/bin${PATH:+:}$PATH"
# Export INFOPATH so that the updated info pages can be found
# and read by both /usr/bin/info and/or $GUIX_PROFILE/bin/info
# When INFOPATH is unset, add a trailing colon so that Emacs
# searches 'Info-default-directory-list'.

# GUIX_PROFILE: User's default profile
[ -L $GUIX_PROFILE ] || return

[ -f "$GUIX_PROFILE/etc/profile" ] && . "$GUIX_PROFILE/etc/profile"

# set XDG_DATA_DIRS to include Guix installations
export XDG_DATA_DIRS="$GUIX_PROFILE/share:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}"

The culprit in this case seems to be [ -f "$GUIX_PROFILE/etc/profile" ] && . "$GUIX_PROFILE/etc/profile", and this is because it is getting the following two lines from $GUIX_PROFILE/etc/profile which are introduced by installing python-ipython (for example):

export GI_TYPELIB_PATH="${GUIX_PROFILE:-/gnu/store/22lc31mr4h00x5swzk73293pm2xpaahi-profile}/lib/girepository-1.0${GI_TYPELIB_PATH:+:}$GI_TYPELIB_PATH"
export XDG_DATA_DIRS="${GUIX_PROFILE:-/gnu/store/22lc31mr4h00x5swzk73293pm2xpaahi-profile}/share${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"

In fact, when this happens, the last line in guix.sh is only duplicating what the line inside .guix-profile/etc/profile had already exported:

export XDG_DATA_DIRS="$GUIX_PROFILE/share:${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}"

What is the workaround that can be used here?
I only see two possible solutions, which are unsatisfactory to me:

  1. Refrain from installing packages that alter this variable;
  2. Comment all lines inside guix.sh and add . "$GUIX_PROFILE/etc/profile to my .bash_rc file, focing me to open a terminal everytime I want to launch guix installed packages.
Is there another alternative for this?

Eagerly awating for feedback on this, as it's completely destroying my workflow; I am never sure when  will install a package that wll break Ubuntu.