Skip to content

Make assimilate.sh cross-platform (macOS + Linux)#12

Open
akan72 wants to merge 12 commits into
mainfrom
feature/cross-platform-assimilate
Open

Make assimilate.sh cross-platform (macOS + Linux)#12
akan72 wants to merge 12 commits into
mainfrom
feature/cross-platform-assimilate

Conversation

@akan72
Copy link
Copy Markdown
Owner

@akan72 akan72 commented May 29, 2026

Summary

Makes the dotfiles bootstrap work on Linux/EC2 (Amazon Linux 2023) in addition to macOS, plus assorted robustness and cleanup.

assimilate.sh — cross-platform

  • Gate on uname: macOS-only symlinks (hammerspoon, vscode, zed, ghostty) and brew bundle are skipped on Linux.
  • On Linux, .bashrc is a regular file that sources the dotfiles bashrc from a stub — so EC2 user_data secret/region appends don't write into the tracked repo file.
  • delta and neovim installed from pinned upstream release tarballs per-platform (sidesteps brew bottle ABI drift; AL2023 has no neovim in default dnf repos). Installs land in $HOME/.local, no root needed.
  • SHA256 pinned for all platform tarballs (delta arm64-darwin + x86_64-linux, neovim x86_64-linux). Neovim hash matches the publisher's official .sha256sum.
  • PackerSync only runs when nvim is on PATH.

clone_pinned — works on any git version

clone_pinned previously used git clone --revision=<sha>, which was only added in git 2.49 (March 2025). Amazon Linux 2023's GA package is git 2.40, and a given AL2023 AMI is locked to its release's package set until dnf update — so a stale/un-updated AMI would fail on the first clone (unknown option 'revision') and set -e would abort the whole bootstrap.

The latest AL2023 (2023.11, May 2026) does ship git 2.50.1, so a fully-updated current instance would have been fine — but rather than depend on AMI age, clone_pinned now uses a version-independent form:

git init -q "$dir"
git -C "$dir" remote add origin "$url"
git -C "$dir" fetch --depth 1 origin "$sha"
git -C "$dir" checkout -q "$sha"

Same shallow single-commit pin, no --revision, works on git 2.40 and up. (Fetch-by-SHA relies on the server allowing reachable-SHA1-in-want, which GitHub enables — all clone_pinned targets are GitHub.)

Robustness

  • Guard ~/.cargo/env and brew-shipped zsh plugin sources against missing files (zshrc + bashrc).
  • Source nvm with --no-use to suppress the "N/A" auto-use error when no .nvmrc is present.
  • Drop the ls=lsd alias.

Cleanup

  • Brewfile: remove k9s, py-spy, pyenv.
  • Zed: dock project panel left; exclude .claude/worktrees and dbt manifest.json from file scans.

Testing

  • bash -n / zsh -n pass on all touched scripts.
  • Linux tarball SHA256s computed from the same release URLs the script downloads; neovim verified against upstream's published checksum.
  • Recommended before EC2 use: run the bootstrap end-to-end in a throwaway amazonlinux:2023 container (installs git/tar/zsh, copies the repo to /root/dotfiles, runs assimilate.sh, asserts the .bashrc stub, symlinks, and delta/nvim installs). Not yet run in this PR.

References

akan72 added 12 commits May 16, 2026 14:34
Branches on `uname -s` to skip macOS-only steps on Linux:
- Skip hammerspoon/ghostty/vscode/zed symlinks and `brew bundle install`
- Source dotfiles bashrc from $HOME/.bashrc instead of symlinking (the EC2
  user_data appends a secrets block; symlinking would write into the repo)
- Pick delta tarball + SHA256 per OS/arch (Linux SHA marked TODO until first
  install on the EC2 box)
- Only run `nvim PackerSync` if nvim is on PATH

Enables running the install script on the EC2 dev box without breaking the
existing macOS flow.
lsd isn't installed on the EC2 dev box (no brew, dnf doesn't ship it),
and the dotfiles flow doesn't have a good place to install it cross-platform
without dragging in a several-minute cargo compile. Plain ls is fine.
Matches the same pattern nvm uses two lines above. Sourcing an absent file
errors out on shell startup, which is harmless on Mac (rust is installed)
but breaks the prompt on systems without rust.
AL2023 (and likely most non-Fedora Linuxes) don't have neovim in the
default package repos. macOS gets it from the Brewfile. Drops nvim into
$HOME/.local/bin so no root is needed. Placed above the PackerSync block
so the plugin sync that depends on `command -v nvim` actually fires.
v0.10.4 (my earlier guess) doesn't exist as a published release.
v0.9.5 is what's installed on the Mac, and v0.9.x predates the
asset-rename (still uses `nvim-linux64.tar.gz`), so the existing
extraction path stays correct.
zsh-autosuggestions, zsh-syntax-highlighting, and rust may be absent on
boxes where the Brewfile hasn't been applied (Linux dev box) or where
those brew packages aren't installed. Mirror the existing nvm/bun
pattern: source only when the file exists.
Without an argument, sourcing nvm.sh triggers nvm_auto use, which tries
to resolve a version (from .nvmrc or default-alias) and errors with
"N/A: version N/A -> N/A is not yet installed" when neither is set.
--no-use loads nvm without invoking auto-use; users still get the `nvm`
function and can `nvm use <version>` explicitly when they want one.
AL2023 on older/un-updated AMIs ships git 2.40, which lacks
`git clone --revision`. Use git init + fetch --depth 1 <sha> + checkout
instead, which pins the same single commit on any git version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant