Skills2026年5月5日·1 分钟阅读

chezmoi — Manage Dotfiles Across Multiple Machines

A dotfile manager that uses a source-state model with templates, secrets integration, and support for multiple operating systems from a single repository.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Needs Confirmation · 64/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
chezmoi Overview
通用 CLI 安装命令
npx tokrepo install be1b7fd7-4838-11f1-9bc6-00163e2b0d79

Introduction

chezmoi manages your dotfiles across multiple machines by maintaining a source directory that serves as the single source of truth. It handles machine-specific differences through templates and securely integrates with password managers for secrets.

What chezmoi Does

  • Maintains dotfiles in a versioned source state directory separate from your home directory
  • Applies configuration files with Go text/template for machine-specific differences
  • Integrates with 1Password, Bitwarden, LastPass, pass, Vault, and system keyrings for secrets
  • Supports file encryption via age or GPG for sensitive dotfiles
  • Works on Linux, macOS, Windows, and FreeBSD with a single binary

Architecture Overview

chezmoi stores a source state in ~/.local/share/chezmoi (typically a git repo). Each file in the source has a name that encodes attributes (executable, private, template). When you run chezmoi apply, it computes the target state by evaluating templates and comparing against the destination. Only files that differ are written, making applies idempotent and safe.

Self-Hosting & Configuration

  • Install via Homebrew, Scoop, apt, pacman, nix, or download the binary directly
  • Initialize with chezmoi init which creates the source directory and optionally clones a dotfiles repo
  • Configure in ~/.config/chezmoi/chezmoi.toml for merge tool, diff command, and secrets manager integration
  • Use .chezmoiignore to exclude files per OS or hostname
  • Run chezmoi update on each machine to pull and apply the latest changes from your repo

Key Features

  • Template system handles OS, hostname, and architecture differences in a single repo
  • Secrets never appear in plaintext in the source repository
  • Declarative desired-state model means partial applies and rollbacks are trivial
  • Built-in chezmoi diff previews changes before applying
  • Supports running scripts on apply for tasks like installing packages or reloading services

Comparison with Similar Tools

  • GNU Stow — symlink-based; chezmoi copies files, enabling templates and encryption
  • yadm — thin git wrapper; chezmoi adds templates, secrets, and cross-OS support
  • dotbot — YAML-driven symlinker; chezmoi handles file content transformation
  • rcm — tag-based organization; chezmoi uses attribute-encoded filenames for more granular control
  • Nix Home Manager — full declarative system; chezmoi is lighter and does not require Nix

FAQ

Q: How do I handle different configs for work and personal machines? A: Use template conditionals on .chezmoi.hostname or custom data variables defined in chezmoi.toml.

Q: Can I use chezmoi with an existing dotfiles repo? A: Yes. Run chezmoi import or manually place files in the source directory and add them with chezmoi add.

Q: Does chezmoi overwrite local changes? A: By default it warns about conflicts. Use chezmoi merge to three-way merge or configure auto-merge behavior.

Q: How do I share some dotfiles publicly but keep secrets private? A: Encrypt sensitive files with age or GPG, or pull secrets at apply-time from a password manager.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产