General Shell Configuration
As you may have noticed with my Fish configuration, my main shell is Fish, not Bash or Zsh. But sometimes, I do need to use these instead of Fish. In order to share some common configuration, I have a rather rich $HOME/.profile
file which mainly exports environment variables. Despite the fact Fish is not a POSIX shell and should not be able to read it, the plugin foreign-env
comes in handy to load this .profile
from fish, as you can see in my fish config.
The correctness and POSIX compatibility of this file is verified using shellcheck.
Before we go into the meaty stuff, let me first load some private configuration I cannot share online.
# shellcheck source=/dev/null
. "$HOME"/.profile.private
Personal Information
First of all, here I set some information in order to make some stufff work.
Variable | Value |
---|---|
EMAIL | [email protected] |
NAME | "Lucien Cartier-Tilet" |
export EMAIL=[email protected]
export NAME="Lucien Cartier-Tilet"
XDG variables
Then, let me set some XDG variables that may not be set by default, but are still quite useful.
Variable | Value |
---|---|
XDG_CACHE_HOME | "$HOME"/.cache |
XDG_CONFIG_HOME | "$HOME"/.config |
XDG_DATA_HOME | "$HOME"/.local/share |
XDG_STATE_HOME | "$HOME"/.local/state |
export XDG_CACHE_HOME="$HOME"/.cache
export XDG_CONFIG_HOME="$HOME"/.config
export XDG_DATA_HOME="$HOME"/.local/share
export XDG_STATE_HOME="$HOME"/.local/state
Dev
Here are some variables that are quite useful.
Variable | Value | Value is a command? |
---|---|---|
SSH_AUTH_SOCK | gpgconf --list-dirs agent-ssh-socket | yes |
LD_LIBRARY_PATH | "$LD_LIBRARY_PATH":/usr/local/lib | |
LSP_USE_PLISTS | true | |
DIFFPROG | ediff | |
SUDO_ASKPASS | "$HOME"/.local/bin/askpass | |
MANPAGER | less |
SSH_AUTH_SOCK
: allows me to use my local GPG keys when SSHing into a remote host that may not have a gpg agent. It tells SSH which sock to use, sock which allows SSH to interact with other software, here GPG.LD_LIBRARY_PATH
: path of libraries that may be included by compilers such as GCC.LSP_USE_PLISTS
: optimisation for LSP servers with Emacs.DIFFPROG
: program used by software that wants to diff two files, such as git. It uses my script ediff.SUDO_ASKPASS
: which script to call when callingsudo -A
. It uses my script askpass.
SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
export SSH_AUTH_SOCK
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":/usr/local/lib
export LSP_USE_PLISTS=true
export DIFFPROG=ediff
export SUDO_ASKPASS="$HOME"/.local/bin/askpass
export MANPAGER=less
Android development
I’m not sure why I keep these, honestly.
Variable | Value |
---|---|
DART_SDK | /opt/dart-sdk/bin |
ANDROID_HOME | "$HOME"/Android/Sdk |
CHROME_EXECUTABLE | /usr/bin/chromium |
export DART_SDK=/opt/dart-sdk/bin
export ANDROID_HOME="$HOME"/Android/Sdk
export CHROME_EXECUTABLE=/usr/bin/chromium
Compatibility issues with MANPAGER
Due to compatibility issues with using less
as the pager for man, some variables must be redefined.
Variable | Value | Value is a command? |
---|---|---|
LESS_TERMCAP_mb | printf '\e[1;32m' | yes |
LESS_TERMCAP_md | printf '\e[1;32m' | yes |
LESS_TERMCAP_me | printf '\e[0m' | yes |
LESS_TERMCAP_se | printf '\e[0m' | yes |
LESS_TERMCAP_so | printf '\e[01;33m' | yes |
LESS_TERMCAP_ue | printf '\e[0m' | yes |
LESS_TERMCAP_us | printf '\e[1;4;31m' | yes |
LESS_TERMCAP_mb=$(printf '\e[1;32m')
export LESS_TERMCAP_mb
LESS_TERMCAP_md=$(printf '\e[1;32m')
export LESS_TERMCAP_md
LESS_TERMCAP_me=$(printf '\e[0m')
export LESS_TERMCAP_me
LESS_TERMCAP_se=$(printf '\e[0m')
export LESS_TERMCAP_se
LESS_TERMCAP_so=$(printf '\e[01;33m')
export LESS_TERMCAP_so
LESS_TERMCAP_ue=$(printf '\e[0m')
export LESS_TERMCAP_ue
LESS_TERMCAP_us=$(printf '\e[1;4;31m')
export LESS_TERMCAP_us
Preferences
Browser
It’s always nice to have the BROWSER
variable available in case you want to do stuff with scripts and your default browser.
Variable | Value |
---|---|
BROWSER | zen-browser |
export BROWSER=zen-browser
Editor variables
My favourite text editor is Emacs, in case you haven’t guessed already. It makes sense that both my EDITOR
and VISUAL
variables should be set to Emacs.
Variable | Value |
---|---|
EDITOR | "emacsclient -c" |
VISUAL | "emacsclient -c" |
export EDITOR="emacsclient -c"
export VISUAL="emacsclient -c"
GTK Theme
These are some important variables regarding the GTK theme I use.
Variable | Value |
---|---|
GTK_THEME | Nordic |
GTK_ICON_THEME | "Flat-Remix-Dark" |
export GTK_THEME=Nordic
export GTK_ICON_THEME="Flat-Remix-Dark"
Cleaning up my home directory
Home directories tend to become cluttered over time, especially when developers tend to not care about the XDG standard and throw their app’s files into $HOME
rather than in XDG_CACHE_HOME
, XDG_CONFIG_HOME
, and so on. Fortunately, some software allow us to move their data elsewhere, so let’s teach them some manners.
Variable | Value |
---|---|
__GL_SHADER_DISK_CACHE_PATH | "$XDG_CACHE_HOME"/nv |
_JAVA_OPTIONS | "-Djava.util.prefs.userRoot=${XDG_CONFIG_HOME}/java -Djavafx.cachedir=${XDG_CACHE_HOME}/openjfx" |
_Z_DATA | "$XDG_DATA_HOME"/z |
BUNDLE_USER_CACHE | "$XDG_CACHE_HOME"/bundle |
BUNDLE_USER_CONFIG | "$XDG_CONFIG_HOME"/bundle |
BUNDLE_USER_PLUGIN | "$XDG_DATA_HOME"/bundle |
CARGO_HOME | "$XDG_DATA_HOME"/cargo |
CUDA_CACHE_PATH | "$XDG_CACHE_HOME"/nv |
DENO_DIR | "$HOME"/.config/deno |
DENO_INSTALL_ROOT | "$HOME"/.local/bin/deno |
DOCKER_CONFIG | "$XDG_CONFIG_HOME"/docker |
GEM_HOME | "$XDG_DATA_HOME"/gem |
GEM_SPEC_CACHE | "$XDG_CACHE_HOME"/gem |
GNUPGHOME | "$XDG_DATA_HOME"/gnupg |
GOPATH | "$XDG_DATA_HOME"/go |
GTK2_RC_FILES | "$XDG_CONFIG_HOME"/gtk-2.0/gtkrc |
HISTFILE | "$XDG_STATE_HOME/bash/history" |
ICEAUTHORITY | "$XDG_CACHE_HOME"/ICEauthority |
LESSHISTFILE | "$XDG_CACHE_HOME"/less/history |
MBSYNCRC | "$XDG_CONFIG_HOME"/isync/mbsyncrc |
MPLAYER_HOME | "$XDG_CONFIG_HOME"/mplayer |
MYPY_CACHE_DIR | "$XDG_CACHE_HOME"/mypy |
NPM_CONFIG_USERCONFIG | "$XDG_CONFIG_HOME"/npm/npmrc |
NUGET_PACKAGES | "$XDG_CACHE_HOME"/NuGetPackages |
NVM_DIR | "$XDG_DATA_HOME"/nvm |
PARALLEL_HOME | "$XDG_CONFIG_HOME"/parallel |
PASSWORD_STORE_DIR | "$XDG_DATA_HOME"/pass |
PKG_CACHE_PATH | "$XDG_CACHE_HOME"/pkg-cache |
PSQL_HISTORY | "$XDG_DATA_HOME/psql_history" |
PYENV_ROOT | "$XDG_DATA_HOME"/pyenv |
PYLINTHOME | "$XDG_CACHE_HOME"/pylint |
PYTHONSTARTUP | "$HOME"/python/pythonrc |
RUSTUP_HOME | "$XDG_DATA_HOME"/rustup |
SQLITE_HISTORY | "$XDG_CACHE_HOME"/sqlite_history |
TERMINFO | "$XDG_DATA_HOME"/terminfo |
TERMINFO_DIRS | "$XDG_DATA_HOME"/terminfo:/usr/share/terminfo |
TEXMFVAR | "$XDG_CACHE_HOME"/texlive/texmf-var |
W3M_DIR | "$XDG_DATA_HOME"/w3m |
WINEPREFIX | "$XDG_DATA_HOME"/wine |
XAUTHORITY | "$XDG_RUNTIME_DIR"/Xauthority |
XCOMPOSEFILE | "$XDG_CONFIG_HOME"/X11/xcompose |
XCURSOR_PATH | /usr/share/icons:$XDG_DATA_HOME/icons |
GRADLE_USER_HOME | "$XDG_DATA_HOME"/gradle |
DOTNET_CLI_HOME | "$XDG_DATA_HOME"/dotnet |
CUDA_CACHE_PATH | "$XDG_CACHE_HOME"/nv |
ANDROID_USER_HOME | "$XDG_DATA_HOME"/android |
I also need to export this alias, because wget
feels like it’s special, but these are exported in wrappers in my scripts documentation.
If you’re wondering how I got most of these variables, xdg-ninja can help you with that.
export __GL_SHADER_DISK_CACHE_PATH="$XDG_CACHE_HOME"/nv
export _JAVA_OPTIONS="-Djava.util.prefs.userRoot=${XDG_CONFIG_HOME}/java -Djavafx.cachedir=${XDG_CACHE_HOME}/openjfx"
export _Z_DATA="$XDG_DATA_HOME"/z
export BUNDLE_USER_CACHE="$XDG_CACHE_HOME"/bundle
export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME"/bundle
export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME"/bundle
export CARGO_HOME="$XDG_DATA_HOME"/cargo
export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv
export DENO_DIR="$HOME"/.config/deno
export DENO_INSTALL_ROOT="$HOME"/.local/bin/deno
export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker
export GEM_HOME="$XDG_DATA_HOME"/gem
export GEM_SPEC_CACHE="$XDG_CACHE_HOME"/gem
export GNUPGHOME="$XDG_DATA_HOME"/gnupg
export GOPATH="$XDG_DATA_HOME"/go
export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc
export HISTFILE="$XDG_STATE_HOME/bash/history"
export ICEAUTHORITY="$XDG_CACHE_HOME"/ICEauthority
export LESSHISTFILE="$XDG_CACHE_HOME"/less/history
export MBSYNCRC="$XDG_CONFIG_HOME"/isync/mbsyncrc
export MPLAYER_HOME="$XDG_CONFIG_HOME"/mplayer
export MYPY_CACHE_DIR="$XDG_CACHE_HOME"/mypy
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc
export NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages
export NVM_DIR="$XDG_DATA_HOME"/nvm
export PARALLEL_HOME="$XDG_CONFIG_HOME"/parallel
export PASSWORD_STORE_DIR="$XDG_DATA_HOME"/pass
export PKG_CACHE_PATH="$XDG_CACHE_HOME"/pkg-cache
export PSQL_HISTORY="$XDG_DATA_HOME/psql_history"
export PYENV_ROOT="$XDG_DATA_HOME"/pyenv
export PYLINTHOME="$XDG_CACHE_HOME"/pylint
export PYTHONSTARTUP="$HOME"/python/pythonrc
export RUSTUP_HOME="$XDG_DATA_HOME"/rustup
export SQLITE_HISTORY="$XDG_CACHE_HOME"/sqlite_history
export TERMINFO="$XDG_DATA_HOME"/terminfo
export TERMINFO_DIRS="$XDG_DATA_HOME"/terminfo:/usr/share/terminfo
export TEXMFVAR="$XDG_CACHE_HOME"/texlive/texmf-var
export W3M_DIR="$XDG_DATA_HOME"/w3m
export WINEPREFIX="$XDG_DATA_HOME"/wine
export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority
export XCOMPOSEFILE="$XDG_CONFIG_HOME"/X11/xcompose
export XCURSOR_PATH=/usr/share/icons:$XDG_DATA_HOME/icons
export GRADLE_USER_HOME="$XDG_DATA_HOME"/gradle
export DOTNET_CLI_HOME="$XDG_DATA_HOME"/dotnet
export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv
export ANDROID_USER_HOME="$XDG_DATA_HOME"/android
PATH variable
Additional PATH values | Comment |
---|---|
/usr/lib/xfce-polkit/ | Lets me access more easily XFCE’s polkit |
$HOME/.cabal/bin | Haskell binaries |
$GEM_HOME/ruby/2.6.0/bin | Ruby 2.6.0 binaries |
$GEM_HOME/ruby/3.0.0/bin | Ruby 3 binaries |
$GOPATH/bin | Go binaries |
${CARGO_HOME}/bin | Cargo and Rust binaries |
$HOME/Android/Sdk/tools/bin | Android tools and binaries |
$HOME/.local/bin | Custom scripts |
$HOME/.config/plover/plugins/linux/bin | Plover binaries |
$HOME/.nix-profile/bin | Nix binaries |
PATH="/usr/lib/xfce-polkit/:$PATH"
PATH="$HOME/.cabal/bin:$PATH"
PATH="$GEM_HOME/ruby/2.6.0/bin:$PATH"
PATH="$GEM_HOME/ruby/3.0.0/bin:$PATH"
PATH="$GOPATH/bin:$PATH"
PATH="${CARGO_HOME}/bin:$PATH"
PATH="$HOME/Android/Sdk/tools/bin:$PATH"
PATH="$HOME/.local/bin:$PATH"
PATH="$HOME/.config/plover/plugins/linux/bin:$PATH"
PATH="$HOME/.nix-profile/bin:$PATH"
export PATH