at main 4.5 kB view raw
1#!/usr/bin/env bash 2 3set -e # Exit on error 4 5root="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 6 7echo "Setting up dotfiles..." 8 9# Check if Homebrew is installed 10if ! command -v brew &> /dev/null; then 11 echo "Installing Homebrew..." 12 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 13 eval "$(/opt/homebrew/bin/brew shellenv)" 14else 15 echo "Homebrew already installed" 16fi 17 18# Install required tools 19echo "Installing required tools..." 20brew install starship btop tmux alacritty bat || true 21 22# Install Nerd Font 23echo "Installing Fira Code Nerd Font..." 24if [[ "$OSTYPE" == "darwin"* ]]; then 25 # macOS via Homebrew 26 brew tap homebrew/cask-fonts 27 brew install --cask font-fira-code-nerd-font || true 28 echo "✓ Fira Code Nerd Font installed" 29elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then 30 # Git Bash on Windows 31 echo "Downloading Fira Code Nerd Font..." 32 TEMP_DIR="/c/Users/$USER/AppData/Local/Temp/FiraCodeNF" 33 mkdir -p "$TEMP_DIR" 34 curl -fLo "$TEMP_DIR/FiraCode.zip" https://github.com/ryanoasis/nerd-fonts/releases/download/v3.3.0/FiraCode.zip 35 unzip -o "$TEMP_DIR/FiraCode.zip" -d "$TEMP_DIR" 36 37 # Use PowerShell to install fonts 38 echo "Installing fonts (requires admin)..." 39 powershell.exe -Command " 40 \$fonts = Get-ChildItem -Path '$TEMP_DIR' -Filter '*.ttf' 41 \$FONTS = 0x14 42 \$objShell = New-Object -ComObject Shell.Application 43 \$objFolder = \$objShell.Namespace(\$FONTS) 44 foreach (\$font in \$fonts) { 45 \$objFolder.CopyHere(\$font.FullName, 0x10) 46 } 47 " 48 rm -rf "$TEMP_DIR" 49 echo "✓ Fira Code Nerd Font installed" 50elif [[ -f /proc/version ]] && grep -qi microsoft /proc/version; then 51 # WSL - fonts need to be installed on Windows side 52 echo "⚠️ WSL detected: Please install fonts on Windows using Git Bash or manually" 53else 54 # Linux 55 FONT_DIR="$HOME/.local/share/fonts" 56 mkdir -p "$FONT_DIR" 57 cd /tmp 58 curl -fLo FiraCode.zip https://github.com/ryanoasis/nerd-fonts/releases/download/v3.3.0/FiraCode.zip 59 unzip -o FiraCode.zip -d "$FONT_DIR/FiraCode" 60 rm FiraCode.zip 61 fc-cache -fv 62 cd "$root" 63 echo "✓ Fira Code Nerd Font installed" 64fi 65 66# Install oh-my-zsh if not already installed 67if [ ! -d "$HOME/.oh-my-zsh" ]; then 68 echo "Installing oh-my-zsh..." 69 sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended 70else 71 echo "oh-my-zsh already installed" 72fi 73 74# Install TPM (Tmux Plugin Manager) if not already installed 75if [ ! -d "$HOME/.tmux/plugins/tpm" ]; then 76 echo "Installing TPM (Tmux Plugin Manager)..." 77 git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm 78else 79 echo "TPM already installed" 80fi 81 82# Create necessary directories 83echo "Creating config directories..." 84mkdir -p ~/.config 85mkdir -p ~/.config/alacritty 86mkdir -p ~/.config/alacritty/themes 87mkdir -p ~/.config/1Password/ssh 88mkdir -p ~/.config/btop/themes 89 90# Clone alacritty themes if not already present 91if [ ! -d "$HOME/.config/alacritty/themes/.git" ]; then 92 echo "Cloning alacritty themes..." 93 git clone https://github.com/alacritty/alacritty-theme ~/.config/alacritty/themes 94else 95 echo "Alacritty themes already installed" 96fi 97 98# Create symlinks 99echo "Creating symlinks..." 100ln -sf "$root/.vimrc" ~/.vimrc 101ln -sf "$root/.zshrc" ~/.zshrc 102ln -sf "$root/.gitconfig" ~/.gitconfig 103ln -sf "$root/.globalgitignore" ~/.globalgitignore 104ln -sf "$root/.tmux.conf" ~/.tmux.conf 105 106ln -sf "$root/.config/alacritty/alacritty.toml" ~/.config/alacritty/alacritty.toml 107ln -sf "$root/.config/alacritty/catppuccin-mocha.toml" ~/.config/alacritty/catppuccin-mocha.toml 108ln -sf "$root/.config/1Password/ssh/agent.toml" ~/.config/1Password/ssh/agent.toml 109ln -sf "$root/.config/nvim" ~/.config/nvim 110ln -sf "$root/.config/starship.toml" ~/.config/starship.toml 111ln -sf "$root/.config/btop/themes/catppuccin_mocha.theme" ~/.config/btop/themes/catppuccin_mocha.theme 112 113# Configure git 114echo "Configuring git..." 115git config --global core.excludesfile ~/.globalgitignore 116 117echo "Dotfiles setup complete!" 118echo "" 119echo "Next steps:" 120echo " 1. Set your terminal font to 'FiraCode Nerd Font Mono'" 121echo " 2. Open a new terminal to see Starship prompt" 122echo " 3. In tmux, press Ctrl+b then Shift+I to install Catppuccin theme" 123echo " 4. In btop, press Esc → Options → Select 'catppuccin_mocha' theme"