Violet Guo

Dotfiles to Notfiles

24 January 2022 - 2 min read
  • tech

I accidentally nuked all of my dotfiles.

Let me explain. I finally decided to back up my dotfiles properly. I found a seemingly straightforward Bash script that

  1. moves your current dotfiles from your root directory to a designated directory, aka your dotfile repo. Now this repo will become the source of truth. It is also tracked by Git.
  2. creates symlink at your root directory, which links to your dotfile repo.

What could possibly go wrong? This random script I found wasn’t idempotent. It failed but did not stop processing the rest of my files in the background. When I tried to run it again, it overwrote the links that were already linked with the link itself, and the originl dotfiles were lost.

Thankfully, I did stash my dotfiles somewhere. I proceeded with caution and there’re so many ways to go about dotfile mgmt.

  1. write your own shell script. I don’t trust myself at this point…
  2. use a git bare repo. TBH I really didn’t understand the whole rationale behind it.
  3. install someone’s pkg via a pkg mgmer. but what if the author abandons the project?
  4. finally, I found the dotbot

Dotbot

  • it lives with your dotfile repo as a submodule. worst case scenario, the authoer abandons the project, and you just keep one working copy of it
  • it’s deisgned to be idempotent. I value this design especially after my dotfile disaster.
  • if you want a more detailed tutorial, try the official guide or this blog post

I finally have a pretty basic dotfile setup. It’s been years and I can’t believe no one taught this in university.

Speedround

Taken from one of the dotfile repos I found.

frustration The frustration is real. End.