Run OpenCode 2 from the stable Homebrew formula

Declare the opencode formula with link = false so it never replaces the
npm-installed OpenCode 1.x CLI at /opt/homebrew/bin/opencode. Drop the npm
beta install from home.activation.opencode2, point home/bin/oc2 at the keg
binary, and correct the related notes.
This commit is contained in:
Lap Tran committed 2026-11-08 12:15:22 -05:00
1 parent ec34fc005c
commit 1fda5c09b7
5 files changed
+18 -26

No files matched your search

+7 -20
View File
@@ -369,23 +369,10 @@ in
"$HOME/.codex/config.toml"
'';
# OpenCode 2 is not on Homebrew (beta). Install via Homebrew's npm, never
# Nix's npm (EACCES on the store). Skip when already present so a rebuild
# does not pull a new beta under a live TUI. Activation blocks are inlined
# into one flat script, so never `exit 0` here: that would skip every later
# block (securityAuditSkill, setupLaunchAgents, syncMusic).
home.activation.opencode2 = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
set -euo pipefail
npm=/opt/homebrew/bin/npm
bin=/opt/homebrew/bin/opencode2
if [ ! -x "$bin" ]; then
if [ ! -x "$npm" ]; then
echo "opencode2: /opt/homebrew/bin/npm missing (declare node in homebrew.brews)" >&2
exit 1
fi
"$npm" install -g --allow-scripts=@opencode-ai/cli @opencode-ai/cli@beta
fi
'';
# OpenCode 2 is the stable Homebrew `opencode` formula declared in
# configuration.nix. It is installed unlinked so the OpenCode 1.x CLI keeps
# /opt/homebrew/bin/opencode; home/bin/oc2 runs the keg binary directly.
# Nothing to install here.
# backpass (kunchenguid/backpass) - gradient descent for agent memory: reads
# the transcript stores of the harnesses this config already declares
@@ -394,8 +381,8 @@ in
# to a harness you already authenticated, so acpx is a hard runtime dep and
# must be on PATH. Homebrew node v26 satisfies backpass (>= 22.5) and acpx
# (>= 22.13). Neither is a Homebrew formula: install via Homebrew's npm,
# never Nix's npm (EACCES on the store). Skip-if-present like opencode2 so a
# rebuild never pulls a new version mid-session; refresh manually with
# never Nix's npm (EACCES on the store). Skip-if-present so a rebuild never
# pulls a new version mid-session; refresh manually with
# /opt/homebrew/bin/npm update -g backpass acpx
home.activation.backpass = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
set -euo pipefail
@@ -468,7 +455,7 @@ in
# ~/.config/opencode/skills: home-manager owns that path with force = true and
# mkOutOfStoreSymlink into the mutable dotfiles checkout, so a rebuild would
# clobber the CLI's link and CLI writes would land in the git checkout. Skip
# when installed, like opencode2/backpass, so a rebuild never pulls a new skill
# when installed, like backpass, so a rebuild never pulls a new skill
# version mid-session. The skill's own README still requires an OS-enforced
# sandbox before it may run target-controlled builds, tests, browsers, or
# fuzzers. That sandbox is home/bin/security-audit-sandbox; without it, those