init
This commit is contained in:
77
provision.sh
Normal file
77
provision.sh
Normal file
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env bash
|
||||
# provision.sh — set up a new machine from this dotfiles repo
|
||||
#
|
||||
# What this does:
|
||||
# 1. Installs system dependencies (stow, git, neovim, mise, ripgrep)
|
||||
# 2. Uses stow to symlink each config package into your home directory
|
||||
#
|
||||
# What this does NOT do:
|
||||
# - Set your git name/email (edit git/.gitconfig yourself)
|
||||
# - Run mise install (do that manually after review)
|
||||
#
|
||||
# Usage:
|
||||
# bash provision.sh # normal run
|
||||
# bash provision.sh --dry-run # show what would happen, do nothing
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
DRY_RUN=false
|
||||
if [[ "${1:-}" == "--dry-run" ]]; then
|
||||
DRY_RUN=true
|
||||
echo "[dry-run] No changes will be made."
|
||||
fi
|
||||
|
||||
run() {
|
||||
if $DRY_RUN; then
|
||||
echo "[dry-run] $*"
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
echo "Dotfiles directory: $DOTFILES_DIR"
|
||||
|
||||
# ============================================================
|
||||
# SYSTEM PACKAGES
|
||||
# ============================================================
|
||||
echo "==> Installing system packages..."
|
||||
run sudo dnf install -y \
|
||||
stow \
|
||||
git \
|
||||
neovim \
|
||||
ripgrep \
|
||||
curl
|
||||
|
||||
# Install mise if not already present
|
||||
if ! command -v mise &>/dev/null; then
|
||||
echo "==> Installing mise..."
|
||||
run curl https://mise.run | bash
|
||||
else
|
||||
echo "==> mise already installed, skipping."
|
||||
fi
|
||||
|
||||
# ============================================================
|
||||
# STOW PACKAGES
|
||||
# ============================================================
|
||||
# Each directory in dotfiles/ is a stow "package".
|
||||
# stow creates symlinks in ~ that mirror the package directory structure.
|
||||
#
|
||||
# Example: bash/.bashrc → ~/.bashrc
|
||||
|
||||
PACKAGES=(bash git mise nvim)
|
||||
|
||||
echo "==> Stowing config packages..."
|
||||
for pkg in "${PACKAGES[@]}"; do
|
||||
echo " stow $pkg"
|
||||
# --restow removes and recreates links (handles updates)
|
||||
# --target=$HOME is explicit about where links go
|
||||
run stow --restow --target="$HOME" --dir="$DOTFILES_DIR" "$pkg"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "Done. Next steps:"
|
||||
echo " 1. Edit ~/gitconfig — set your name and email"
|
||||
echo " 2. Run: mise install"
|
||||
echo " 3. Open nvim — plugins will install automatically on first launch"
|
||||
echo " 4. In nvim, run :checkhealth to verify your setup"
|
||||
Reference in New Issue
Block a user