Hacker News new | ask | show | jobs
by bennyp101 1260 days ago
Checkout chezmoi, I’ve been using it for a few years and it ticks every box for me - various machines, different configs, scripts, passwords etc

https://www.chezmoi.io/

7 comments

I was interested in chezmoi, but they don't want you[1] managing files outside your home directory which made it a non-starter. I need to manage /etc/ and /usr/local/ too.

[1] https://www.chezmoi.io/user-guide/frequently-asked-questions...

I'm curious about, specifically, which files you (and the sibling commenter) want to manage outside of the home directory. Is it OS package-manager configs?

This is highly dependent on distro, but for any use-cases where editing /etc/ is the recommendation, I have found that either:

(a) It's a development environment thing (e.g. httpd vhosts) & thus I see it as quite separate to "my dotfiles" (a personal machine env thing): I try my best to manage dev env stuff from project-specific repos wherever I can (i.e. a bash script to dispatch required local /etc/ changes in a repo "./scripts" dir or similar), or otherwise if it's a more significant set of configs, Ansible.

(b) It's a specific app that is recommending doing things the "Wrong Way™". There's often a workaround to get it to use $HOME or $XDG.

(c) It's OS package configs. I've found that things like repo & key installs are well suited to chezmoi run_ scripts. For anything more advanced or esoteric, I guess that may be an exception.

regular config files in ~/Library/Application Support/ Sure there are (b) workarounds, including chezmoi templates and run_ scripts with symlinks, but that's cumbersome (and some issues were only resolved recently)
Not sure what you mean? That is in your home directory...
You're right, I confused it with a different issue requiring symlinking "workarounds"
On macOS I often have the need to place stuff in /Library.
What kind of stuff? I'm genuinely curious, as I've never once had to touch /Library manually.
Launch Daemons, mostly
these go in ~/Library/LaunchAgents
Not if they need to run as root
I've been using chezmoi too and this is the only feature I miss. It'd be interesting to know what solutions folks are using. Chezmoi has some discussions around it, mostly recommending to use run scripts.
I haven't needed to keep track of dotfiles per se, but for servers I need to track changes to /etc and for that I use Etckeeper[1]

1 https://wiki.archlinux.org/title/Etckeeper

I didn't discover Chezmoi until seeing this thread (sigh). I developed a tool, filetailor, with an almost identical goal (dotfile management while accounting for differences across machines). It uses Python and YAML, but from what I can tell is similar in concept to Chezmoi.

https://github.com/k4j8/filetailor

One thing I like about filetailor I didn't see in Chezmoi was the ability to surround code with a comment specifying which machines it should be commented/uncommented for. It's easier than templates in some situations.

It works great, but there's probably tons of bugs that occur when used by someone other than me. I don't have a CS background and this was my first big hobby project.

You can use chezmoi to manage files outside your home directory if you really want to.

For an example, see https://github.com/felipecrs/dotfiles:

The `home` directory contains home directory files.

The `root` directory contains root directory files (e.g `/etc`).

I've partially adopted `aconfmgr` for the other stuff, but haven't put in the effort to refine my config, partly because I only have one applicable (arch-based) system at the moment.
they don't want you, but they also "allow you, in theory, to use chezmoi to manage any file in your filesystem, "
And best of all: it's a single executable that doesn't need any specific installing.
I'm in the process of migrating over to this. I find it much simpler and easier to configure than dotbot (which I had be using for many years). If you're only using your dotfiles on one platform, really anything will work. Where things get hairy is when you want slight tweaks or configuration changes depending on platform. Chezmoi gets this right out of the box.
On my list of new years resolutions is to finally embrace dotfiles management. This looks like just the ticket. Thanks!
been using chezmoi for the past 3 months across 4 machines. i like the template support, but i constantly feel like there's complexity hiding. im finding myself needing to relearn various bits of how it works after not touching it for a few weeks at a time.

by far, my favorite thing about chezmoi is that you're managing a separate set of files and syncing then to your homedir, making it reallllllly easy to switch tools or otherwise do something else.

its better than the home-rolled symlink solution i was using before it, and certainly better than some of these turn-your-home-dir-into-a-git-repo solutions.

but if im being honest, i hate every one of these tools in different ways. i dont have the answer, but i feel like im endlessly searching for something that feels like the right balance of simple and flexible.

anybody wanna join my dotfiles-aas startup?

My homebrew solution uses comments surrounding or in-line with the code that is machine-specific. The program then uncomments/comments the code appropriately as it is backed up and restored.

What do you think of this approach? Would that remove the complexity hiding?

i'd have to see it to have much of an opinion. have a GitHub link by chance?
See the example usage via the link below.

https://github.com/k4j8/filetailor#example-usage

The program works great for my use case, but I don't have a CS background and this was my first big project, so I'm sure it's full of bugs and poor coding practices.

I discovered chezmoi a few days ago after getting a new laptop and a wish to normalize my configuration across multiple computers.

Templating is awesome when having computers with differents DPI or screens attached, OS, etc.

Edition with --watch is a breeze, auto commit too!

settled on this as well because of its very good cross-platform support. Only thing that took some time getting used to was the model of having a source directory distinct from your actual dotfiles unlike most of the symlink based tools.
Fair point. If you're interested in why chezmoi took this particular approach, I wrote a few FAQs on its design:

Why chezmoi doesn't use symlinks: https://www.chezmoi.io/user-guide/frequently-asked-questions...

General design FAQs: https://www.chezmoi.io/user-guide/frequently-asked-questions...

That's honestly very helpful. I wasn't aware of edit.watch which is pretty much what I wanted.