[zsh] export libs from the installed Rust toolchain as well

This commit is contained in:
Dmytro Meleshko 2021-02-13 16:39:18 +02:00
parent 4ad73c7154
commit 27f9b351c1
2 changed files with 15 additions and 11 deletions

View file

@ -1,9 +1,11 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
# tie these env variables to zsh arrays export PATH
typeset -T PKG_CONFIG_PATH pkg_config_path ':' export MANPATH
export PKG_CONFIG_PATH PATH MANPATH # tie these env variables to zsh arrays
export -T PKG_CONFIG_PATH pkg_config_path ':'
export -T LD_LIBRARY_PATH ld_library_path ':'
path_prepend() { path_prepend() {
if (( $# < 1 )); then if (( $# < 1 )); then
@ -90,6 +92,7 @@ if [[ -f ~/.rustup/settings.toml ]]; then
path_prepend path "$rust_sysroot"/bin path_prepend path "$rust_sysroot"/bin
path_prepend fpath "$rust_sysroot"/zsh/site-functions path_prepend fpath "$rust_sysroot"/zsh/site-functions
path_prepend manpath "$rust_sysroot"/share/man path_prepend manpath "$rust_sysroot"/share/man
path_prepend ld_library_path "$rust_sysroot"/lib
fi fi
unset rust_toolchain rust_sysroot unset rust_toolchain rust_sysroot
fi fi
@ -103,3 +106,12 @@ path_prepend fpath "$ZSH_DOTFILES/completions"
path_prepend path ~/.local/bin path_prepend path ~/.local/bin
unfunction path_prepend unfunction path_prepend
# For some reason manpath is not always set when logging with ssh for instance.
# Let's ensure that it is always set and exported. The additional colon ensures
# that the system manpath isn't overwritten (see manpath(1)).
if [[ -n "$MANPATH" && "$MANPATH" != *: ]]; then
# Append a colon if MANPATH isn't empty and doesn't end with a colon already
MANPATH="$MANPATH:"
fi
export MANPATH="$MANPATH"

View file

@ -46,14 +46,6 @@ _perf_timer_start "total"
fi fi
# }}} # }}}
# For some reason manpath is not always set when logging with ssh for instance.
# Let's ensure that it is always set and exported. The additional colon ensures
# that the system manpath isn't overwritten (see manpath(1)), though in reality
# two colons get added for some reason, which is also valid, but means
# something slightly different (again, see manpath(1)). Hope this won't cause
# any problems in the future.
export MANPATH="$MANPATH:"
for script in functions options path env plugins aliases completion zle prompt colorscheme; do for script in functions options path env plugins aliases completion zle prompt colorscheme; do
_perf_timer_start "$script.zsh" _perf_timer_start "$script.zsh"
source "$ZSH_DOTFILES/$script.zsh" source "$ZSH_DOTFILES/$script.zsh"