Files
dotfiles/link-dotfiles
T
lkrav 7076d40191 chore(shell): powerlevel10k prompt, host-aware bootstrap, drop thefuck
- zsh prompt: replace oh-my-posh with powerlevel10k via zinit, with the
  instant-prompt preamble near the top of .zshrc for fast startup
- remove thefuck/thefk entirely: .zshrc aliases, install-thefk,
  home_config/thefuck, and its .stow-global-ignore entry
- link-dotfiles: one-shot host-aware bootstrap — detect macOS vs Linux,
  install GNU stow if missing (brew / apt/dnf/pacman), then stow both trees
- retire oh-my-posh: delete the bash + pwsh installers and
  home_config/ohmyposh (starship covers PowerShell separately)
- README: document the new bootstrap and prompt setup
2026-06-26 07:33:57 -07:00

54 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# One-shot, host-aware dotfile linker for Linux & macOS.
#
# home_root/* -> ~/<name> (e.g. ~/.zshrc) via `stow home_root`
# home_config/* -> ~/.config/<name> (e.g. ~/.config/nvim) via `stow home_config`
#
# Ensures GNU stow is present first (Homebrew on macOS; apt/dnf/pacman on Linux),
# so a fresh box needs nothing pre-installed. Re-running is safe — stow is
# idempotent and refuses to clobber unrelated real files.
#
# Windows / PowerShell: run ./link-dotfiles.ps1 instead (stow has no native
# Windows port; the .ps1 mirrors this with junctions + symlinks).
set -euo pipefail
repo="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$repo"
ensure_stow() {
command -v stow >/dev/null 2>&1 && return
echo "GNU stow not found — installing it…"
case "$(uname -s)" in
Darwin)
if ! command -v brew >/dev/null 2>&1; then
echo "error: Homebrew is required on macOS. Run ./lk-installers/macinstaller first." >&2
exit 1
fi
brew install stow
;;
Linux)
if command -v apt >/dev/null 2>&1; then sudo apt update && sudo apt install -y stow
elif command -v dnf >/dev/null 2>&1; then sudo dnf install -y stow
elif command -v pacman >/dev/null 2>&1; then sudo pacman -S --noconfirm stow
else
echo "error: no supported package manager (apt/dnf/pacman). Install GNU stow manually." >&2
exit 1
fi
;;
*)
echo "error: unsupported OS '$(uname -s)'. On Windows run ./link-dotfiles.ps1 instead." >&2
exit 1
;;
esac
}
ensure_stow
echo "Linking home_root -> ~"
stow -v home_root
echo "Linking home_config -> ~/.config"
stow -v --target="$HOME/.config" home_config
echo "Done."