<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2026-03-26T23:23:48+00:00</updated><id>/feed.xml</id><title type="html">Daniel Norman Stoddart</title><subtitle>A blog by a platform engineer from Philadelphia who automates all the things.</subtitle><entry><title type="html">Managing dotfiles with chezmoi</title><link href="/development/tools/open-source/reviews/2024/09/08/managing-dotfiles-with-chezmoi.html" rel="alternate" type="text/html" title="Managing dotfiles with chezmoi" /><published>2024-09-08T00:00:00+00:00</published><updated>2024-09-08T00:00:00+00:00</updated><id>/development/tools/open-source/reviews/2024/09/08/managing-dotfiles-with-chezmoi</id><content type="html" xml:base="/development/tools/open-source/reviews/2024/09/08/managing-dotfiles-with-chezmoi.html"><![CDATA[<h1 id="managing-dotfiles-with-chezmoi">Managing dotfiles with chezmoi</h1>

<p><img src="/assets/images/dotfiles.png" style="max-width:75%; display:block; margin:auto;" /></p>
<p style="text-align:center; font-size:inherit;"><i>Dotfiles. Don't leave home without 'em</i></p>

<p>Over the past five years or so, I’ve realised the benefits and power of <a href="https://dotfiles.github.io/">keeping the most important and configured dotfiles on my system under version control</a>.</p>

<p>Simply put, managing your dotfiles with version control keeps historical versions of your configuration files so that if something goes wrong or you accidentally overwrite a crucial setting, you can easily and trivially revert to a previous state of the file.</p>

<p>Doing this offers many benefits:</p>

<ul>
  <li>Backup and recovery</li>
  <li>Consistent configuration across multiple systems</li>
  <li>Tracking changes</li>
  <li>Ease of migration</li>
  <li>Collaboration and sharing</li>
  <li>Customizability</li>
  <li>Automation</li>
</ul>

<p>Version controlling your dotfiles adds a layer of robustness and flexibility to managing your system configuration. Dotfile management gives you the combined benefit of a consistent environment everywhere with an undo command and a restore from backup.</p>

<p>A few days ago, I discovered <a href="https://www.chezmoi.io/">chezmoi</a>, a command-line tool designed to manage dotfiles across different machines. It works by creating a repository of your dotfiles and handling the synchronisation and deployment of these files to your systems. This makes it easier to keep your configurations in sync, apply updates, and share settings across multiple machines.</p>

<p>It turns out that chezmoi is <a href="https://github.com/twpayne/chezmoi">an amazing piece of work by a group of developers</a> who deeply understand Git integration and workflow (more on that later). But before I could fully appreciate this new development, I had to embark on a series of false starts and wound up in some dead ends while trying to optimise my workflow.</p>

<h2 id="trial-and-error">Trial and error</h2>

<p>In the past, to achieve dotfile version control I had tried several methods. The first time, I used <a href="https://blog.smalleycreative.com/using-git-and-github-to-manage-your-dotfiles/">an install script</a>. Doing it that way was somewhat awkward because it created symlinks and I needed to follow up and edit file permissions to make them executable. It also lacked idempotence, because if I ran the script twice by mistake it was possible to erase the original dotfiles before the script ran again.</p>

<p>That setup didn’t last long. I remembered <a href="https://www.gnu.org/software/stow/">GNU Stow</a> and decided that it might be a solution, since Stow is cross-platform and has very simple <a href="https://git-scm.com/">Git</a> integration. However, after using Stow to manage my dotfiles for a few years, I experienced the following shortcomings and limitations:</p>

<ul>
  <li>
    <p>Stow doesn’t integrate fully with version control systems like Git. And again, just like the previous method I used, it relies on symlinks to manage the dotfiles. Any versioning or tracking has to be done manually using Git, so I had to manage my repository separately.</p>
  </li>
  <li>
    <p>Stow doesn’t offer templating or encryption features. If you need to manage sensitive information (e.g., API keys) or customize dotfiles for different machines, you need to handle these separately.</p>
  </li>
  <li>
    <p><a href="https://alex.pearwin.com/2016/02/managing-dotfiles-with-stow/">Stow is primarily a symlink manager</a> and works well on UNIX-like systems but requires extra effort to set up and maintain on different platforms, like macOS or Windows.</p>
  </li>
  <li>
    <p>Because of its nature (symbolic link management), Stow sometimes struggles with more complex directory structures or special files. It doesn’t manage secrets such as files that shouldn’t be symlinked, dotfiles that require specific ownership, or edge cases where symlinking isn’t ideal.</p>
  </li>
  <li>
    <p>While Stow is simple and effective at what it was designed to do, ultimately it’s a lower-level tool and requires manual intervention. Using it means you’re going to need to handle your Git repository and manage per-machine config outside of Stow itself.</p>
  </li>
  <li>
    <p>To use Stow, you need to manually organize your dotfiles into appropriate directories and ensure that the symbolic links are correctly created. This setup can be tedious, especially for large configurations.</p>
  </li>
</ul>

<h2 id="chezmoi-to-the-rescue">chezmoi to the rescue!</h2>

<p>I needed a better solution with less maintenance overhead. So I was intrigued when I stumbled upon the chezmoi project after a perfunctory search.</p>

<p><a href="https://www.chezmoi.io">chezmoi</a> is an application written in <a href="https://go.dev/">Go</a> and focussed exclusively on home directory management. “chezmoi” means “at my house” in French, and is pronounced /ʃeɪ mwa/ (shay-moi). It allows you to manage your configuration files across multiple machines running diverse operating systems, and solves the problems inherent in solutions that revolve around using bare Git repos or symlinking. Some of the features include:</p>

<ul>
  <li>Templates</li>
  <li>Password manager support (most of the commonly used apps)</li>
  <li>Importing files from archives</li>
  <li>Full file encryption for secrets</li>
  <li>Running scripts</li>
</ul>

<p>Best of all, updating your dotfiles on a given machine is a single command:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>chezmoi update
</code></pre></div></div>

<p>Unlike other dotfile management solutions, chezmoi is a single binary with many install methods and no bootstrap requirements. It supports private files, whole file encryption, password manager integration, and custom variables in templates. With chezmoi you can set up your personal environment on a new machine with just two short commands, with minimal dependencies.</p>

<p>After installing chezmoi, follow the <a href="https://www.chezmoi.io/quick-start/">quick start guide</a> to make the initial commit:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>chezmoi init
chezmoi add ~/.zshrc
chezmoi cd
git commit -m 'init'
git remote add # Set remote to your repo
git branch -M main
git push origin main
</code></pre></div></div>

<p>Now your ~/.zshrc is under version control. You can go ahead and add your most important dotfiles, like ~/.bashrc, ~/.bash_profile, ~/.profile, ~/.zshenv, ~/.tmux.conf, ~/.vimrc (or in my case, ~/.config/nvim/init.lua), ~/.ssh/config, ~/.gitconfig, ~/.gitignore_global, ~/.pythonrc, ~/.npmrc, ~/.curlrc, ~/.wgetrc, &amp;c.</p>

<p>chezmoi is designed to work closely with Git and other version control systems. It integrates version control commands directly into your workflow, simplifying both management and deployment. There’s built-in templating, making it easy to customize your dotfiles for different machines, environments, or users. It also includes support for encryption, so you can safely manage secrets within your dotfiles repository using tools like <a href="https://www.gnupg.org/">GPG</a>.</p>

<p>The package is cross-platform and designed to work seamlessly on Linux, macOS, and Windows. This makes it much more flexible if you manage dotfiles across different operating systems, and chezmoi is a bit more sophisticated in the way it manages edge cases. It allows you to configure certain files to be symlinked, copied, or ignored. It also supports conditional logic, so you can define different behaviours depending on the system or environment.</p>

<p>chezmoi is a higher-level tool with more built-in capabilities for managing dotfiles. It has more comprehensive documentation and a larger feature set designed specifically for dotfile management, including encrypted secrets, machine-specific configurations, and better Git integration. The setup process is mostly automated. You can initialise your dotfiles repository directly from your home directory and let chezmoi handle the file management, ensuring that files are placed in the correct locations without manual intervention.</p>

<h2 id="summary">Summary</h2>

<p><a href="https://www.chezmoi.io/">chezmoi</a> provides a more powerful, all-in-one solution for versioning, cross-platform usage, templating, and securely managing sensitive information. This makes it far superior for complex and modern dotfile management, especially in environments where you need version control, customization, and encryption.</p>]]></content><author><name></name></author><category term="Development" /><category term="Tools" /><category term="Open-Source" /><category term="Reviews" /><summary type="html"><![CDATA[Managing dotfiles with chezmoi]]></summary></entry><entry><title type="html">First post!</title><link href="/notes/2024/06/03/my-first-post.html" rel="alternate" type="text/html" title="First post!" /><published>2024-06-03T00:00:00+00:00</published><updated>2024-06-03T00:00:00+00:00</updated><id>/notes/2024/06/03/my-first-post</id><content type="html" xml:base="/notes/2024/06/03/my-first-post.html"><![CDATA[<h1 id="ive-been-away-for-a-while">I’ve been away for a while</h1>

<p>Some of you may know that for the past several years, I’ve been living quietly on an island in the Philippines with my wife and two children. By 2016, I had realised that I was in a rut personally and professionally and had decided a change of scenery was probably in order. Also, since I had been working remotely for a few years before that, I could no longer use a job as an excuse to avoid seeing more of the world. I had already been bitten by the travel bug.  A 2007 trip to Israel to explore the Holy Land, <a href="https://a.co/d/iG7us9w">the history of Byzantium and the Crusades</a>, and ancient sites like <a href="https://a.co/d/j5WFl43">Jerusalem</a>, Akko, Haifa, Tel Megiddo, Jericho, Capernaum, Beersheba, El-Araj, Beit She’an, Tel Hazor, Qumran, and <a href="https://a.co/d/3wRYZkH">Masada</a> had whetted my appetite to go off the beaten path and see parts of the world far away from the usual European tourist haunts.</p>

<p>I was only supposed to be here on the island of Negros for six months, but because of a series of circumstances beyond my control, my brief sojourn turned into what physicist <a href="https://plato.stanford.edu/entries/thomas-kuhn/">Thomas Kuhn</a> has called a “paradigm shift”. And though my shift wasn’t scientific in nature, it was a social and cultural rearrangement of assumptions I used to hold dear.</p>

<p><img src="/assets/images/kanlaon.jpg" style="max-width:75%; display:block; margin:auto;" /></p>
<p style="text-align:center; font-size:inherit;"><i>Usually the Philippines is pretty sleepy, but occasionally there's some real excitement</i></p>

<h1 id="i-blame-national-geographic">I blame National Geographic</h1>

<p>It all started with a National Geographic magazine subscription that was a childhood gift from my grandparents when I was twelve years old.</p>

<p>Whenever an issue arrived in our rural Pennsylvania mailbox that featured the Philippines, I found myself taking a particular interest in the remote island archipelago. Articles with titles such as <i>The Last Tribes of Mindanao, Sea Gypsies of the Philippines,</i> and <i>Tropical Rainforests: Nature’s Dwindling Treasures</i> fascinated me, firing my young imagination with visions of densely-packed rainforests of palm and banana trees, exotic and endangered animal species, and primitive cultures replete with supposedly noble savages and tribal chieftans.</p>

<p>In fairness, <a href="https://www.amazon.com/Anthony-Bourdain-No-Reservations/dp/B0DLV3C3J9/">Anthony Bourdain</a> must take some of the blame as well.</p>

<p>But in 2007, the idea of travelling to the Philippines, let alone living here, was a ludicrous proposition and something I would never imagine doing at that time. I liked my life in the USA for the most part, and I didn’t see myself relocating to a southeast Asian country on the other side of the planet. I was still working as a land surveyor and commuting to work. Even so, I was reading a lot about the archaeology of Israel, a country rich with ancient history.</p>

<p>I decided to save up my precious comp time and blow it all in one go on a trip to the Holy Land. My employer clearly didn’t want to let me go for that long, but they couldn’t say ‘no’ because I had earned it.</p>

<p><img src="/assets/images/jerusalem.jpg" style="max-width:75%; display:block; margin:auto;" /></p>
<p style="text-align:center; font-size:inherit;"><i>It was time for a legit adventure</i></p>

<p>So after a sleepless flight from New York City that I spent reading <a href="https://a.co/d/hUw6sTQ">guidebooks</a>, I landed in Tel-Aviv wide-eyed and beset with a sense of wonder. Little did I know what was in store for me!</p>

<p>(To be continued…)</p>]]></content><author><name></name></author><category term="Notes" /><summary type="html"><![CDATA[I’ve been away for a while]]></summary></entry></feed>