dotfiles/bash/bash_profile

61 lines
1.5 KiB
Bash

# Activate Nix profile.
if [ -f /run/current-system/profile/etc/profile.d/nix.sh ]; then
source /run/current-system/profile/etc/profile.d/nix.sh
fi
if [ -d "$HOME"/.nix-profile ]; then
profile=$HOME/.nix-profile
if [ -d "$profile"/etc/xdg ]; then
export XDG_CONFIG_DIRS="$profile"/etc/xdg:$XDG_CONFIG_DIRS
fi
if [ -d "$profile"/share ]; then
export XDG_DATA_DIRS="$profile"/share:$XDG_DATA_DIRS
fi
if [ -d "$profile"/share/man ]; then
export MANPATH="$profile"/share/man:$MANPATH
fi
if [ -d "$profile"/share/info ]; then
export INFOPATH="$profile"/share/info:$INFOPATH
fi
unset profile
fi
# Activate Flatpak profile.
if [ -d "$HOME"/.local/share/flatpak/exports ]; then
flatpak=$HOME/.local/share/flatpak/exports
if [ -d "$flatpak"/bin ]; then
export PATH="$flatpak"/bin:$PATH
fi
if [ -d "$flatpak"/share ]; then
export XDG_DATA_DIRS="$flatpak"/share:$XDG_DATA_DIRS
fi
unset flatpak
fi
# Ammend PATH.
if [ -d "$HOME"/.bin ]; then
export PATH="$HOME/.bin:$PATH"
fi
# Set default text editor.
export VISUAL=nano
# GnuPG
## Set GPG TTY.
export GPG_TTY=$(tty)
## Set SSH to use gpg-agent.
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi
# Start Shepherd-User-Services.
if [[ ! -S ${XDG_RUNTIME_DIR-HOME/.cache}/shepherd/socket ]]; then
shepherd
fi
# Start X display server.
if [ -z $DISPLAY ] && [ "${XDG_VTNR}" -eq 2 ]; then
exec xinit
fi