Hacker News new | ask | show | jobs
by varl 1388 days ago
Chezmoi has some interesting features, that go beyond simply managing dot-files in a Git-repo, that allows it too deepen in a way that makes it quite capable:

- templating for any configuration file built-in

- support for password managers

- can download and unpack an archive, or clone a repo, and refresh it e.g. once a week

- run scripts when applying config changes (either once, or every time)

- can handle config files that are externally modified

- can keep the source dotfiles encrypted on disk, and only unlock them when applying changes to the local generated files

In my usage so far Chezmoi has replaced and is now responsible for:

- Vim plugins

- ZSH plugins

- Generate SSH and GPG keys per context when a new machine is set up

- Git configuration (with per-machine and per context GPG and SSH keys)

- Install software on FreeBSD/Linux/MacOS that I need, both from source and/or package managers

- Per machine customization (e.g. differences between 4 core and 8 cores, or 1 GB of RAM vs. 48 GB RAM, etc.)

- Per OS customization (e.g. differences between ZSH on Arch vs. MacOS)

- Per host customization (e.g. different Vim configs on workstations vs. servers)

As far as setting up a new machine goes, I install chezmoi and git manually, and then I run `chezmoi init {dotfiles-repo}`, and that takes care of (almost) everything else, for MacOS, FreeBSD, Debian, and Arch Linux, each with the specific customization I need for that specific distro and host, all generated from a single source of configuration files.

Key for me is that all variations of e.g. `.zshrc` is generated from a single `dot_zshrc_tmpl` file.

Chezmoi is a tool that deepens with use, and I am finding more uses for it as I continue to use it.

When symlinks or a bare Git repo becomes unwieldy, perhaps the platform itself has a native solution (nix, home-manager) or there is something else that does all of it (ansible, dhall) and that's cool. In other cases there is Chezmoi, which was easy to learn to use.

... Except getting used to `chezmoi edit ~/.vimrc` to make changes to a config file. That is some hefty muscle memory to overcome.

1 comments

Honestly, that's quite the list. From the title and even the home page, it looks like yet another dotfiles manager, but it looks like it can replace what I've gotten with half-baked scripts. Integration with password managers is great!
If you're the kind of person to use ansible or equivalent, anything user-specific is most likely a better experience in czm.

You can get away with doing stuff like package installation as well but anything more advanced on system-level and you probably want to keep/introduce configuration management for that.