Live data from Hacker News

Chezmoi – Manage your dotfiles across multiple diverse machines, securely

chezmoi.io

21–30 of 62 posts

Re: Chezmoi – Manage your dotfiles across multiple diverse machines, securely

#21

I just use a boring python-script for this job, which links everything from my repo to the correct location. This has the benefit that I can also add some personal tweak to some configs, like linking my userchrome from Firefox to my profile. Similar solution for packages and other settings, just a bunch of shell script doing stuff. I tried using Ansible in the past, but maintaining a rarely used tool with many update…

I doubt the scripts are simple, it’s not easy to make such things idempotent.

Re: Chezmoi – Manage your dotfiles across multiple diverse machines, securely

#22
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.

Re: Chezmoi – Manage your dotfiles across multiple diverse machines, securely

#23
Between this and the article yesterday [1] I'm really curious what configs everyone has that they really miss when they don't have them. I know people will fight for their vim config, but what other settings do you actually care about?

[1]https://news.ycombinator.com/item?id=32632533

Re: Chezmoi – Manage your dotfiles across multiple diverse machines, securely

#24
post #3

Somewhat odd to claim managing dotfiles securely and then tell people to execute 350 lines of shell script to install it.

Somewhat disingenuous to boil it down to this, when it's merely one of the ways presented with 4 other ways of installing it, including downloading the binary, package managers, building from source...

Looking at said install script it's also pretty much just figuring out the host OS and architecture, downloading the corresponding binary, checking its integrity and copying it in place.

Re: Chezmoi – Manage your dotfiles across multiple diverse machines, securely

#25

Between this and the article yesterday [1] I'm really curious what configs everyone has that they really miss when they don't have them. I know people will fight for their vim config, but what other settings do you actually care about? [1] https://news.ycombinator.com/item?id=32632533

Having fish installed is a big one, and then a bunch of additional binaries and shell functions that are installed in ~/.local/bin. Most notable among those is direnv, which I want on any computer where I have a project directory. After that, it’s mostly little things that happen rarely, like the tmux configuration for those cases when I am spending a lot of time on a remote server.

Re: Chezmoi – Manage your dotfiles across multiple diverse machines, securely

#26
2 weeks ago someone asked

> Ask HN: Can I see your scripts?[1]

I really like this[2] solution from /u/hoechst,

> Not really a script, but a `.ssh/config` to automatically deploy parts of my local cli environment to every server i connect to (if username and ip/hostname matches my rules).

> On first connect to a server, this sync all the dotfiles i want to a remote host and on subsequent connects, it updates the dotfiles.

> Idk if this is "special", but I haven't seen anyone else do this really and it beats for example ansible playbooks by being dead simple.

    Match Host 192.168.123.*,another-example.org,*.example.com User myusername,myotherusername
       ForwardAgent yes
       PermitLocalCommand yes
       LocalCommand rsync -L --exclude .netrwhist --exclude .git --exclude .config/iterm2/AppSupport/ --exclude .vim/bundle/youcompleteme/ -vRrlptze "ssh -o PermitLocalCommand=no" %d/./.screenrc %d/./.gitignore %d/./.bash_profile %d/./.ssh/git_ed25519.pub %d/./.ssh/authorized_keys %d/./.vimrc %d/./.zshrc %d/./.config/iterm2/ %d/./.vim/ %d/./bin/ %d/./.bash/ %r@%n:/home/%r

[1] https://news.ycombinator.com/item?id=32467957

[2] https://news.ycombinator.com/item?id=32468605

Re: Chezmoi – Manage your dotfiles across multiple diverse machines, securely

#27

Between this and the article yesterday [1] I'm really curious what configs everyone has that they really miss when they don't have them. I know people will fight for their vim config, but what other settings do you actually care about? [1] https://news.ycombinator.com/item?id=32632533

fish, neovim, alacritty, bat, karabiner, lsd, tmux, skhd, yabai, sketchybar

fish, neovim, tmux, skhd are the most important ones. Can't live without them.

Re: Chezmoi – Manage your dotfiles across multiple diverse machines, securely

#28

I use Nix [1] (package manager) to handle my configurations over different systems. There is a somewhat steep learning curve, but it is perfect for my use-cases. [1]: https://nixos.org

Would that work across Linux/macOS/Windows? Thought Nix was generally for Linux, and usable with caveats on macOS, but no Windows support. Main selling point of Chezmoi seems to be the "multiple diverse machines" part, which would mean multiple OSes and at least Linux/macOS/Windows.

I use it on Linux and macOS machines. I am afraid there is no support for Windows.

Re: Chezmoi – Manage your dotfiles across multiple diverse machines, securely

#29
post #24
post #3

Somewhat odd to claim managing dotfiles securely and then tell people to execute 350 lines of shell script to install it.

Somewhat disingenuous to boil it down to this, when it's merely one of the ways presented with 4 other ways of installing it, including downloading the binary, package managers, building from source... Looking at said install script it's also pretty much just figuring out the host OS and architecture, downloading the corresponding binary, checking its integrity and copying it in place.

It's the first thing after the elevator pitch intro.

I didn't even notice the install link (which is in a menu on the side) and the text didn't indicate another installation option.

Re: Chezmoi – Manage your dotfiles across multiple diverse machines, securely

#30
post #9

Earlier quoted context omitted.

Security is in the eyes of the beholder. I was trying to find the actual program. All i found was only instructions how to install it.

On the homepage you can find a link to the github-repo in the top right corner. https://github.com/twpayne/chezmoi/

written on a boat
Post reply on HN