dotfiles/fish/.config/fish/conf.d/setup.fish

66 lines
2.3 KiB
Fish

function __fish_setup_on_tty_login --description "Set up environment on tty login"
# We set it up in this order as what we setup first, will appear later in
# the path.
# See commit 7779044 for why this is required.
if test -d /usr/lib/rustup/bin
set -gxp PATH /usr/lib/rustup/bin
end
if test -d {$HOME}/.local/share/pnpm
set -gx PNPM_HOME {$HOME}/.local/share/pnpm
set -gxp PATH {$HOME}/.local/share/pnpm
end
for extra_path in ~/.{cabal,cargo,ghcup,go,local}/bin
if test -d "$extra_path"
set -gxp PATH "$extra_path"
end
end
if test -d {$HOME}/.go
set -gx GOBIN {$HOME}/.go/bin
set -gx GOPATH {$HOME}/.go
end
if test -d /var/lib/flatpak
# https://github.com/fish-shell/fish-shell/issues/7485#issuecomment-728984689
# https://wiki.archlinux.org/title/Flatpak#Adding_Flatpak_.desktop_files_to_your_menu
set -l xdg_data_home $XDG_DATA_HOME ~/.local/share
set -gx --path XDG_DATA_DIRS $xdg_data_home[1]/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
for flatpakdir in ~/.local/share/flatpak/exports/bin /var/lib/flatpak/exports/bin
if test -d $flatpakdir
contains $flatpakdir $PATH; or set -a PATH $flatpakdir
end
end
end
# Temporary directory for GStreamer dot files
mkdir -p /tmp/gst-dot
# Needed for silencing some warnings from Sway. Will not work with systemd
# environment.d.
set -gx WLR_NO_HARDWARE_CURSORS 1
# Needed for work
set -gx ENV qa-tunnel
# Password Store
set -gx PASSWORD_STORE_ENABLE_EXTENSIONS true
set -gx PASSWORD_STORE_GENERATED_LENGTH 16
set -gx PASSWORD_STORE_CLIP_TIME 20
# Ripgrep requires this environment variable for knowing the config file path
set -gx RIPGREP_CONFIG_PATH {$HOME}/.config/ripgrep/ripgreprc
# Required for all environment variables to be set correctly, especially
# in tmux session service.
dbus-update-activation-environment --systemd --all
end
# Instead of tty check, we would have liked to do this using status is-login
# check but for some reason that does not work?
set --local TTY1 (tty)
[ "$TTY1" = /dev/tty1 ] && __fish_setup_on_tty_login