Support nix XDG pathing
This commit is contained in:
parent
3583770d94
commit
6876cad10b
12
install.sh
12
install.sh
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -50,4 +50,6 @@ export HISTFILESIZE=10000
|
||||
|
||||
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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user