-
Notifications
You must be signed in to change notification settings - Fork 285
Description
Describe the improvement
The install script for Linux has a fixed install location for the Cargo binary to $HOME/.cargo/bin directory. If another directory is used then the install fails.
Consider extending the script to support CARGO_HOME from Rustup tool and the XDG_CONFIG_HOME from xfreedesktop.org.
I suggest first checking in this order
CARGO_HOME- installing in$CARGO_HOME/binXDG_CONFIG_HOME- installing inXDG_CONFIG_HOME/cargo/bin- If none of the above set, install in
$HOME/.cargo/bin
NOTE: a quick fix was to create a
$HOME/.cargo symbolic link pointing to$CARGO_HOME`
Rustup and custom locations
Rustup tool can be installed using custom locations, using the RUSTUP_HOME and CARGO_HOME environment variables. If these are set in the shell resource config (.bashrc / .zshrc) then the rustup install will use their custom locations.
# ----------------------------------------
# Rust Lang Development tools - rustup
export RUSTUP_HOME="${RUSTUP_HOME:=$HOME/.config/rust/rustup}"
export CARGO_HOME="${CARGO_HOME:=$HOME/.config/rust/cargo}"
# ----------------------------------------Using XDG_CONFIG_HOME
A popular standard for user configuration files under one directory, e.g. $HOME/.config which also simplifies version control for those configuration files.
The xfreedesktop.org Base Directory specification defines the XDG_CONFIG_HOME environment variable that sets the base directory for all user account configurations.
This location is typically $HOME/.config and contains a (non-hidden) directory name for each configuration, e.g. for Cargo: $HOME/.config/cargo
# ----------------------------------------
# Set XDG_CONFIG_HOME for clean management of configuration files
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:=$HOME/.config}"
export XDG_DATA_HOME="${XDG_DATA_HOME:=$HOME/.local/share}"
export XDG_STATE_HOME="${XDG_STATE_HOME:=$HOME/.local/state}"
export XDG_CACHE_HOME="${XDG_CACHE_HOME:=$HOME/.cache}"
export ZDOTDIR="${ZDOTDIR:=$XDG_CONFIG_HOME/zsh}"
# ----------------------------------------Duplicate declaration
- I have searched the issues and this improvement has not been requested before.