Support nix XDG pathing
This commit is contained in:
parent
a07797c281
commit
f79760f63e
12
install.sh
12
install.sh
@ -14,13 +14,21 @@ echo "Installing dotfiles..."
|
|||||||
if [ "${CODER_TEMPLATE_TYPE}" == "Devcontainer" ]; then
|
if [ "${CODER_TEMPLATE_TYPE}" == "Devcontainer" ]; then
|
||||||
installers/install-nix.sh
|
installers/install-nix.sh
|
||||||
installers/install-nix-packages-flake.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
|
elif [ "${CODER_OS_FAMILY:-}" == "Ubuntu" ]; then
|
||||||
echo "Detected OS as Ubuntu, using apt";
|
echo "Detected OS as Ubuntu, using apt";
|
||||||
sudo apt-get update;
|
sudo apt-get update;
|
||||||
sudo apt-get install -y stow;
|
sudo apt-get install -y stow;
|
||||||
installers/install-nix.sh
|
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
|
elif [ -f /etc/os-release ]; then
|
||||||
echo "Idenitfying OS to install GNU stow..."
|
echo "Idenitfying OS to install GNU stow..."
|
||||||
if grep -q -i debian /etc/os-release; then
|
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 ! which nix &>/dev/null; then
|
||||||
if [ -r "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
if [ -r "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
||||||
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
. "$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
|
else
|
||||||
echo "Nix isn't available. Exiting now!"
|
echo "Nix isn't available. Exiting now!"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@ -28,6 +28,8 @@ cat << EOF > ~/.bashrc
|
|||||||
# Source nix if it's installed
|
# Source nix if it's installed
|
||||||
if [ -r ~/.nix-profile/etc/profile.d/nix.sh ]; then
|
if [ -r ~/.nix-profile/etc/profile.d/nix.sh ]; then
|
||||||
. ~/.nix-profile/etc/profile.d/nix.sh
|
. ~/.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
|
fi
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|||||||
@ -50,4 +50,6 @@ export HISTFILESIZE=10000
|
|||||||
|
|
||||||
if [ -r "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
if [ -r "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
|
||||||
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
|
. "$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
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user