From 0b6f96a952d77bfe1bf13349b80ecba874c2bb0a Mon Sep 17 00:00:00 2001 From: Max Novak Date: Wed, 14 Oct 2026 18:38:39 +0000 Subject: [PATCH] Add Brewfile.local and a Ghostty config.local for local overrides Brewfile.local is ignored by git and installed after the Brewfile, so your own additions never conflict with `git pull`. Ghostty gets a `config-file = ?config.local` line after the repo's, so settings there override the repo's. CI installs a package from a Brewfile.local to prove it's picked up. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 7 +++++-- .gitignore | 1 + README.md | 6 +++--- dotfiles/ghostty | 2 ++ setup.sh | 18 +++++++++++++++++- 5 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 .gitignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f232a31..86d588b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,8 +55,11 @@ jobs: timeout-minutes: 60 steps: - uses: actions/checkout@v7 - - name: First run - run: ./setup.sh + - name: First run, with a Brewfile.local + run: | + echo 'brew "hello"' > Brewfile.local + ./setup.sh + brew list hello > /dev/null # fails if Brewfile.local was skipped - name: Second run changes nothing run: | snapshot() { diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..49759f6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +Brewfile.local diff --git a/README.md b/README.md index b912d21..1988fb8 100644 --- a/README.md +++ b/README.md @@ -28,14 +28,14 @@ My recommended developer setup for a new Mac (Apple Silicon or Intel), installab ./macos-defaults.sh ``` -Want a different selection? Edit the [`Brewfile`](Brewfile) before running `./setup.sh`: comment out what you don't want, uncomment what you do. +Want a different selection? Edit the [`Brewfile`](Brewfile) before running `./setup.sh`: comment out what you don't want, uncomment what you do. To add your own apps and tools, put them in a `Brewfile.local` next to it, in the same format (`brew "lazygit"`, `cask "stats"`). git ignores that file, so `git pull` never conflicts with it. ### What `setup.sh` does - Installs [Homebrew](https://brew.sh/) if it's missing and adds it to your `PATH` in `~/.zprofile` -- Installs everything in the [`Brewfile`](Brewfile) with `brew bundle`. Apps you already installed yourself, like Chrome, are handed over to Homebrew rather than installed again +- Installs everything in the [`Brewfile`](Brewfile) with `brew bundle`, then everything in your `Brewfile.local` if you have one. Apps you already installed yourself, like Chrome, are handed over to Homebrew rather than installed again - Adds one `source` line to the end of `~/.zshrc` that loads [`dotfiles/zshrc`](dotfiles/zshrc) -- Adds a `config-file` line to `~/.config/ghostty/config` that loads [`dotfiles/ghostty`](dotfiles/ghostty), which makes **Cmd+K** clear the screen inside herdr and tmux too, and makes the left Option key work as Alt +- Adds a `config-file` line to `~/.config/ghostty/config` that loads [`dotfiles/ghostty`](dotfiles/ghostty), which makes **Cmd+K** clear the screen inside herdr and tmux too, and makes the left Option key work as Alt. A second line loads `~/.config/ghostty/config.local` after it, if you create one, so your settings there override the repo's - Creates `~/.config/herdr/config.toml` from [`dotfiles/herdr.toml`](dotfiles/herdr.toml) if you don't have one, or adds the tab shortcut to the one you have - Adds an include to the top of `~/.gitconfig` that loads [`dotfiles/gitconfig`](dotfiles/gitconfig) - Turns on commit signing with your SSH key, if you have one and haven't set up signing already, and lets git check those signatures (`git log --show-signature`) diff --git a/dotfiles/ghostty b/dotfiles/ghostty index 2cb1ec6..eea8e64 100644 --- a/dotfiles/ghostty +++ b/dotfiles/ghostty @@ -1,5 +1,7 @@ # Loaded from your Ghostty config by setup.sh (config-file = ...). Ghostty # reads included files last, so these settings override your own config. +# To override them in turn, put your settings in config.local next to your +# Ghostty config: setup.sh loads it after this file. # Cmd+K: send Ctrl+L instead of Ghostty's own clear_screen. Ghostty skips # clear_screen while a full-screen app (herdr, tmux) is running and sends the diff --git a/setup.sh b/setup.sh index 3dd7f99..abdd29a 100755 --- a/setup.sh +++ b/setup.sh @@ -59,6 +59,12 @@ step "Apps and tools from the Brewfile" # The failures are listed at the end. BUNDLE_FAILED="" brew bundle --file="$REPO_DIR/Brewfile" || BUNDLE_FAILED=1 +# Your own additions, kept out of git so `git pull` never conflicts with them. +BREWFILE_LOCAL="$REPO_DIR/Brewfile.local" +if [[ -f "$BREWFILE_LOCAL" ]]; then + step "Apps and tools from Brewfile.local" + brew bundle --file="$BREWFILE_LOCAL" || BUNDLE_FAILED=1 +fi step "Shell config" ZSHRC_LINE="source \"$REPO_DIR/dotfiles/zshrc\"" @@ -81,6 +87,13 @@ else printf '\n%s\n' "$GHOSTTY_LINE" >> "$GHOSTTY_CONFIG" note "added to the end of $GHOSTTY_CONFIG (applies to new Ghostty windows)" fi +# Listed after the repo's file, so it loads later and its settings win. The ? makes it +# optional, and the path is relative to $GHOSTTY_CONFIG. +GHOSTTY_LOCAL_LINE="config-file = ?config.local" +if ! grep -qxF "$GHOSTTY_LOCAL_LINE" "$GHOSTTY_CONFIG"; then + printf '%s\n' "$GHOSTTY_LOCAL_LINE" >> "$GHOSTTY_CONFIG" + note "settings in $(dirname "$GHOSTTY_CONFIG")/config.local now override the repo's" +fi step "herdr config" # herdr's config.toml has no include directive, so it is copied rather than linked. @@ -198,7 +211,10 @@ fi if [[ -n "$BUNDLE_FAILED" ]]; then step "Some Brewfile entries didn't install" - brew bundle check --file="$REPO_DIR/Brewfile" --no-upgrade --verbose 2>&1 | sed 's/^/ /' || true + for brewfile in "$REPO_DIR/Brewfile" "$BREWFILE_LOCAL"; do + [[ -f "$brewfile" ]] || continue + brew bundle check --file="$brewfile" --no-upgrade --verbose 2>&1 | sed 's/^/ /' || true + done note "Look for \"Error:\" in the brew bundle output above, fix it, then re-run ./setup.sh" exit 1 fi