This document describes what's new in chezmoi v2 for chezmoi v1 users.
If you're not using a dotfile manager, then read why you should you use a dotfile manager and then install chezmoi and follow the quick-start guide.
If you're already using a dotfile manager, but not chezmoi, then read about how chezmoi compares to other dotfile managers first and then install chezmoi, follow the quick-start guide, and read the how-to guide to quickly discover chezmoi's functionality.
chezmoi version 2 brings many new features and fixes a few corner-case bugs. Very few, if any, changes should be required to your source directory, templates, or config file.
- The new
chezmoi statuscommand shows you a concise list of differences, much likegit status. - The
chezmoi applycommand prompts you if a file has been modified by something other than chezmoi since chezmoi last wrote it, keeping you in full control of your changes, wherever you make them. - The
chezmoi initcommand will try to guess your dotfile repository if you give it a short argument. For example,chezmoi init usernameis the equivalent ofchezmoi init https://github.com/username/dotfiles.git. - chezmoi includes a builtin
gitcommand which it will use if it cannot findgitin your$PATH. This means that you don't even have to installgitto setup your dotfiles on a new machine. - chezmoi detects when your config file template has changed and prompts you to
re-run
chezmoi initif needed. - The new
create_attribute allows you to create a file with initial content, but not have it overwritten bychezmoi apply. - The new
modify_attribute allows you to modify an existing file with a script, so you can use chezmoi to manage parts, but not all, of a file. - The new script attributes
before_andafter_control when scripts are run relative to when your files are updated. - The new
--excludeoption allows you to control what types of target will be updated. For examplechezmoi apply --exclude=scriptswill cause chezmoi to apply everying except scripts andchezmoi init --apply --exclude=encryptedwill exclude encrypted files. - The new
--keep-goingoption causes chezmoi to keep going as far as possible rather than stopping at the first error it encounters. - The new
--no-ttyoption stops chezmoi from opening a TTY to read input (including passwords) and instead reads them from stdin. - The new
--source-pathoption allows you to specify targets by source path, which you can use in an on-save editor hook to automatically runchezmoi applywhen you edit a dotfile in your source state. - The new
gitHubKeystemplate function allows you to populate your~/.ssh/authorized_keysfrom your public SSH keys on GitHub. - The
promptBoolfunction now also recognizesy,yes,on,n,no, andoffas boolean values. - The
chezmoi archivecommand now includes scripts in the generated archive, and can generate.zipfiles. - The new
edit.commandandedit.argsconfiguration variables give you more control over the command invoked bychezmoi edit. - The
chezmoi initcommand has a new--one-shotoption which does a shallow clone of your dotfiles repo, runschezmoi apply, and then removes your source and configuration directories. It's the fastest way to set up your dotfiles on a emphemeral machine and then remove all traces of chezmoi. - Standard template variables are set on a best-effort basis. If errors are encountered, chezmoi leaves the variable unset rather than terminating with the error.
- The new
.chezmoi.versiontemplate variable contains the version of chezmoi. You can compare versions using version comparison functions. - The new
.chezmoi.fqdnHostnametemplate variables contains the fully-qualified domain name of the machine, if it can be determined. - You can now encrypt whole files with age.
chezmoi version 2 includes a few minor changes from version 1, mainly to enable the new functionality and for consistency:
- chezmoi uses a different format to persist its state. Specifically, this means
that all your
run_once_scripts will be run again the first time you runchezmoi apply. chezmoi add, and many other commands, are now recursive by default.chezmoi applywill warn if a file in the destination directory has been modified since chezmoi last wrote it. To force overwriting, pass the--forceoption.chezmoi editno longer supports the--promptoption.- The only diff format is now
git. Thediff.formatconfiguration variable is ignored. - Diffs include the contents of scripts that would be run.
- Mercurial support has been removed.
- The
chezmoi sourcecommand has been removed, usechezmoi gitinstead. - The
sourceVCSconfiguration group has been renamed togit. - The order of files for a three-way merge passed to
merge.commandis now actual file, target state, source state. - The
chezmoi keyringcommand has been moved tochezmoi secret keyring. - The
genericSecretconfiguration group has been renamed tosecret. - The
chezmoi chattrcommand usesencryptedinstead ofencryptas the attribute for encrypted files. - The gpg recipient is configured with the
gpg.recipientconfiguration variable,gpgRecipientis no longer used. - The structure of data output by
chezmoi dumphas changed. - The
.chezmoi.homedirtemplate variable has been replaced with.chezmoi.homeDir. For compatibility,.chezmoi.homedirwill continue to be supported until version 2.1. - The
.chezmoi.fullHostnametemplate variable has been removed, as it did not contain the full hostname. Use.chezmoi.fqdnHostname(UNIX only) instead.