Automatically install coder in nix environments

This commit is contained in:
anmiller 2024-05-21 20:26:30 +00:00
parent af57f9cf4c
commit ca1311d92a

View File

@ -7,13 +7,17 @@ echo "PWD: $PWD"
# Coder dotfiles (and most other ways of doing this) will not do a recursive clone, so do that in install script. # Coder dotfiles (and most other ways of doing this) will not do a recursive clone, so do that in install script.
git submodule init && git submodule update git submodule init && git submodule update
# Match case insensitively to make things easier for this part
shopt -s nocasematch
echo "Installing dotfiles..." echo "Installing dotfiles..."
if [ -f /etc/os-release ]; then if [ -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 [ "${CODER_OS_FAMILY:-}" == "Ubuntu" ] || grep -q -i debian /etc/os-release; then
echo "You've got Debian!"; 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
elif grep -q -i rhel /etc/os-release || grep -q -i fedora /etc/os-release; then elif grep -q -i rhel /etc/os-release || grep -q -i fedora /etc/os-release; then
echo "You've got RedHat (or maybe Fedora)! Which is unsupported right now sorry!"; echo "You've got RedHat (or maybe Fedora)! Which is unsupported right now sorry!";
# sudo yum install -y stow; # sudo yum install -y stow;
@ -28,9 +32,13 @@ if [ -f /etc/os-release ]; then
exit 1; exit 1;
fi; fi;
else else
if [ "${CODER_TEMPLATE_TYPE}" == "Devcontainer" ]; then
installers/install-nix.sh
fi
echo "ERROR: Unable to find '/etc/os-release' information!" 1>&2; echo "ERROR: Unable to find '/etc/os-release' information!" 1>&2;
exit 1; exit 1;
fi fi
shopt -u nocasematch
# Apply the dotfiles with stow # Apply the dotfiles with stow
echo "Running apply dotfiles" echo "Running apply dotfiles"