From 27f9b351c1266210caf6fc4d951c2a52ba3ccd87 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 13 Feb 2021 16:39:18 +0200 Subject: [PATCH] [zsh] export libs from the installed Rust toolchain as well --- zsh/path.zsh | 18 +++++++++++++++--- zsh/zshrc | 8 -------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/zsh/path.zsh b/zsh/path.zsh index d6a9bda..303370e 100644 --- a/zsh/path.zsh +++ b/zsh/path.zsh @@ -1,9 +1,11 @@ #!/usr/bin/env zsh -# tie these env variables to zsh arrays -typeset -T PKG_CONFIG_PATH pkg_config_path ':' +export 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() { if (( $# < 1 )); then @@ -90,6 +92,7 @@ if [[ -f ~/.rustup/settings.toml ]]; then path_prepend path "$rust_sysroot"/bin path_prepend fpath "$rust_sysroot"/zsh/site-functions path_prepend manpath "$rust_sysroot"/share/man + path_prepend ld_library_path "$rust_sysroot"/lib fi unset rust_toolchain rust_sysroot fi @@ -103,3 +106,12 @@ path_prepend fpath "$ZSH_DOTFILES/completions" path_prepend path ~/.local/bin 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" diff --git a/zsh/zshrc b/zsh/zshrc index 3513103..ea8cb05 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -46,14 +46,6 @@ _perf_timer_start "total" 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 _perf_timer_start "$script.zsh" source "$ZSH_DOTFILES/$script.zsh"