1
0
Fork 0
mirror of https://github.com/hcartiaux/dotfiles.git synced 2024-10-18 17:25:23 +02:00
dotfiles/bash/bash_environment
2023-03-20 17:31:32 +01:00

172 lines
4.9 KiB
Bash

#
# ~/.bash_environments
#
# ----------------------------------------------------------------------
# LOCALES
# ----------------------------------------------------------------------
# enable en_US locale w/ UTF-8 encodings
LANG="en_US.UTF-8"
LANGUAGE="en"
LC_CTYPE="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
export LANG LANGUAGE LC_CTYPE LC_ALL
# ----------------------------------------------------------------------
# SYSTEM INFO
# ----------------------------------------------------------------------
# Basic variables
: ${HOME=~}
: ${LOGNAME=$(id -un)}
: ${UNAME=$(uname)}
# complete hostnames from this file
: ${HOSTFILE=~/.ssh/known_hosts}
# readline config
: ${INPUTRC=~/.inputrc}
# Get rid of mail notification
unset MAILCHECK
if [[ $(echo $HOSTNAME | grep -c \\.) != 0 ]] ; then
FQDN=$HOSTNAME
else
FQDN=$(hostname -f)
fi
DOMAIN=$(echo "$FQDN" | cut -d '.' -f 2)
# ----------------------------------------------------------------------
# SHELL TYPE
# ----------------------------------------------------------------------
# detect interactive shell
case "$-" in
*i*) INTERACTIVE=yes ;;
*) unset INTERACTIVE ;;
esac
# detect login shell
case "$0" in
-*) LOGIN=yes ;;
*) unset LOGIN ;;
esac
# ----------------------------------------------------------------------
# PATH
# ----------------------------------------------------------------------
# we want the various sbins on the path along with /usr/local/bin
export PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin"
export PATH="/usr/local/bin:$PATH"
# put ~/.local/bin & ~/bin on PATH if it exists
[ -d "$HOME/.local/bin" ] && export PATH="$PATH:$HOME/.local/bin"
[ -d "$HOME/bin" ] && export PATH="$PATH:$HOME/bin"
# ----------------------------------------------------------------------
# EDITOR & PAGER
# ----------------------------------------------------------------------
test -n "$(command -v vim)" && EDITOR=vim || EDITOR=nano
export EDITOR
export SVN_EDITOR=$EDITOR
# Default pager ('less' is so much better than 'more'...)
if test -n "$(command -v less)"; then
export PAGER="less -FiRSwX"
else
export PAGER=more
fi
# ----------------------------------------------------------------------
# MISC
# ----------------------------------------------------------------------
# GPG config
export GNUPGHOME=~/.gnupg
# SSH config
unset SSH_ASKPASS
unset SSH_AGENT_PID
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
# Tsocks config
export TSOCKS_CONF_FILE=~/.dotfiles/tsocks/tsocks.conf
# BC configuration for interactive usage
test -n "$INTERACTIVE" && export BC_ENV_ARGS=~/.dotfiles/bc/bcrc
# PDSH configuration
export PDSH_RCMD_TYPE=ssh
export PDSH_SSH_ARGS_APPEND="-q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o PreferredAuthentications=publickey"
# Vagrant configuration
#export VAGRANT_DEFAULT_PROVIDER=lxc
# Easybuild
export EASYBUILDBUILDPATH=/tmp/
export EASYBUILD_PREFIX=$HOME/.local/easybuild
export EASYBUILD_MODULES_TOOL=Lmod
export EASYBUILD_MODULE_NAMING_SCHEME=CategorizedModuleNamingScheme
export LOCAL_MODULES=${EASYBUILD_PREFIX}/modules/all
alias ma="module avail"
alias ml="module list"
function mu(){
module use $LOCAL_MODULES
module load tools/EasyBuild
}
# ----------------------------------------------------------------------
# GRID5000 specific
# ----------------------------------------------------------------------
if [[ -n "$(echo $FQDN | grep -o .grid5000.fr)" ]]; then
export OAR_JOB_KEY_FILE=~/.ssh/id_rsa
# export http_proxy=http://proxy:3128
# export https_proxy=$http_proxy
fi
# Grid5000 Puppet 4 admin tools
export GPUPPET_PREFIX=/home/hcartiaux/.gpuppet
export GPUPPET_PLATFORM=production
export GPUPPET_LOCATION=luxembourg
export GPUPPET_USER=hcartiaux
export GPUPPET_SSH_CONFIG=$GPUPPET_PREFIX/ssh/config
alias cdgp='cd $GPUPPET_PREFIX/repo && source setup_env.sh && echo "==> Grid5000 Puppet 4 repository"'
# -------------------------------------------------------------------
# Ruby & RVM
# -------------------------------------------------------------------
[ -d "/usr/lib/ruby/gems" ] && export PATH="$PATH:$(echo /usr/lib/ruby/gems/*)/bin"
[ -d "$HOME/.rvm/bin" ] && export PATH="$PATH:$HOME/.rvm/bin"
# RVM specific (see http://beginrescueend.com/)
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" || true
if [[ $(which ruby 2>/dev/null | grep -c "$HOME/.rvm") != 0 ]]; then
# Get off my lawn
rvm reset
fi
# -------------------------------------------------------------------
# Nodejs and NVM
# -------------------------------------------------------------------
[[ -s "/usr/share/nvm/init-nvm.sh" ]] && . /usr/share/nvm/init-nvm.sh || true
# -------------------------------------------------------------------
# direnv, pyenv
# -------------------------------------------------------------------
[[ -e "$HOME/.config/direnv/init.sh" ]] && . $HOME/.config/direnv/init.sh || true
[[ -e "$HOME/.config/pyenv/init.sh" ]] && . $HOME/.config/pyenv/init.sh || true