#!/usr/bin/env bash # Idempotent install: ensure zsh + oh-my-zsh, then symlink configs. set -euo pipefail SRC=$(cd "$(dirname "$0")" && pwd) # 1. zsh (workspace base image may or may not have it) if ! command -v zsh >/dev/null 2>&1; then sudo apt-get update -qq sudo apt-get install -y --no-install-recommends zsh fi # 2. oh-my-zsh if [ ! -d "$HOME/.oh-my-zsh" ]; then RUNZSH=no CHSH=no KEEP_ZSHRC=yes \ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" fi # 3. zsh plugins (autosuggestions + syntax highlighting) ZSH_CUSTOM=${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom} [ -d "$ZSH_CUSTOM/plugins/zsh-autosuggestions" ] || \ git clone -q https://github.com/zsh-users/zsh-autosuggestions "$ZSH_CUSTOM/plugins/zsh-autosuggestions" [ -d "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting" ] || \ git clone -q https://github.com/zsh-users/zsh-syntax-highlighting "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting" # 4. symlink every file under home/ into $HOME (idempotent) while IFS= read -r f; do rel=${f#"$SRC/home/"} mkdir -p "$HOME/$(dirname "$rel")" ln -sf "$SRC/home/$rel" "$HOME/$rel" done < <(find "$SRC/home" -mindepth 1 -type f) # 5. default shell -> zsh CURSHELL=$(getent passwd "$USER" | cut -d: -f7) if [ "$CURSHELL" != "$(command -v zsh)" ]; then sudo chsh -s "$(command -v zsh)" "$USER" || true fi # 6. VSCodium / VS Code extensions (only installs if the binary is present locally; # Coder workspaces don't have these, so this is a no-op there). EXTS_FILE="/home/.config/VSCodium/extensions.txt" for BIN in codium code; do if command -v "" >/dev/null 2>&1 && [ -f "" ]; then while IFS= read -r ext; do case "" in ""|\#*) continue ;; esac "" --install-extension "" --force >/dev/null 2>&1 || true done < "" echo ": extensions synced" fi done echo "dotfiles installed: zsh + ohmyzsh + symlinks from $SRC/home"