From 13cc065ec014b86369dfe4ad60d1a43fa06fd251 Mon Sep 17 00:00:00 2001 From: Igor Soarez Date: Thu, 17 Sep 2026 19:45:23 +0100 Subject: dotfiles Shell, editor and terminal configuration, the tools that go with them, and szecret, an age-based secret manager whose store lives elsewhere. History restarts here. What came before was not written to be read by anyone else, and carried machine names, addresses and an encrypted secret store; it is kept privately instead. What is left is meant to be safe on any machine, including one whose owner is not me: see CLAUDE.md for the rule it is written to. --- install.sh | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 install.sh (limited to 'install.sh') diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..8870624 --- /dev/null +++ b/install.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +# Set up this account on a machine: the tools, checkouts and nvim plugins that +# the config link.sh links expects. Run it by hand, after `./link.sh yes`, once +# per machine and again whenever the Brewfile changes; every step only adds +# what is missing. Unlike link.sh it is slow and may stop to ask for a password, +# so nothing runs it on a timer. +# +# ~/src/soarez/dot/install.sh +# +# On a new Mac, also run ./macos-defaults.sh, once -- see its header. A private +# layer's bootstrap may call both for you. +# +# Runs under macOS's /bin/bash 3.2. + +set -euo pipefail + +dotfiles_dir="$(cd "$(dirname "$0")" && pwd)" + +# 1. Homebrew packages, on macOS. Linux machines get their packages from +# whatever provisions them, not from here. +if [[ "$(uname)" == "Darwin" ]]; then + if ! command -v brew >/dev/null 2>&1; then + for b in /opt/homebrew/bin/brew /usr/local/bin/brew; do + if [[ -x "${b}" ]]; then + eval "$("${b}" shellenv)" + break + fi + done + fi + if ! command -v brew >/dev/null 2>&1; then + >&2 echo "ERROR: Homebrew is not installed. Install it first, then re-run this:" + >&2 echo ' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"' + exit 1 + fi + # --no-upgrade: install what is missing and leave what is there alone. Plain + # `brew bundle` also upgrades every listed package that is out of date. + brew bundle --no-upgrade --file="${dotfiles_dir}/Brewfile" +fi + +# 2. Checkouts the config reads: the pure prompt (config/zshrc falls back to a +# plain one without it) and the extra colour schemes bin/theme lists. Over +# https: both are public, so a fresh machine needs no ssh key for them. +# Existing checkouts are left alone. +clone() { + local url="$1" dest="$2" + if [[ -d "${dest}/.git" ]]; then + return + fi + mkdir -p "$(dirname "${dest}")" + git clone --quiet "${url}" "${dest}" + echo "cloned ${dest}" +} +clone https://github.com/sindresorhus/pure.git "${HOME}/src/sindresorhus/pure" +clone https://github.com/alacritty/alacritty-theme.git "${HOME}/src/alacritty/alacritty-theme" + +# 3. nvim's plugins, so the first real launch does not stop to install them. +# `install`, not `sync`: install only fetches plugins that are missing, and +# leaves installed ones where this host's lock file (~/.config/nvim/ +# lazy-lock.json, not in the repo) has them. sync would also update every +# plugin to its latest version and rewrite that lock file. +if command -v nvim >/dev/null 2>&1; then + nvim --headless "+Lazy! install" +qa || true +fi + +if [[ "$(uname)" == "Darwin" ]]; then + echo + echo "Setting up a new Mac? Also run this, once:" + echo " ${dotfiles_dir}/macos-defaults.sh" + echo "It applies the baseline Finder, Dock and keyboard settings, and resets the Dock." +fi -- cgit v1.2.3