echo ">> .bash_profile"

# PATH must be in .bash_profile
# but I put all in .bashrc

## rust cargo
# test -d $HOME/.cargo/bin && PATH="$HOME/.cargo/bin:$PATH"

## nodejs
# test -d $HOME/.local_node/bin && PATH="$HOME/.local_node/bin:$PATH"

# # golang env
# export PATH=$PATH:$HOME/go/bin
# export GOPATH=/home/patrick/devel/golang
# PATH="$GOPATH/bin:$PATH"		     ## bin installed from `go install`
# PATH="/home/patrick/src/golang/go/bin:$PATH" ## install from binaries

# rvm
#[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

# nix
# if [ -e /home/patrick/.nix-profile/etc/profile.d/nix.sh ]; then . /home/patrick/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer

# ssh agent
# use one agent for all connection
# https://unix.stackexchange.com/questions/132065/how-do-i-get-ssh-agent-to-work-in-all-terminals
# FIXME: interfer w/ ssh -A 

# echo "   .bash_profile: play with ssh-agent"
# if test "x$SSH_AUTH_SOCK" = x
# then
#     echo "SSH_AUTH_SOCK no set"
    # export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock
    #
    # export SSH_AUTH_SOCK=~/.ssh/ssh-agent.$HOSTNAME.~/.ssh/ssh_auth_sock
    # ssh-add -l 2>/dev/null >/dev/null
    # err=$?
    # if [ $err -ge 2 ]; then
	    # echo "   .bash_profile ssh-add with error: $err"
	    # test -f "$SSH_AUTH_SOCK" && rm -f "$SSH_AUTH_SOCK"
	    # ssh-agent -a "$SSH_AUTH_SOCK" >/dev/null
    # fi
    # unset err
# else
    # echo "SSH_AUTH_SOCK already set !!"
    # echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
# fi


# test ssh-agent
# echo "   .bash_profile: play with ssh-agent"
# export SSH_AUTH_SOCK=~/.ssh/ssh-agent.$HOSTNAME.sock
# ssh-add -l 2>/dev/null >/dev/null
# err=$?
# if [ $err -ge 2 ]; then
# 	echo "   .bash_profile ssh-add with error: $err"
# 	test -f "$SSH_AUTH_SOCK" && rm -f "$SSH_AUTH_SOCK"
# 	ssh-agent -a "$SSH_AUTH_SOCK" >/dev/null
# else 
#     echo " all ok"
# fi
# unset err

# enable PATH in system-user context
#systemctl --user import-environment PATH

# test -f "$HOME/.bash_aliases" && source "$HOME/.bash_aliases"

# no .bashrc here
test -e "$HOME/.bashrc" && source "$HOME/.bashrc"

echo "<< .bash_profile"