propertly check and source additional env files
This commit is contained in:
+10
-5
@@ -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}"
|
||||
|
||||
Reference in New Issue
Block a user