From b9be5b146c8f43049799a50afbe77ce46176075a Mon Sep 17 00:00:00 2001 From: Cian Hughes Date: Wed, 18 Feb 2026 15:45:02 +0000 Subject: [PATCH] Moved path variables to single-source-of-truth --- dot_bashrc | 23 +++++++++-------------- dot_config/fish/conf.d/00_env.fish | 12 +++++------- dot_config/nushell/env.nu | 2 +- dot_config/{nushell => }/path.env | 0 dot_zshrc | 20 +++++++++----------- 5 files changed, 24 insertions(+), 33 deletions(-) rename dot_config/{nushell => }/path.env (100%) diff --git a/dot_bashrc b/dot_bashrc index c1faaff..f8ffb5a 100644 --- a/dot_bashrc +++ b/dot_bashrc @@ -30,20 +30,15 @@ export LESS_TERMCAP_se=$'\e[0m' export LESS_TERMCAP_us=$'\e[00;36m' export LESS_TERMCAP_ue=$'\e[0m' -path_prepend() { - if [ -d "$1" ]; then - export PATH="$1:$PATH" - fi -} - -path_prepend "/opt/miniconda3/bin" -path_prepend "/nix/var/nix/profiles/default/bin" -path_prepend "$HOME/.nix-profile/bin" -path_prepend "$HOME/.ghcup/bin" -path_prepend "$HOME/.poetry/bin" -path_prepend "$HOME/.cargo/bin" -path_prepend "$HOME/.local/bin" -unset -f path_prepend +if [ -f ~/.config/path.env ]; then + while read -r line; do + [[ -z "$line" || "$line" == #* ]] && continue + p=$(eval echo "$line") + if [ -d "$p" ]; then + export PATH="$p:$PATH" + fi + done < ~/.config/path.env +fi # --- Aliases --- # Modern Unix Replacements diff --git a/dot_config/fish/conf.d/00_env.fish b/dot_config/fish/conf.d/00_env.fish index 0d85248..a1b1dd3 100644 --- a/dot_config/fish/conf.d/00_env.fish +++ b/dot_config/fish/conf.d/00_env.fish @@ -20,10 +20,8 @@ set -gx LESS_TERMCAP_se (printf "\e[0m") set -gx LESS_TERMCAP_us (printf "\e[00;36m") set -gx LESS_TERMCAP_ue (printf "\e[0m") -fish_add_path ~/.local/bin -fish_add_path ~/.cargo/bin -fish_add_path ~/.poetry/bin -fish_add_path ~/.ghcup/bin -fish_add_path ~/.nix-profile/bin -fish_add_path /nix/var/nix/profiles/default/bin -fish_add_path /opt/miniconda3/bin +if test -f ~/.config/path.env + for dir in (cat ~/.config/path.env) + eval fish_add_path -m $dir + end +end diff --git a/dot_config/nushell/env.nu b/dot_config/nushell/env.nu index ea77685..a3b5777 100644 --- a/dot_config/nushell/env.nu +++ b/dot_config/nushell/env.nu @@ -76,7 +76,7 @@ $env.PATH = ( $env.PATH | split row (char esep) | append ( - open ($env.FILE_PWD | path join "path.env") + open ($env.XDG_CONFIG_HOME | path join "path.env") | from csv --noheaders --trim all | get "column0" | path expand --no-symlink diff --git a/dot_config/nushell/path.env b/dot_config/path.env similarity index 100% rename from dot_config/nushell/path.env rename to dot_config/path.env diff --git a/dot_zshrc b/dot_zshrc index 21f5183..6a88744 100644 --- a/dot_zshrc +++ b/dot_zshrc @@ -23,18 +23,16 @@ export LESS_TERMCAP_us=$'\e[00;36m' export LESS_TERMCAP_ue=$'\e[0m' # --- Path Configuration --- +if [[ -f ~/.config/path.env ]]; then + for dir in $(cat ~/.config/path.env); do + expanded_dir=${~dir} + if [[ -d $expanded_dir ]]; then + path=($expanded_dir $path) + fi + done +fi + typeset -U path -path=( - /opt/miniconda3/bin - /nix/var/nix/profiles/default/bin - $HOME/.nix-profile/bin - $HOME/.ghcup/bin - $HOME/.poetry/bin - $HOME/.cargo/bin - $HOME/.local/bin - $path -) -export PATH # --- Zsh Settings --- HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh_history"