propertly check and source additional env files

This commit is contained in:
Joel Beckmeyer
2026-03-24 10:08:01 -04:00
parent c8c0f56c95
commit 4bd7b03290
+10 -5
View File
@@ -1,11 +1,16 @@
#!/bin/sh
# icky, but necessary since this might inject the needed XDG vars
. "$HOME/.config/environment.local" 2>/dev/null
. "$XDG_DATA_HOME/cargo/env" 2>/dev/null
# Function to source a file only if it exists
maybe_source() {
for file in "$@"; do
[ -f "$file" ] && . "$file"
done
}
# nix home-manager
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
maybe_source "$HOME/.config/environment.local"
maybe_source "$XDG_DATA_HOME/cargo/env"
maybe_source "$HOME/.nix-profile/etc/profile.d/nix.sh"
maybe_source "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
# set to defaults if any of these are unset
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"