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

@@ -15,13 +15,21 @@ echo "Installing dotfiles..."
if [ "${CODER_TEMPLATE_TYPE}" == "Devcontainer" ]; then
installers/install-nix.sh
installers/install-nix-packages-flake.sh
. ~/.nix-profile/etc/profile.d/nix.sh
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"
fi
elif [ "${CODER_OS_FAMILY:-}" == "Ubuntu" ]; then
echo "Detected OS as Ubuntu, using apt";
sudo apt-get update;
sudo apt-get install -y stow;
installers/install-nix.sh
. ~/.nix-profile/etc/profile.d/nix.sh
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"
fi
elif [ -f /etc/os-release ]; then
echo "Idenitfying OS to install GNU stow..."
if grep -q -i debian /etc/os-release; then