feat(installers): consolidate app installers into host-aware install-apps

Fold macinstaller + install-apt-pkgs + install-tools + install-zellij into a
single host-aware lk-installers/install-apps (macOS->Homebrew, bootstrapping
Homebrew if absent; Linux->apt + upstream installers). Installs the tools the
configs assume (bat, fd, fzf, zoxide, zellij, nvim, btop, htop, tldr) plus the
fzf-git.sh helper and fzf shell integration; idempotent.

link-dotfiles gains --apps to install then link in one shot. .zshrc drops the
redundant brew/system zsh-autosuggestions source (zinit already loads it),
fixing the missing-file error on a fresh box. README documents the new flow.
This commit is contained in:
vh
2026-06-26 07:55:16 -07:00
parent ae1f13a8a3
commit bf179ef0b1
8 changed files with 130 additions and 59 deletions
+99
View File
@@ -0,0 +1,99 @@
#!/usr/bin/env bash
# Host-aware installer for every CLI tool the dotfiles assume at runtime.
#
# macOS -> Homebrew (bootstraps Homebrew itself if missing)
# Linux -> apt (Debian/Ubuntu) + upstream installers for tools not in apt
#
# zinit and all zsh plugins (powerlevel10k, zsh-autosuggestions,
# zsh-syntax-highlighting, zsh-completions, zsh-vi-mode, fzf-tab) bootstrap
# themselves from ~/.zshrc on first shell start — they are NOT installed here.
#
# Idempotent: re-running only fills gaps. Pairs with ./link-dotfiles, or run
# `./link-dotfiles --apps` to install then link in one shot.
#
# Consolidates the former macinstaller / install-apt-pkgs / install-tools /
# install-zellij scripts.
set -euo pipefail
# fzf-git.sh is a sourced helper (not a package) — same on every platform.
clone_fzf_git() {
if [ -d "$HOME/fzf-git.sh" ]; then
echo "fzf-git.sh already cloned — skipping"
else
git clone --depth 1 https://github.com/junegunn/fzf-git.sh.git "$HOME/fzf-git.sh"
fi
}
install_macos() {
if ! command -v brew >/dev/null 2>&1; then
echo "Homebrew not found — installing…"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
if [ -x /opt/homebrew/bin/brew ]; then eval "$(/opt/homebrew/bin/brew shellenv)"
elif [ -x /usr/local/bin/brew ]; then eval "$(/usr/local/bin/brew shellenv)"
fi
fi
echo "Installing CLI tools via Homebrew…"
brew install \
zsh git curl wget stow \
bat fd fzf zoxide \
zellij neovim btop htop
# tldr and neofetch are deprecated/disabled upstream — best-effort so a dead
# formula can't abort the run. tlrc is the maintained `tldr` client.
brew install tlrc || brew install tldr || echo "tldr unavailable — skipping"
brew install neofetch || echo "neofetch unavailable — skipping"
# fzf key-bindings + completion -> ~/.fzf.zsh (sourced by .zshrc). These flags
# make it non-interactive; --no-update-rc stops it editing .zshrc (the repo
# owns that file).
"$(brew --prefix)/opt/fzf/install" --key-bindings --completion --no-update-rc >/dev/null
clone_fzf_git
}
install_linux() {
if ! command -v apt >/dev/null 2>&1; then
echo "error: Linux app install targets Debian/Ubuntu (apt). Install the tools manually on this distro." >&2
exit 1
fi
echo "Installing base packages via apt…"
sudo apt update
sudo apt install -y --no-install-recommends \
neovim vim-nox btop htop neofetch curl wget tldr git zip unzip stow zsh cargo \
zsh-autosuggestions zsh-syntax-highlighting
sudo apt install -y --no-install-recommends rar unrar || true
# fzf (vendored under ~/.cache/lk-tools/fzf; .zshrc adds its bin to PATH)
if [ ! -d "$HOME/.cache/lk-tools/fzf" ]; then
git clone --depth 1 https://github.com/junegunn/fzf.git "$HOME/.cache/lk-tools/fzf"
"$HOME/.cache/lk-tools/fzf/install" --key-bindings --completion --no-update-rc
fi
clone_fzf_git
# zoxide (upstream installer -> ~/.local/bin, already on PATH)
command -v zoxide >/dev/null 2>&1 || \
curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh
# bat + fd: upstream .deb so the binaries are named `bat`/`fd` (Debian ships
# them as `batcat`/`fdfind`). amd64 assumed — adjust the URLs on arm64 boxes.
if ! command -v bat >/dev/null 2>&1; then
wget -qO /tmp/bat.deb https://github.com/sharkdp/bat/releases/download/v0.24.0/bat_0.24.0_amd64.deb
sudo apt install -y /tmp/bat.deb
fi
if ! command -v fd >/dev/null 2>&1; then
wget -qO /tmp/fd.deb https://github.com/sharkdp/fd/releases/download/v10.1.0/fd_10.1.0_amd64.deb
sudo apt install -y /tmp/fd.deb
fi
# zellij: cargo build, fall back to apt
command -v zellij >/dev/null 2>&1 || cargo install zellij || sudo apt install -y zellij
}
case "$(uname -s)" in
Darwin) install_macos ;;
Linux) install_linux ;;
*) echo "error: unsupported OS '$(uname -s)'." >&2; exit 1 ;;
esac
echo "Done. Open a new shell (or 'exec zsh') to pick everything up."
-3
View File
@@ -1,3 +0,0 @@
sudo apt update
sudo apt install neovim vim-nox btop htop neofetch curl wget tldr git zip unzip stow zsh zsh-autosuggestions zsh-syntax-highlighting cargo --no-install-recommends
sudo apt install rar unrar --no-install-recommends
-8
View File
@@ -1,8 +0,0 @@
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.cache/lk-tools/fzf
~/.cache/lk-tools/fzf/install
git clone https://github.com/junegunn/fzf-git.sh.git ~/fzf-git.sh
curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh
wget -O /tmp/bat.deb https://github.com/sharkdp/bat/releases/download/v0.24.0/bat_0.24.0_amd64.deb
sudo apt install /tmp/bat.deb
wget -O /tmp/fdfind.deb https://github.com/sharkdp/fd/releases/download/v10.1.0/fd_10.1.0_amd64.deb
sudo apt install /tmp/fdfind.deb
-7
View File
@@ -1,7 +0,0 @@
#!/bin/bash
echo "Installing Zellij via cargo..."
cargo install zellij || {
echo "Cargo failed - trying apt instead"
sudo apt update && sudo apt install -y zellij
}
-35
View File
@@ -1,35 +0,0 @@
#!/bin/bash
# filepath: /Users/vhpfi/dotfiles/lk-installers/macinstaller
# Check if Homebrew is installed
if command -v brew >/dev/null 2>&1; then
echo "Homebrew is already installed. Updating..."
brew update
else
echo "Homebrew not found. Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add Homebrew to PATH for the current session
if [[ -f /opt/homebrew/bin/brew ]]; then
# For Apple Silicon Macs
eval "$(/opt/homebrew/bin/brew shellenv)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
echo "Homebrew has been installed and added to your PATH."
elif [[ -f /usr/local/bin/brew ]]; then
# For Intel Macs
eval "$(/usr/local/bin/brew shellenv)"
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> ~/.zprofile
echo "Homebrew has been installed and added to your PATH."
else
echo "Error: Couldn't find the Homebrew binary after installation."
exit 1
fi
fi
echo "Installing packages with Homebrew..."
brew install neovim btop htop neofetch curl wget git zip unzip zsh tldr
brew install zsh-autosuggestions zsh-syntax-highlighting
brew install rustup-init
rustup-init -y
echo "Installation complete!"