propertly check and source additional env files
This commit is contained in:
+10
-5
@@ -1,11 +1,16 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# icky, but necessary since this might inject the needed XDG vars
|
# Function to source a file only if it exists
|
||||||
. "$HOME/.config/environment.local" 2>/dev/null
|
maybe_source() {
|
||||||
. "$XDG_DATA_HOME/cargo/env" 2>/dev/null
|
for file in "$@"; do
|
||||||
|
[ -f "$file" ] && . "$file"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# nix home-manager
|
maybe_source "$HOME/.config/environment.local"
|
||||||
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
|
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
|
# set to defaults if any of these are unset
|
||||||
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
||||||
|
|||||||
Reference in New Issue
Block a user