mirror of
https://github.com/jakejarvis/dotfiles.git
synced 2025-04-26 03:45:21 -04:00
restore codespaces setup script
This commit is contained in:
parent
5bcbf0afd1
commit
19b9e5aa23
54
codespaces/codespaces.sh
Executable file
54
codespaces/codespaces.sh
Executable file
@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
# link automatically cloned dotfiles repo to regular ~/.dotfiles path
|
||||
# https://docs.github.com/en/codespaces/troubleshooting/troubleshooting-personalization-for-codespaces#troubleshooting-dotfiles
|
||||
ln -sf /workspaces/.codespaces/.persistedshare/dotfiles ~/.dotfiles
|
||||
|
||||
# clean up
|
||||
sudo rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# extra ubuntu packages
|
||||
if [[ "$(sudo find /var/lib/apt/lists/* | wc -l)" = "0" ]]; then
|
||||
sudo apt-get update
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
man \
|
||||
curl \
|
||||
wget \
|
||||
lsb-release \
|
||||
ca-certificates \
|
||||
file \
|
||||
shared-mime-info
|
||||
fi
|
||||
|
||||
# prepare zinit manually
|
||||
ZINIT_HOME="$HOME/.local/share/zinit/zinit.git"
|
||||
if [[ ! -d "$ZINIT_HOME" ]]; then
|
||||
mkdir -p "$(dirname "$ZINIT_HOME")"
|
||||
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
|
||||
fi
|
||||
|
||||
# install volta
|
||||
if ! command -v volta &>/dev/null; then
|
||||
export VOLTA_HOME="$HOME/.volta"
|
||||
export PATH="$VOLTA_HOME/bin:$PATH"
|
||||
curl -fsSL https://get.volta.sh | bash -s -- --skip-setup
|
||||
fi
|
||||
volta install node@lts npm@latest yarn@latest
|
||||
|
||||
# install rbenv & ruby-build
|
||||
if ! command -v rbenv &>/dev/null; then
|
||||
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
|
||||
fi
|
||||
|
||||
# install pyenv
|
||||
if ! command -v pyenv &>/dev/null; then
|
||||
curl -fsSL https://github.com/pyenv/pyenv-installer/raw/HEAD/bin/pyenv-installer | bash
|
||||
fi
|
||||
|
||||
# set shell to zsh
|
||||
sudo chsh -s /bin/zsh "$(whoami)"
|
||||
|
||||
# clean up
|
||||
sudo rm -rf /var/lib/apt/lists/*
|
@ -12,7 +12,6 @@ DOTFILES_PATH="${DOTFILES_PATH:="$HOME/.dotfiles"}"
|
||||
# https://docs.github.com/en/codespaces/troubleshooting/troubleshooting-personalization-for-codespaces#troubleshooting-dotfiles
|
||||
if [[ "$CODESPACES" = "true" ]]; then
|
||||
DOTFILES_PATH="/workspaces/.codespaces/.persistedshare/dotfiles"
|
||||
ln -sf "$DOTFILES_PATH" ~/.dotfiles
|
||||
elif [[ ! -f "README.md" ]]; then
|
||||
# clone this repo if this script is all by its lonesome
|
||||
git clone https://github.com/jakejarvis/dotfiles.git "$DOTFILES_PATH"
|
||||
@ -45,6 +44,9 @@ if [[ "$(uname)" = "Darwin" ]]; then
|
||||
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
source "$DOTFILES_PATH/macos/macos.sh"
|
||||
elif [[ "$CODESPACES" = "true" ]]; then
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
source "$DOTFILES_PATH/codespaces/codespaces.sh"
|
||||
fi
|
||||
|
||||
echo "🎉 Done!"
|
||||
|
@ -180,6 +180,7 @@ zinit snippet OMZ::lib/clipboard.zsh
|
||||
zinit snippet OMZ::lib/termsupport.zsh
|
||||
|
||||
# iTerm2 integration
|
||||
# shellcheck disable=SC2016
|
||||
zinit ice lucid \
|
||||
if'[[ "$TERM_PROGRAM" = "iTerm.app" ]]' \
|
||||
pick"shell_integration/zsh" \
|
||||
|
Loading…
x
Reference in New Issue
Block a user