dotfiles/config/shell/shenv

73 lines
1.9 KiB
Bash

#!/usr/bin/env sh
#
# Shell common environment variables and functions (BusyBox compatible)
#
# Favourite commands
export PAGER=less
export EDITOR=nvim
export VISUAL=nvim
export BROWSER=firefox
# Program-specific
[ -z "$SSH_AUTH_SOCK" ] && [ -x "$(command -v ssh-agent)" ] && eval "$(ssh-agent -s)"
direnv() { # environment variable name, path
export "$1"="$2"
mkdir -p "$2"
}
export JAVA_FONTS=/usr/share/fonts/TTF # 2019-04-25 Attempt to remove .java/fonts remove if it didn't work
# export ANDROID_HOME=/opt/android-sdk
# export ARDUINO=/usr/share/arduino
# export ARDUINO_DIR=$ARDUINO
# export ARDMK_VENDOR=archlinux-arduino
direnv GOPATH "$HOME/.cache/go"
direnv CARGOHOME "$HOME/.cache/cargo" # There are config in there that we can version if one want
direnv CCACHE_BASEDIR "$HOME/.cache/ccache"
export CCACHE_CONFIGPATH="$HOME/.config/ccache.conf"
direnv GNUPGHOME "$HOME/.config/gnupg"
export INPUTRC="$HOME/.config/inputrc"
export LESSHISTFILE="$HOME/.cache/lesshst"
direnv MONO_GAC_PREFIX "$HOME/.cache/mono"
export NODE_REPL_HISTORY="$HOME/.cache/node_repl_history"
direnv npm_config_cache "$HOME/.cache/npm"
direnv PARALLEL_HOME "$HOME/.cache/parallel"
# For programs that think $HOME is a reasonable place to put their junk
direnv JUNKHOME "$HOME/.cache/junkhome"
# Path
# Function stolen from Arch Linux /etc/profile
appendpath() {
if [ ! -d "$1" ]; then
return
fi
case ":$PATH:" in
*:"$1":*) ;;
*)
# TODO Reverse order: I want the latest ones to supersedes the older ones
export PATH="${PATH:+$PATH:}$1"
;;
esac
}
appendpath '/usr/lib/ccache/bin'
appendpath "${GOPATH}/bin"
appendpath "$HOME/.local/bin"
appendpath "$HOME/.config/scripts"
# If running on termux, load those extra scripts
[ -d /data/data/com.termux/ ] && (
appendpath "$HOME/.termux/scripts"
appendpath "$HOME/.termux/bin"
)
# For superseding commands with better ones if they are present