Support nix XDG pathing

This commit is contained in:
2025-04-05 16:37:09 -04:00
committed by Andrew R. M.
parent 3583770d94
commit 6876cad10b
4 changed files with 16 additions and 2 deletions

View File

@@ -11,6 +11,8 @@ ARCHIVE_PATH="${FLAKE_PATH}/archive.nar"
if ! which nix &>/dev/null; then
if [ -r "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
elif [ -r "${XDG_STATE_HOME:-$HOME/.local/state}/nix/profile/etc/profile.d/nix.sh" ]; then
. "${XDG_STATE_HOME:-$HOME/.local/state}/nix/profile/etc/profile.d/nix.sh"
else
echo "Nix isn't available. Exiting now!"
exit 1

View File

@@ -28,6 +28,8 @@ cat << EOF > ~/.bashrc
# Source nix if it's installed
if [ -r ~/.nix-profile/etc/profile.d/nix.sh ]; then
. ~/.nix-profile/etc/profile.d/nix.sh
elif [ -r "${XDG_STATE_HOME:-$HOME/.local/state}/nix/profile/etc/profile.d/nix.sh" ]; then
. "${XDG_STATE_HOME:-$HOME/.local/state}/nix/profile/etc/profile.d/nix.sh"
fi
EOF