Skip to content

Manage dotfiles with chezmoi - #1

Merged
DevItBetter merged 9 commits into
masterfrom
refactor/portable-dotfiles
Oct 29, 2026
Merged

DevItBetter merged 9 commits into
masterfrom
refactor/portable-dotfiles

Conversation

@DevItBetter

@DevItBetter DevItBetter commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Turns the repository into a plain chezmoi source directory. The earlier version of this PR wrapped chezmoi in deploy.py, provision.sh, and a mise selector, and symlinked files into the checkout. All of that is gone.

Layout

  • .chezmoiroot points at home/. Docs, examples, fonts, and tests stay out of $HOME.
  • home/.chezmoi.toml.tmpl asks for Git name, email, mise profile, and desktop once per machine, and detects WSL and containers.
  • home/.chezmoidata/ holds the system package list and the mise profiles. ~/.config/mise/config.toml is rendered from them.
  • home/.chezmoiscripts/ installs packages (brew, apt, dnf, pacman, zypper), installs mise, runs mise install when the config changes, builds zsh and tmux plugins, configures VS Code, and sets the login shell.
  • Antidote and TPM are .chezmoiexternal.toml git repos.
  • zsh moves to ~/.config/zsh (ZDOTDIR set in ~/.zshenv). Git moves to ~/.config/git/config. ~/.gitconfig is created once and belongs to the machine.
  • Agent integrations deploy only when the profile installs that agent. Claude Code settings merge through a modify_ template.

Migration

run_once_before_00-migrate-legacy-links removes the old links into the checkout and the generated mise fragments, and copies zsh/config/work.zsh and local.zsh into ~/.config/zsh/local.zsh. Steps are in docs/reference.md.

Testing

node --test tests/*.test.mjs runs real chezmoi init and chezmoi apply into temporary homes. It checks:

  • the mise config and agent files for each profile
  • the Git identity, and that ~/.gitconfig is never overwritten
  • the Claude Code settings merge
  • that a second apply changes nothing
  • the legacy migration
  • that zsh starts with nothing on stderr

It also covers the agent launchers. CI runs the tests on Ubuntu and macOS, then bootstraps a fresh runner with chezmoi init --apply. The same bootstrap passed locally in an Ubuntu 24.04 container.

DevItBetter and others added 6 commits October 28, 2026 16:42
Replace custom symlink setup with script/deploy.py, which drives four
chezmoi source trees and honors HOME, XDG, ZDOTDIR, and Pi paths.
Deployment previews by default, refuses to overwrite unknown files
without --adopt, backs up replaced files, and migrates legacy repository
symlinks without writing through into the checkout.

Split host provisioning into script/provision.sh (preview by default),
keep ~/.gitconfig machine-local with an include of the shared config,
make Zsh startup portable across Linux, macOS, WSL, and containers, and
let mise selections recover from retired catalog IDs.

Add deployment tests, a Linux/macOS CI workflow, and docs/reference.md.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Plugins now load before compinit so their completion directories join
fpath, but several plugins call compdef while loading. Queue those calls
and replay them once compinit defines compdef.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
compinit aborts without a terminal when compaudit finds insecure
directories, which left compdef undefined. Warn about those directories
and run compinit -i instead, and secure the runner's directories in CI.

On macOS, VS Code setup checked the agent launcher with /bin/true, which
only exists as /usr/bin/true there. Use /bin/sh -c : instead. The
Copilot launcher tests now resolve /var to /private/var.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
On macOS the configurator writes to ~/Library/Application Support and
uses .osx profile keys, but the test fixture assumed Linux paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ShellCheck returns to the baseline packages (ShellCheck on DNF and yum).
Provisioning now adds Alacritty on macOS and on Linux machines with a
local X11 or Wayland session, and skips it over SSH, in containers, and
on WSL. --terminal forces it and --no-terminal leaves it out.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace deploy.py, provision.sh, the mise selector, and the symlinked
checkout with a standard chezmoi source directory under home/:

- .chezmoi.toml.tmpl asks for Git identity, mise profile, and desktop once
  per machine; .chezmoidata holds packages and mise profiles.
- run_onchange_/run_once_ scripts install packages, mise, tools, zsh and
  tmux plugins, configure VS Code, and set the login shell.
- Antidote and TPM are chezmoi externals.
- zsh lives in ~/.config/zsh via ZDOTDIR; Git in ~/.config/git with a
  machine-owned ~/.gitconfig.
- Agent integrations deploy only for agents the profile installs; Claude
  Code settings merge through a modify template.
- A run_once migration removes the old checkout links and keeps local
  zsh files.

Tests run real chezmoi init/apply into temporary homes; CI also
bootstraps fresh Ubuntu and macOS runners.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@DevItBetter DevItBetter changed the title Migrate dotfiles deployment to chezmoi for cross-platform use Manage dotfiles with chezmoi Oct 28, 2026
DevItBetter and others added 3 commits October 28, 2026 17:54
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
alias-tips' preexec hook returns non-zero internally, and ERR_EXIT turned
that into a failed step before any check ran.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Agents and editors run zsh with TERM=dumb, where starship prints an error.
The silent-startup test now uses a starship stub so it catches this.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@DevItBetter
DevItBetter merged commit 143c07d into master Oct 29, 2026
8 checks passed
@DevItBetter
DevItBetter deleted the refactor/portable-dotfiles branch October 29, 2026 04:43
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