obsidian_kitty_setup/lib/packages.sh
Vadym Samoilenko d31fbf9c99 Initial dotfiles setup — Kitty + Obsidian logging system
- GNU Stow packages: kitty, fish, nvim, btop, fastfetch, starship, git, claude
- install.sh with modular install, template rendering, fish plugins setup
- uninstall.sh (stow -D) and scripts/doctor.sh for health checks
- Brewfile (macOS) + Aptfile (Linux servers)
- Claude Code hooks pipeline: settings.json.tpl, Obsidian session logging scripts
- memory-compiler inline copy with env-var-based paths
- Python scripts patched: os.environ.get() for OBSIDIAN_VAULT + PROJECTS_ROOT
- fish/config.fish: platform-aware Homebrew PATH (macOS + Linuxbrew)
- .env.example template for ~/.dotfiles.env

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 12:57:30 +01:00

67 lines
2 KiB
Bash

#!/usr/bin/env bash
# lib/packages.sh — package installation for macOS (brew) and Linux (apt)
install_packages() {
local repo_dir="$1"
step "Installing packages ($(os_name))"
if is_macos; then
_install_macos "$repo_dir"
elif is_linux; then
_install_linux "$repo_dir"
else
warn "Unknown OS — skipping package installation."
fi
}
_install_macos() {
local repo_dir="$1"
if ! has_cmd brew; then
info "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
info "Running brew bundle..."
brew bundle --file="$repo_dir/Brewfile" --no-lock
success "Homebrew packages installed."
}
_install_linux() {
local repo_dir="$1"
info "Updating apt..."
sudo apt-get update -qq
if [[ -f "$repo_dir/Aptfile" ]]; then
info "Installing apt packages from Aptfile..."
while IFS= read -r pkg; do
[[ -z "$pkg" || "$pkg" == \#* ]] && continue
sudo apt-get install -y "$pkg" 2>/dev/null \
&& success " apt: $pkg" \
|| warn " apt: $pkg not found (may need manual install)"
done < "$repo_dir/Aptfile"
fi
# uv (Python package manager) — not in apt
if ! has_cmd uv; then
info "Installing uv..."
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
fi
# lsd — modern ls, not in default apt
if ! has_cmd lsd; then
info "Installing lsd via cargo (or snap)..."
if has_cmd snap; then snap install lsd 2>/dev/null; fi
fi
# lazygit — not in apt
if ! has_cmd lazygit; then
info "Installing lazygit..."
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep '"tag_name"' | sed 's/.*"v\([^"]*\)".*/\1/')
curl -Lo /tmp/lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
tar xf /tmp/lazygit.tar.gz -C /tmp lazygit
sudo install /tmp/lazygit /usr/local/bin
rm /tmp/lazygit.tar.gz /tmp/lazygit
fi
success "Linux packages installed."
}