Skip to content

Instantly share code, notes, and snippets.

@mbakke
Created June 28, 2019 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mbakke/67c35079fd685ad0aa4fe4f1d3d71b04 to your computer and use it in GitHub Desktop.
Save mbakke/67c35079fd685ad0aa4fe4f1d3d71b04 to your computer and use it in GitHub Desktop.
Guix on a foreign distribution (/etc/profile.d/guix.sh)
# If GUIX_PROFILE is set while sourcing the profile, the variables will
# refer to that instead of just the latest generation of the profile.
GUIX_PROFILE="${HOME}/.guix-profile"
if [[ -L "${GUIX_PROFILE}" ]]; then
. "${GUIX_PROFILE}/etc/profile"
fi
# Make sure the Guix from "guix pull" appears first in PATH.
export PATH="${HOME}/.config/guix/current/bin:${PATH}"
export INFOPATH="$HOME/.config/guix/current/share/info:$INFOPATH"
# If the user installed their own locales, use those. Guix will
# internally fall back to "glibc-utf8-locales" if this is not set.
if [[ -d "${GUIX_PROFILE}/lib/locale" ]]; then
export GUIX_LOCPATH="${GUIX_PROFILE}/lib/locale"
fi
# This is a hack to make "man" work for Guix and Debian when the
# user have "man-db" in their profile.
if [[ -n "${MANPATH}" && -d /usr/share/man && ! ${MANPATH} =~ /usr/share/man ]]; then
export MANPATH="${MANPATH}:/usr/share/man"
fi
# Similarly, source bash completions from the user profile.
GUIX_BASHCOMPDIRS=("${HOME}/.config/guix/current/etc/bash_completion.d"
"${GUIX_PROFILE}/etc/bash_completion.d")
for dir in "${GUIX_BASHCOMPDIRS[@]}"; do
if [[ -d "${dir}" ]]; then
for f in "${dir}/*"; do
. $f
done
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment