[Bin, Fish] Move most of my environment variables to .profile

This commit is contained in:
Lucien Cartier-Tilet 2022-11-03 11:45:21 +01:00
parent da8ee0d20a
commit ffd0a3bbeb
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
3 changed files with 80 additions and 105 deletions

76
.profile Normal file
View File

@ -0,0 +1,76 @@
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"
export PATH="$HOME/.cargo/bin:$PATH"
export EMAIL="lucien@phundrak.com"
export NAME="Lucien Cartier-Tilet"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
export LSP_USE_PLISTS=true
export HISTFILE="${XDG_STATE_HOME}/bash/history"
export _Z_DATA="$XDG_DATA_HOME"/z
export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority
export WINEPREFIX="$XDG_DATA_HOME"/wine
export TEXMFVAR="$XDG_CACHE_HOME"/texlive/texmf-var
export RUSTUP_HOME="$XDG_DATA_HOME"/rustup
export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME"/bundle
export BUNDLE_USER_CACHE="$XDG_CACHE_HOME"/bundle
export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME"/bundle
export PYLINTHOME="${XDG_CACHE_HOME}"/pylint
export PYENV_ROOT="$XDG_DATA_HOME"/pyenv
export PASSWORD_STORE_DIR="$XDG_DATA_HOME"/pass
export PARALLEL_HOME="$XDG_CONFIG_HOME"/parallel
export _JAVA_OPTIONS="-Djava.util.prefs.userRoot=${XDG_CONFIG_HOME}/java"
export NVM_DIR="$XDG_DATA_HOME"/nvm
export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv
export __GL_SHADER_DISK_CACHE_PATH="$XDG_CACHE_HOME"/nv
export NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc
export TERMINFO="$XDG_DATA_HOME"/terminfo
export TERMINFO_DIRS="$XDG_DATA_HOME"/terminfo:/usr/share/terminfo
export MPLAYER_HOME="$XDG_CONFIG_HOME"/mplayer
export ICEAUTHORITY="$XDG_CACHE_HOME"/ICEauthority
export LESSHISTFILE="$XDG_CACHE_HOME"/less/history
export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc
export GOPATH="$XDG_DATA_HOME"/go
export GNUPGHOME="$XDG_DATA_HOME"/gnupg
export GEM_HOME="${XDG_DATA_HOME}"/gem
export GEM_SPEC_CACHE="${XDG_CACHE_HOME}"/gem
export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker
export CARGO_HOME="$XDG_DATA_HOME"/cargo
export EDITOR="emacsclient -c"
export VISUAL="emacsclient -c"
export GTK_THEME="Nordic"
export GTK_ICON_THEME="Flat-Remix-Dark"
export DART_SDK=/opt/dart-sdk/bin
export ANDROID_HOME="$HOME/Android/Sdk"
export CHROME_EXECUTABLE=/usr/bin/chromium
export DENO_DIR="$HOME/.config/deno"
export DENO_INSTALL_ROOT="$HOME/.local/bin/deno"
export SUDO_ASKPASS="$HOME/.local/bin/askpass"
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export BROWSER=firefox
export XMODIFIERS=
export LESS_TERMCAP_mb=$'\e[1;32m'
export LESS_TERMCAP_md=$'\e[1;32m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;4;31m'
export QSYS_ROOTDIR="/home/phundrak/.cache/paru/clone/quartus-free/pkg/quartus-free-quartus/opt/intelFPGA/20.1/quartus/sopc_builder/bin"
export XMODIFIERS=
alias wget="wget --hsts-file${XDG_DATA_HOME}/wget-hsts"

View File

@ -2023,8 +2023,6 @@ CACHEFILE=$([ -n "$XDG_CACHE_HOME" ] && echo "$XDG_CACHE_HOME/wallpaper" || echo
#+begin_src sh
export MOZ_ENABLE_WAYLAND=1
export SDL_VIDEODRIVER=wayland
export GTK_THEME="Nordic"
export GTK_ICON_THEME="Flat-Remix-Dark"
exec Hyprland
#+end_src
@ -2036,8 +2034,6 @@ exec Hyprland
#+begin_src sh
export MOZ_ENABLE_WAYLAND=1
export SDL_VIDEODRIVER=wayland
export GTK_THEME="Nordic"
export GTK_ICON_THEME="Flat-Remix-Dark"
exec start-newm
#+end_src

View File

@ -39,28 +39,11 @@ end
:PROPERTIES:
:CUSTOM_ID: Global_variables-1c84df8b
:END:
In order to keep some other code clean, I set the ~$BROWSER~ variable so I dont
have to call my web browser directly but rather with this variable.
#+BEGIN_SRC fish
set -gx BROWSER firefox
#+END_SRC
Sometimes, software will rely on =SUDO_ASKPASS= to get a GUI from which it can
get the sudo password. So, lets declare it.
#+BEGIN_SRC fish
set -gx SUDO_ASKPASS ~/.local/bin/askpass
#+END_SRC
In general, I prefer using ~bat~ to ~less~, although the former relies on the
latter, but ~bat~ provides nice wrapping around ~less~, including syntax
highlighting. Lets set the manpager to bat then:
#+BEGIN_SRC fish
set -x MANPAGER "sh -c 'col -bx | bat -l man -p'"
#+END_SRC
~XMODIFIERS~ is set to nothing as to not impede Emacs inputs.
The first thing I want to do is to load all variables from my
=~/.profile= file (which you can find [[https://labs.phundrak.com/phundrak/dotfiles/src/branch/master/.profile][here]]). The [[https://github.com/oh-my-fish/plugin-foreign-env][foreign-env]] plugin
comes in handy:
#+begin_src fish
set -x XMODIFIERS
fenv source ~/.profile
#+end_src
Lets start the Gnome keyring daemon. It will return a variable which must be set.
@ -70,90 +53,10 @@ if test -n "$DESKTOP_SESSION"
end
#+end_src
** XDG user directories
:PROPERTIES:
:CUSTOM_ID: Global-variables-XDG-user-directories-ata8fwf0bhj0
:END:
Theres a couple of XDG user directories that are not set, lets fix
that.
#+begin_src fish
set -x XDG_CACHE_HOME $HOME/.cache
set -x XDG_CONFIG_HOME $HOME/.config
set -x XDG_DATA_HOME $HOME/.local/share
set -x XDG_STATE_HOME $HOME/.local/state
#+end_src
Now, let's clean the ~$HOME~ directory. Be aware it will require quite a
few lines.
#+begin_src fish
set -x HISTFILE "$XDG_STATE_HOME"/bash/history
set -x _Z_DATA "$XDG_DATA_HOME"/z
set -x XAUTHORITY "$XDG_RUNTIME_DIR"/Xauthority
set -x WINEPREFIX "$XDG_DATA_HOME"/wine
set -x TEXMFVAR "$XDG_CACHE_HOME"/texlive/texmf-var
set -x RUSTUP_HOME "$XDG_DATA_HOME"/rustup
set -x BUNDLE_USER_CONFIG "$XDG_CONFIG_HOME"/bundle
set -x BUNDLE_USER_CACHE "$XDG_CACHE_HOME"/bundle
set -x BUNDLE_USER_PLUGIN "$XDG_DATA_HOME"/bundle
set -x PYLINTHOME "$XDG_CACHE_HOME"/pylint
set -x PYENV_ROOT "$XDG_DATA_HOME"/pyenv
set -x PASSWORD_STORE_DIR "$XDG_DATA_HOME"/pass
set -x PARALLEL_HOME "$XDG_CONFIG_HOME"/parallel
set -x _JAVA_OPTIONS -Djava.util.prefs.userRoot="$XDG_CONFIG_HOME"/java
set -x NVM_DIR "$XDG_DATA_HOME"/nvm
set -x CUDA_CACHE_PATH "$XDG_CACHE_HOME"/nv
set -x __GL_SHADER_DISK_CACHE_PATH "$XDG_CACHE_HOME"/nv
set -x NUGET_PACKAGES "$XDG_CACHE_HOME"/NuGetPackages
set -x NPM_CONFIG_USERCONFIG "$XDG_CONFIG_HOME"/npm/npmrc
set -x TERMINFO "$XDG_DATA_HOME"/terminfo
set -x TERMINFO_DIRS "$XDG_DATA_HOME"/terminfo:/usr/share/terminfo
set -x MPLAYER_HOME "$XDG_CONFIG_HOME"/mplayer
set -x ICEAUTHORITY "$XDG_CACHE_HOME"/ICEauthority
set -x LESSHISTFILE "$XDG_CACHE_HOME"/less/history
set -x GTK2_RC_FILES "$XDG_CONFIG_HOME"/gtk-2.0/gtkrc
set -x GOPATH "$XDG_DATA_HOME"/go
set -x GNUPGHOME "$XDG_DATA_HOME"/gnupg
set -x GEM_HOME "$XDG_DATA_HOME"/gem
set -x GEM_SPEC_CACHE "$XDG_CACHE_HOME"/gem
set -x DOCKER_CONFIG "$XDG_CONFIG_HOME"/docker
set -x CARGO_HOME "$XDG_DATA_HOME"/cargo
#+end_src
** Development
:PROPERTIES:
:CUSTOM_ID: Global_variables-Development-76b3ff13
:END:
Now, lets declare our editor of choice, EmacsClient; not Emacs itself since it
will most often be just quick edits, nothing too heavy, if it is called from the
~EDITOR~ variable (from Git, for example), or from the ~VISUAL~ variable.
#+BEGIN_SRC fish
set -gx EDITOR emacsclient -c
set -gx VISUAL emacsclient -c
#+END_SRC
We also need to set the path to the Dart SDK.
#+BEGIN_SRC fish
set -gx DART_SDK /opt/dart-sdk/bin
#+END_SRC
And we also need to specify where the Android SDK it located.
#+BEGIN_SRC fish
set -gx ANDROID_HOME $HOME/Android/Sdk
#+END_SRC
Still related to Dart and Flutter development,
#+BEGIN_SRC fish
set -gx CHROME_EXECUTABLE /usr/bin/chromium
#+END_SRC
Next, we have two variables from Deno, the Node.js destroyer. Its base directory
will be set in my XDG config directory, and its binaries will be located in my
local binaries directory (see below).
#+BEGIN_SRC fish
set -gx DENO_DIR $HOME/.config/deno
set -gx DENO_INSTALL_ROOT $HOME/.local/bin/deno
#+END_SRC
Finally, some development packages require the =PKG_CONFIG_PATH= to be set, so
lets do so.
#+BEGIN_SRC fish