logoalt Hacker News

Migrating from GNU Stow to Chezmoi

87 pointsby speckxtoday at 5:09 PM93 commentsview on HN

Comments

technojamintoday at 10:23 PM

I've checked out stow, chezmoi, yadm, and others over the years, but I originally started off by rolling my own dotfiles setup with a Git repo about 6 years ago: https://github.com/jaminthorns/environment

I don't really recommend it to others, since there's all these great tools that have the features you need (per-machine config, secrets, templating), but I get a deep satisfaction from the fact that I understand every part of this setup from top to bottom. It only has the functionality I need, and I know it doesn't depend on anything that might become unmaintained since it's just POSIX shell scripts.

Even still, I might eventually make the jump to something like chezmoi or nix if I'm not able to implement something I need easily, but that hasn't happened yet.

show 2 replies
jdxcodetoday at 7:06 PM

It’s quite new but I’ve been cooking up some new bootstrapping features with mise which people may find relevant here: https://mise.jdx.dev/bootstrap.html

It’s for things like dotfiles, apt/brew packages, and LaunchAgents/systemd.

EDIT: I feel a little bad having hijacked this, as someone that hears a lot of opinions about devtools I can definitely say chezmoi is a darling of the community and I highly recommend checking it out.

show 5 replies
drdexebtjltoday at 6:08 PM

I had similar problems with GNU Stow, but switched to Nix and Home Manager instead.

I think Chezmoi's templates and file naming conventions don't click for me, but it's nice to see a good variety in this problem space.

show 4 replies
gchamonlivetoday at 9:26 PM

> The trouble is that symlinks cut both ways. Every edit on every machine writes straight through the link into that machine’s clone of the repo

I have stow too in my micro DE, use it across a few machines and it's holding up really well. I designed my dotfiles so that changes would happens exclusively to files not tracked by stow. I have .zshrc tracked, but environment goes to .zshenv and general local customisation goes to .local/lib/zsh/overrides.zsh (https://gitlab.com/gabriel.chamon/archie/-/blob/main/deploym...). Hyprland config is tracked but device specific configs live in .config/hype/config/device.conf (https://gitlab.com/gabriel.chamon/archie/-/blob/main/deploym...). Deployment instructions/automation is to just copy dist folders in place, which aren't tracked by stow.

It depends on everyone's style. For me personally changes I don't remember having made to files I track in the repo are symptoms that I might need to review how I organize my files. Maybe those changes were something that broke and I forgot to commit after fixing. In any case for me this bidirectional nature of symlinks are a feature, not a bug in this management system.

pkulaktoday at 6:39 PM

Once you hit the Chezmoi stage, you're only about 6 months from Nix and Home Manager. I mean, why climb _almost_ to the top of a mountain and then just sit down?

show 3 replies
vsviridovtoday at 6:54 PM

Switched to Chezmoi from random assortment of manually authored scripts. The workflow takes some getting used to, because I constantly edit the actual files without calling `chezmoi edit` first, and have to merge.

I like that when combined with `mise` (https://mise.jdx.dev) I can roll out a new computer in 2-3 commands and have my entire environment configured the way I like, with neovim and all the plugins and language servers.

show 2 replies
bloptoday at 7:33 PM

I use syncthing to automatically sync my dotfiles git directory across PC/laptops, and stow to manually update symlinks when I add a new dotfile (the content of existing dotfiles is synced by syncthing already)

That way I don't have to remember to commit+push+pull changes to existing dotfiles (like bashrc or vimrc which I edit often) to sync them to other machines, it happens automatically in almost real time as soon as the file is saved on one of my machines (syncthing uses inotify to detect changes on monitored directories)

show 1 reply
cocodilltoday at 11:03 PM

Someone needs to tell this dude about the git branches.

rochaktoday at 6:10 PM

I've been using [yadm](https://yadm.io/) instead which works really well!

show 2 replies
TeriyakiBombtoday at 9:35 PM

I found chezmoi kind of annoying and then just moved to symlinks and a fossil repo. Low tech and low drama

darkteflontoday at 9:10 PM

Ok, I came into this thread intending to say “I’ve been using stow for years and am perfectly happy with it”, started RTFA and the comments, realised that I was actually not happy with it, started considering chezmoi then remembered that I had had a pretty great experience building a Nix VM recently.

Now I want to use Nix* to manage my multi-machine MacOS and Linux setup (with lots of dotfile config overlap, of course).

That’s the HN experience for you.

Kind souls: what is currently the blessed way to manage MacOS dots with Nix? I recall there is more than one paradigm - what’s the approach that simplest, most robust and can be adopted incrementally?

Edit: Just to say that I think Atuin now also plays in this space. Haven’t checked it out, though.

spudlyotoday at 6:11 PM

It's great to manage your dotfiles, but I took it a step farther. I rebuilt the minimal Linux desktop environment of my dreams (startx, xinit, i3, i3status etc) with Ansible. It begins from a vanilla Ubuntu server 24.04.4 install. I bootstrapped it using a KVM + spice setup (using a spare physical SSD rather than a virtual one) and iterating over and over again until I finally got everything mostly working. I then booted off that physical disk, and kept iterating until everything was perfect. I've since adapted the setup to work on virtual aarch64 on macOS. I just recently tuned it to work on a crappy old Haswell Dell laptop, now properly detecting and configuring hardware vaapi capabilities, backlight, battery, trackpad, trackpoint, etc.

Pretty snazzy, watching YouTube in Firefox on a 13 year old laptop with hardware h264 decode and everything tuned exactly to my liking.

show 1 reply
mmh0000today at 6:15 PM

I’ve always managed this problem in a different way. I don’t know if my way is better, but it works really well for me.

I treat my powerful desktop computer as my main machine. Then I have a bunch of laptops.

Then I just rsync my entire home directory out to all the laptops.

From there. The rule is quite simple. Any file created on a laptop are considered ephemeral. If I create data that I have to keep. It gets rsynced back the other direction to the main machine.

This process has served me well for at least 15 years now and is supported by a small handful of shell scripts to automate this process

show 3 replies
Ferret7446today at 8:14 PM

I've never really understood why people get so fancy with their setups when you can just plop a git repo into your home directory. I suspect it has to do with people being unfamiliar with git.

show 3 replies
lucideertoday at 5:52 PM

I must've tried to set up stow five or six times over the years, in between various hand rolled custom setups. I can't put my finger on why but I set up chez moi & it's been my setup since, much longer than any previous solution.

Chez moi is definitely not without its rough edges but it seems to have gotten the subtle essentials right enough for adhd me to not have abandoned it yet.

show 3 replies
eximiustoday at 9:20 PM

I made Janus which is kinda like a less bloated Chezmoi

https://github.com/logannc/janus

show 1 reply
arrakeentoday at 6:17 PM

i feel like using GNU stow to manage your dotfiles has always been a hack.. has it ever been a supported usecase?

stow is an indispensable tool for me to manage /usr/local for manually installed software. my workflow goes:

  ./configure --prefix=/usr/local/stow/myapp
  make && make install
  stow myapp
now, myapp and all its supporting files are in the right place in /usr/local. if i want to "uninstall", i just run

  stow -D myapp
show 1 reply
sgarlandtoday at 7:28 PM

I learned about Stow after I found out about Chezmoi, and felt like Chezmoi was the better fit for me. I make heavy use of templating to keep work / personal aliases and functions separate, and could not be happier with the outcome.

groostoday at 7:04 PM

~50 years of distributed systems research and this is a problem we still have to deal with today. Sad!

QwenGlazer9000today at 6:31 PM

Chezmoi strikes a nice balance between the overkill of home-manager while still being more powerful than simpler solutions.

Yadm is another alternative, the main thing I don't like about it though is that I'm not a fan of cross OS dotfiles. Having niri files on my work Mac and aerospace dotfiles on Linux annoys me quite a bit.

As powerful as the templating in chezmoi is, I think it should be considered a last resort and only used for simple files. They break your editor features like highlighting.

show 1 reply
shevy-javatoday at 6:19 PM

I hate . dirs. In fact, I hate them so much that I don't use them.

My configuration lives primarily in .yml files. These are kept super-simple. When need be and another format is required, ruby autogenerates these for me. For instance, all my bash aliases are kept in .yml files which then get turned into bash rc files or any other target format for other shells. Same for most of my other configuration too - not always .yml but usually some text file. I never understood the neet for .foobar directories or files. They just hide a system that is intrinsically ugly and needlessly complicated.

show 2 replies
cue_the_stringstoday at 7:20 PM

[dead]