<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Rhizomatic-Systems on paradigmatic.systems</title>
    <link>https://paradigmatic.systems/tags/rhizomatic-systems/</link>
    <description>Recent content in Rhizomatic-Systems on paradigmatic.systems</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Thu, 26 Nov 2026 10:00:00 -0400</lastBuildDate><atom:link href="https://paradigmatic.systems/tags/rhizomatic-systems/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Further Adventures with Rhizomatic Nix</title>
      <link>https://paradigmatic.systems/posts/further-rhizomaticity/</link>
      <pubDate>Thu, 26 Nov 2026 10:00:00 -0400</pubDate>
      
      <guid>https://paradigmatic.systems/posts/further-rhizomaticity/</guid>
      <description>Doing more with less: Suporting remote dev work and parallel agents on resource-constrained NixOS systems</description>
      <content:encoded><![CDATA[<figure class="align-center ">
    <img loading="lazy" src="/ginger-rhizome.jpg#center"
         alt="Botanical plate of a ginger plant: leafy shoots and a flower spike rising from a knobbly, branching rhizome"/> <figcaption>
            <p>Ginger Rhizome
                    <a href="https://commons.wikimedia.org/wiki/File:Zingiber_officinale_-_K%C3%B6hler%E2%80%93s_Medizinal-Pflanzen-146.jpg">Plate from Köhler&rsquo;s Medizinal-Pflanzen (1887), public domain, via Wikimedia Commons</a></p>
        </figcaption>
</figure>

<p>Numerous data modeling systems allow you to consider a fleet of computers as one gestalt entity.  The promise is a single source of truth describing any number of parameterized nodes, as an input for code generation allowing push-button integrations and deployments. Nix takes it to the furthest conclusion: our &ldquo;model&rdquo; can specify the entire operating system and program space of every node in the network, down to the exact build of every dependency.</p>
<p>A <strong>rhizomatic</strong> system gains a kind of introspection. The declarations live inside the system, and the system converges on them. I&rsquo;ve <a href="/posts/rhizomatic-systems">laid out</a> a few of the tools and techniques that I&rsquo;ve adopted. If you are responsible for 2 or more computers then I think there&rsquo;s a huge quality-of-life gain going down this route. Especially now that you don&rsquo;t actually have to write the Nix and Bash! You just have to know what to ask for.</p>
<h2 id="who-herds-the-herdrs">Who Herds the Herdrs</h2>
<p>The relationships of humans to code and tooling are changing so quickly that I feel any in-depth workflow analysis will quickly become dated. That being said, I&rsquo;m finding <a href="https://herdr.dev/">Herdr</a> suiting my needs at the moment. Namely, surfacing the 3-dimensional matrix:</p>
<p><code>(REPOS) x (WORKTREES) x (AGENTS)</code></p>
<p>If you&rsquo;re hardware-constrained, agent fanout can pretty quickly hog your resources. So in a rhizomatic system it might make sense to have a single <em>Herdr</em> instance running on the machine with the most system RAM - call it the &ldquo;build machine&rdquo; or <code>.#buildr</code>.</p>
<p>But your $200 refurbished HP Spectre with 8 GB of RAM can still be useful for getting work done! You can just provide it a thin wrapper package:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-nix" data-lang="nix"><span style="display:flex;"><span>  herd <span style="color:#f92672">=</span> pkgs<span style="color:#f92672">.</span>writeShellApplication {
</span></span><span style="display:flex;"><span>    name <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;herd&#34;</span>;
</span></span><span style="display:flex;"><span>    runtimeInputs <span style="color:#f92672">=</span> [ pkgs<span style="color:#f92672">.</span>openssh ];
</span></span><span style="display:flex;"><span>    text <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      exec ssh -t buildr </span><span style="color:#e6db74">${</span>buildrHerdr<span style="color:#e6db74">}</span><span style="color:#e6db74"> &#34;$@&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    &#39;&#39;</span>;
</span></span><span style="display:flex;"><span>  };
</span></span></code></pre></div><p>Now you&rsquo;ve got your 1 canonical Herdr instance shared across the fleet. Cool! Granted this isn&rsquo;t doing much - we&rsquo;re just baking in an <code>ssh</code> command that uses the already-cool functionality. But this is our starting point for the remote-dev workflows of the rest of the post.</p>
<h2 id="more-remote-development">More Remote Development</h2>
<p>Alright, so you can control development on <code>.#buildr</code>. What if you want to run your latest work on the Spectre? And also, what if your app is a generic FHS binary, i.e. it makes assumptions that no longer hold in NixOS? Well, it couldn&rsquo;t possibly be easier. <code>nixpkgs</code> already has a helper to make an FHS wrapper:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-nix" data-lang="nix"><span style="display:flex;"><span>myAppFhs <span style="color:#f92672">=</span> pkgs<span style="color:#f92672">.</span>buildFHSEnv {
</span></span><span style="display:flex;"><span>  name <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;my-app-fhs&#34;</span>;
</span></span><span style="display:flex;"><span>  targetPkgs <span style="color:#f92672">=</span>
</span></span><span style="display:flex;"><span>    p: <span style="color:#66d9ef">with</span> p; [
</span></span><span style="display:flex;"><span>      alib
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">...</span>
</span></span><span style="display:flex;"><span>      zlib
</span></span><span style="display:flex;"><span>    ];
</span></span><span style="display:flex;"><span>  runScript <span style="color:#f92672">=</span> pkgs<span style="color:#f92672">.</span>writeShellScript <span style="color:#e6db74">&#34;myapp-fhs&#34;</span> <span style="color:#e6db74">&#39;&#39;exec &#34;$@&#34;&#39;&#39;</span>;
</span></span><span style="display:flex;"><span>};
</span></span></code></pre></div><p>Then Spectre gets a package:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-nix" data-lang="nix"><span style="display:flex;"><span> myAppRun <span style="color:#f92672">=</span> pkgs<span style="color:#f92672">.</span>writeShellApplication {
</span></span><span style="display:flex;"><span>    name <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;my-app-run&#34;</span>;
</span></span><span style="display:flex;"><span>    runtimeInputs <span style="color:#f92672">=</span> [
</span></span><span style="display:flex;"><span>      pkgs<span style="color:#f92672">.</span>openssh
</span></span><span style="display:flex;"><span>      pkgs<span style="color:#f92672">.</span>rsync
</span></span><span style="display:flex;"><span>      pkgs<span style="color:#f92672">.</span>coreutils
</span></span><span style="display:flex;"><span>      myAppFhs
</span></span><span style="display:flex;"><span>    ];
</span></span><span style="display:flex;"><span>    text <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      remote_host=&#34;buildr&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      echo &#34;my-app-run: building on $remote_host...&#34; &gt;&amp;2
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      # ssh starts in the home directory, so the path is relative to it
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      if ! remote=$(ssh &#34;$remote_host&#34; &#39;cd my-app &amp;&amp; nix build .#my-app.export --print-out-paths&#39; | tail -n 1) || [ -z &#34;$remote&#34; ]; then
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">        echo &#34;my-app-run: build failed&#34; &gt;&amp;2
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">        exit 1
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      fi
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      local_dir=&#34;</span><span style="color:#ae81ff">&#39;&#39;$</span><span style="color:#e6db74">{XDG_CACHE_HOME:-$HOME/.cache}/my-app&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      mkdir -p &#34;$local_dir&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      rsync -z --partial --info=progress2 &#34;$remote_host:$remote/bin/my-app&#34; &#34;$local_dir/my-app&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      chmod +x &#34;$local_dir/my-app&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      exec my-app-fhs &#34;$local_dir/my-app&#34; &#34;$@&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    &#39;&#39;</span>;
</span></span><span style="display:flex;"><span>  };
</span></span></code></pre></div><p>This triggers the remote build, copies the binary over, and runs it in the FHS wrapper. That&rsquo;s a nice facade for doing dev work from a machine that is too weak to really do much on its own!</p>
<h2 id="sharing-the-box">Sharing the Box</h2>
<p>Now <code>.#buildr</code> holds every agent in the fleet, and does all the builds, on top of whatever jobs it already had (such as being the household media server). All by virtue of having a relatively beefy 16 GB of RAM. Wait, that&rsquo;s it?! Agent fanout is still a big risk here, so we&rsquo;ll need to mitigate it in-place a bit.</p>
<h3 id="download-more-ram">Download More RAM</h3>
<p>Well, first we ought to <a href="https://docs.kernel.org/admin-guide/blockdev/zram.html">download some more RAM</a>.  zstd gets about 4.5:1 on this machine, so 7.7 GB of swapped pages costs about 1.7 GB of real memory:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-nix" data-lang="nix"><span style="display:flex;"><span>zramSwap <span style="color:#f92672">=</span> {
</span></span><span style="display:flex;"><span>  enable <span style="color:#f92672">=</span> <span style="color:#66d9ef">true</span>;
</span></span><span style="display:flex;"><span>  memoryPercent <span style="color:#f92672">=</span> <span style="color:#ae81ff">50</span>;
</span></span><span style="display:flex;"><span>};
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>boot<span style="color:#f92672">.</span>kernel<span style="color:#f92672">.</span>sysctl <span style="color:#f92672">=</span> {
</span></span><span style="display:flex;"><span>  <span style="color:#75715e"># make the kernel prefer a compressed swap over throwing away page cache</span>
</span></span><span style="display:flex;"><span>  <span style="color:#e6db74">&#34;vm.swappiness&#34;</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">180</span>;
</span></span><span style="display:flex;"><span>  <span style="color:#75715e"># ...and turn off readahead, which only pays off on a real disk.</span>
</span></span><span style="display:flex;"><span>  <span style="color:#e6db74">&#34;vm.page-cluster&#34;</span> <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>;
</span></span><span style="display:flex;"><span>};
</span></span></code></pre></div><h3 id="cap-services-at-the-systemd-level">Cap Services at the systemd Level</h3>
<p>This is a nice parameter available at the service level, which simply fences off the green, yellow, and red zones for whatever you&rsquo;re running. Making sure that the media server doesn&rsquo;t interfere with the rest of the system:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-nix" data-lang="nix"><span style="display:flex;"><span>systemd<span style="color:#f92672">.</span>services<span style="color:#f92672">.</span>jellyfin<span style="color:#f92672">.</span>serviceConfig <span style="color:#f92672">=</span> {
</span></span><span style="display:flex;"><span>  MemoryHigh <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;2G&#34;</span>;
</span></span><span style="display:flex;"><span>  MemoryMax <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;3G&#34;</span>;
</span></span><span style="display:flex;"><span>};
</span></span></code></pre></div><h3 id="make-build-slots-in-projects">Make Build Slots In Projects</h3>
<p>zram only serves to soften spikes - if our agents spin out many parallel builds, they can still gum things up. There&rsquo;s any number of ways to solve this. We could start <code>herdr</code> in its own systemd scope and use the same technique from the last section. I elected instead to use a handful of lock files in the runtime directory, outside the project tree, so they&rsquo;re shared by every worktree and no daemon or coordinator is involved:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>take_slot<span style="color:#f92672">()</span> <span style="color:#f92672">{</span>
</span></span><span style="display:flex;"><span>  local dir<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;</span><span style="color:#e6db74">${</span>XDG_RUNTIME_DIR<span style="color:#66d9ef">:-</span>/tmp<span style="color:#e6db74">}</span><span style="color:#e6db74">/myapp-build-slots&#34;</span>
</span></span><span style="display:flex;"><span>  mkdir -p <span style="color:#e6db74">&#34;</span>$dir<span style="color:#e6db74">&#34;</span>
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">while</span> :; <span style="color:#66d9ef">do</span>
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">for</span> i in <span style="color:#66d9ef">$(</span>seq <span style="color:#ae81ff">1</span> <span style="color:#e6db74">&#34;</span><span style="color:#e6db74">${</span>MYAPP_BUILD_SLOTS<span style="color:#66d9ef">:-</span>3<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span><span style="color:#66d9ef">)</span>; <span style="color:#66d9ef">do</span>
</span></span><span style="display:flex;"><span>      exec <span style="color:#f92672">{</span>slot_fd<span style="color:#f92672">}</span>&gt;<span style="color:#e6db74">&#34;</span>$dir<span style="color:#e6db74">/</span>$i<span style="color:#e6db74">.lock&#34;</span>
</span></span><span style="display:flex;"><span>      flock -n <span style="color:#e6db74">&#34;</span>$slot_fd<span style="color:#e6db74">&#34;</span> <span style="color:#f92672">&amp;&amp;</span> <span style="color:#66d9ef">return</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>      exec <span style="color:#f92672">{</span>slot_fd<span style="color:#f92672">}</span>&gt;&amp;-
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">done</span>
</span></span><span style="display:flex;"><span>    sleep <span style="color:#ae81ff">1</span>
</span></span><span style="display:flex;"><span>  <span style="color:#66d9ef">done</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">}</span>
</span></span></code></pre></div><p>Then either introduce a convention and hope your agent follows it, or enforce it by injecting a wrapped version of your builder into the agent&rsquo;s dev shell:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-nix" data-lang="nix"><span style="display:flex;"><span>buildGated <span style="color:#f92672">=</span> pkgs<span style="color:#f92672">.</span>writeShellApplication {
</span></span><span style="display:flex;"><span>  name <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;wrapped-builder&#34;</span>;
</span></span><span style="display:flex;"><span>  runtimeInputs <span style="color:#f92672">=</span> [ pkgs<span style="color:#f92672">.</span>util-linux ];
</span></span><span style="display:flex;"><span>  text <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    # take_slot as defined above
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    take_slot
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    exec </span><span style="color:#e6db74">${</span>real-builder<span style="color:#e6db74">}</span><span style="color:#e6db74"> &#34;$@&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">  &#39;&#39;</span>;
</span></span><span style="display:flex;"><span>};
</span></span></code></pre></div><p>If an agent tries to build on a busy system, from its perspective it simply takes longer than normal as it waits for a slot to free up. The builder inherits the lock&rsquo;s file descriptor, so the slot frees itself however the run ends, even if it crashes or the out-of-memory killer takes it. One caveat: a builder that leaves a background daemon running hands the descriptor to it, and the slot stays taken until that daemon exits.</p>
<h2 id="summary">Summary</h2>
<p>I&rsquo;ve tried to ground the idea of a rhizomatic system in concrete examples. NixOS allows us to treat a group of computers as a single programmable unit. To do so we need to consider both the way they inter-relate, and how each one functions on its own to be an effective member. The main thesis to take away is that it&rsquo;s fun and easy to do things in NixOS!</p>
]]></content:encoded>
    </item>
    
    <item>
      <title>Rhizomatic Systems; Or, the Maximum Rizz YOLO Homelab</title>
      <link>https://paradigmatic.systems/posts/rhizomatic-systems/</link>
      <pubDate>Sat, 03 Oct 2026 19:00:00 -0400</pubDate>
      
      <guid>https://paradigmatic.systems/posts/rhizomatic-systems/</guid>
      <description>A NixOS monorepo pattern where everything can see everything, and updates arrive as CI commits.</description>
      <content:encoded><![CDATA[<h2 id="the-tree-and-the-rhizome">The Tree and the Rhizome</h2>
<p>Systems models are typically <em>arborescent</em>, or tree-like. There is a root source of truth, and everything else extends from there. Kubernetes has its API server. Ansible has whichever laptop you ran the playbook from. Terraform has a state file with a lock. Even my own <a href="/posts/setting-up-deploy-rs">deploy-rs setup</a> had a root: one machine with the keys, pushing closures outward to nodes that could only receive. That&rsquo;s a fine shape when an ops team <em>is</em> the root. For one person with a few computers, it means one of them is special, and the whole system is only as available as that one.</p>
<figure class="align-center ">
    <img loading="lazy" src="/rhizome-vs-tree.jpg#center"
         alt="A tree with a single trunk and branching roots beside a rhizome, a tangle of shoots and roots with no center"/> <figcaption>
            <p>Tree and rhizome.
                    <a href="https://commons.wikimedia.org/wiki/File:Rhizome_vs_tree.jpg">Drawing by Magda Wojtyra and Marc Ngui, CC BY-SA 4.0, via Wikimedia Commons</a></p>
        </figcaption>
</figure>

<p>A <em>rhizome</em>, like ginger or crabgrass, is a network of connected points. In <a href="https://en.wikipedia.org/wiki/A_Thousand_Plateaus"><em>A Thousand Plateaus</em></a>, Deleuze and Guattari lay out some of the principles of <em>rhizomatic thought</em>. A rhizome connects different types of things together, with no central pivot. A rhizome may be broken at any point, and it starts up again along its old lines or along new ones. Finally, they insist on the <em>map</em> over the <em>tracing</em>: a tracing copies a structure that was decided in advance, while a map is drawn from whatever actually connected and stays open to redrawing.</p>
<p>But this isn&rsquo;t a philosophy post. It&rsquo;s about how the endgame of my fleet configuration ended up taking a rhizomatic shape due to a handful of decisions.</p>
<h2 id="the-fleet-config-monorepo">The Fleet Config Monorepo</h2>
<p>If you install NixOS on a single computer, you end up with a <code>/etc/nixos/configuration.nix</code> which is the source code for the computer, usually importing an auto-generated <code>hardware-configuration.nix</code>. If you install NixOS on several computers, you end up with several of those. They&rsquo;ll tend to have some overlap, on everything from timezones to your preferred dev tooling. If you want to upgrade something, you&rsquo;ll repeat the same process on each computer. If you want to add cross-cutting functionality, well, you get the idea.</p>
<p>The move then is to create a single <code>flake.nix</code> whose schema provides a top-level <code>nixosConfigurations</code>. Your fleet becomes an attrset. Forgiving some pseudo-Nix for the rest of the post:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-nix" data-lang="nix"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  desktop <span style="color:#f92672">=</span> { <span style="color:#f92672">...</span> };
</span></span><span style="display:flex;"><span>  laptop <span style="color:#f92672">=</span> { <span style="color:#f92672">...</span> };
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p>This of course allows you to abstract out shared segments of their definitions:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-nix" data-lang="nix"><span style="display:flex;"><span><span style="color:#66d9ef">let</span> devTools <span style="color:#f92672">=</span> [ firefox git ]; <span style="color:#66d9ef">in</span>
</span></span><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  desktop <span style="color:#f92672">=</span> {
</span></span><span style="display:flex;"><span>    packages <span style="color:#f92672">=</span> devTools <span style="color:#f92672">++</span> [ <span style="color:#f92672">...</span> ];
</span></span><span style="display:flex;"><span>  };
</span></span><span style="display:flex;"><span>  laptop <span style="color:#f92672">=</span> {
</span></span><span style="display:flex;"><span>    packages <span style="color:#f92672">=</span> devTools <span style="color:#f92672">++</span> [ <span style="color:#f92672">...</span> ];
</span></span><span style="display:flex;"><span>  };
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p>It&rsquo;s a pretty neat way to parameterize any number of machines under a single source of truth!</p>
<p>One of the first steps in <em>Rhizome</em>-hood is to introduce a <em>forge</em>.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-nix" data-lang="nix"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  vps <span style="color:#f92672">=</span> {
</span></span><span style="display:flex;"><span>    services<span style="color:#f92672">.</span>forgejo<span style="color:#f92672">.</span>enable <span style="color:#f92672">=</span> <span style="color:#66d9ef">true</span>;
</span></span><span style="display:flex;"><span>  };
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p>Its role is to</p>
<ol>
<li>Host the config repo (among others)</li>
<li>Run CI; in particular, a <code>check.yml</code> that builds all the hosts on every PR. Breaking changes don&rsquo;t make it in.</li>
</ol>
<p>I want the forge highly available, so I host it on my low-resource VPS, and my home laptop, which has the RAM for it, serves as the CI runner.</p>
<p>Notice what that does to the shape. The config is no longer administered from outside the fleet by one special machine with the keys. It is hosted, built, and checked by members of the fleet it describes.</p>
<h2 id="any-node-reaches-any-node">Any Node Reaches Any Node</h2>
<p><a href="https://github.com/slackhq/nebula">Nebula</a> is a nifty tool from Slack that lets you define a network overlay with certificate-based identities.
One well-known node (the &ldquo;lighthouse&rdquo;) acts as a rendezvous point, not a relay. Nodes usually talk directly once they find each other, even from behind NAT.</p>
<p>The VPS is the obvious choice for the lighthouse since it has a stable public IP. Making use of the <code>rec</code> keyword for a recursively evaluated attr-set, we can co-configure the nodes like this:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-nix" data-lang="nix"><span style="display:flex;"><span><span style="color:#66d9ef">rec</span> {
</span></span><span style="display:flex;"><span>  vps <span style="color:#f92672">=</span> {
</span></span><span style="display:flex;"><span>    services<span style="color:#f92672">.</span>nebula<span style="color:#f92672">.</span>networks<span style="color:#f92672">.</span>rhizome <span style="color:#f92672">=</span> {
</span></span><span style="display:flex;"><span>      enable <span style="color:#f92672">=</span> <span style="color:#66d9ef">true</span>;
</span></span><span style="display:flex;"><span>      isLighthouse <span style="color:#f92672">=</span> <span style="color:#66d9ef">true</span>;
</span></span><span style="display:flex;"><span>    };
</span></span><span style="display:flex;"><span>  };
</span></span><span style="display:flex;"><span>  laptop <span style="color:#f92672">=</span> {
</span></span><span style="display:flex;"><span>    services<span style="color:#f92672">.</span>nebula<span style="color:#f92672">.</span>networks<span style="color:#f92672">.</span>rhizome <span style="color:#f92672">=</span> {
</span></span><span style="display:flex;"><span>      enable <span style="color:#f92672">=</span> <span style="color:#66d9ef">true</span>;
</span></span><span style="display:flex;"><span>      lighthouses <span style="color:#f92672">=</span> [ vps ];  <span style="color:#75715e"># really the lighthouse&#39;s overlay IP</span>
</span></span><span style="display:flex;"><span>    };
</span></span><span style="display:flex;"><span>  };
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p>Now every node has a stable address on a flat private subnet, no matter where it physically is. The payoff is that the low-resource VPS never has to build anything. It delegates every Nix build to the laptop over the overlay:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-nix" data-lang="nix"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  vps <span style="color:#f92672">=</span> {
</span></span><span style="display:flex;"><span>    nix<span style="color:#f92672">.</span>settings<span style="color:#f92672">.</span>max-jobs <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>;  <span style="color:#75715e"># never build locally</span>
</span></span><span style="display:flex;"><span>    nix<span style="color:#f92672">.</span>buildMachines <span style="color:#f92672">=</span> [{ hostName <span style="color:#f92672">=</span> laptop; sshUser <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;nixremote&#34;</span>; }];
</span></span><span style="display:flex;"><span>  };
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p>The same overlay is how I SSH into the laptop from anywhere, with its <code>sshd</code> closed to everything but the Nebula interface. Other tricks follow, like an nginx reverse proxy on the VPS serving websites that actually run at home.</p>
<h2 id="automate-the-updates">Automate the Updates</h2>
<p>Here&rsquo;s where we start to close the loop, via 3 different update modes.</p>
<ol>
<li>Push: Updates to the VPS trigger a CI job wrapping the <code>deploy-rs</code> step.</li>
<li>Pull: Laptops get a systemd timer that checks the forge for main&rsquo;s tip, then builds and switches to that commit.</li>
<li>Self-Bump: Apps running in the fleet are flake inputs. A green merge triggers a version bump in the config repo.</li>
</ol>
<p>All the friction in <a href="/posts/decoupling-deployment-model">Decoupling My Deployment Model</a> just becomes automated CI steps.</p>
<h3 id="push">Push</h3>
<p>The push to the VPS is the <code>deploy-rs</code> command from the earlier posts, run by CI instead of me. It doesn&rsquo;t need to happen on every merge, though, so the workflow only fires when the push asks for it. A commit trailer turns out to be the cheapest &ldquo;deploy this&rdquo; flag there is:</p>
<pre tabindex="0"><code>git commit -m &#34;Tweak nginx&#34; -m &#34;Deploy: vps&#34;
</code></pre><p>The workflow reads it with <code>git interpret-trailers</code> and runs <code>nix run .#deploy-rs -- .#vps</code>. No second system, no deploy button, just a line in the commit message.</p>
<h3 id="pull">Pull</h3>
<p>Laptops don&rsquo;t accept inbound connections, so instead of being pushed to they poll. A systemd timer asks the forge for the tip of <code>main</code>, and if it isn&rsquo;t what&rsquo;s running, switches to exactly that commit:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-nix" data-lang="nix"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  laptop <span style="color:#f92672">=</span> {
</span></span><span style="display:flex;"><span>    systemd<span style="color:#f92672">.</span>timers<span style="color:#f92672">.</span>fleet-switch<span style="color:#f92672">.</span>timerConfig<span style="color:#f92672">.</span>OnCalendar <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;*:0/5&#34;</span>;
</span></span><span style="display:flex;"><span>    systemd<span style="color:#f92672">.</span>services<span style="color:#f92672">.</span>fleet-switch<span style="color:#f92672">.</span>script <span style="color:#f92672">=</span> <span style="color:#e6db74">&#39;&#39;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      rev=$(git ls-remote $FORGE/fleet.git main | cut -f1)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      [ &#34;$rev&#34; = &#34;$(nixos-version --configuration-revision)&#34; ] &amp;&amp; exit 0
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">      nixos-rebuild switch --flake &#34;git+$FORGE/fleet.git?rev=$rev#laptop&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    &#39;&#39;</span>;
</span></span><span style="display:flex;"><span>  };
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p>The comparison works because the flake stamps every build with the commit it came from (<code>system.configurationRevision = self.rev</code>). Pinning the exact revision it observed means a laptop that was asleep for a week catches up to the same commit as everyone else, not to whatever <code>main</code> happens to be mid-build.</p>
<h3 id="self-bump">Self-Bump</h3>
<p>Apps that run on the fleet are flake inputs. Each one&rsquo;s own CI, after a green merge, runs a single step:</p>
<pre tabindex="0"><code>nix run $FORGE/fleet.git#bump -- myapp=$sha
</code></pre><p>That re-pins the input, runs <code>nix flake check</code> with the new lock (a bump the fleet can&rsquo;t build never lands), and pushes to <code>main</code>. A small map in the fleet repo says which hosts a moved pin should deploy:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-nix" data-lang="nix"><span style="display:flex;"><span>rolling <span style="color:#f92672">=</span> {
</span></span><span style="display:flex;"><span>  myapp <span style="color:#f92672">=</span> [ <span style="color:#e6db74">&#34;laptop&#34;</span> ];
</span></span><span style="display:flex;"><span>  website <span style="color:#f92672">=</span> [ <span style="color:#e6db74">&#34;vps&#34;</span> ];
</span></span><span style="display:flex;"><span>};
</span></span></code></pre></div><p>That one line and the step above are all the app and the fleet know about each other. The &ldquo;tab back to the server repo, <code>nix flake update</code>, <code>deploy</code>&rdquo; loop is gone.</p>
<h3 id="tool-bumps">Tool Bumps</h3>
<p>The same trick works pointed at upstream instead of my own repos. Claude Code and Codex are pinned independently of <code>nixpkgs</code>, because the model gate is server-side: a CLI older than a new model locks every agent on the fleet out of it the day it ships. So a daily workflow compares the pins with what Anthropic and npm publish, rewrites them, checks, and pushes with a <code>Deploy: vps</code> trailer:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">on</span>:
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">schedule</span>:
</span></span><span style="display:flex;"><span>    - <span style="color:#f92672">cron</span>: <span style="color:#e6db74">&#34;17 6 * * *&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">jobs</span>:
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">bump</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">runs-on</span>: <span style="color:#ae81ff">native</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">steps</span>:
</span></span><span style="display:flex;"><span>      - <span style="color:#f92672">run</span>: <span style="color:#ae81ff">nix run .#bump-tools</span>
</span></span></code></pre></div><p>These show up in <code>main</code>&rsquo;s history:</p>
<pre tabindex="0"><code>6f84965 bump tools: claude-code 2.1.287 -&gt; 2.1.288
5ddc48f bump tools: claude-code 2.1.286 -&gt; 2.1.287, codex 0.159.3 -&gt; 0.160.0
</code></pre><h2 id="yolo-mode-fleet-wide-features">YOLO Mode: Fleet-Wide Features</h2>
<p>With these pieces in place, one PR in one repo can orchestrate cross-cutting features. Every host lives in the same repo, CI builds all of them on every PR, and the merge deploys itself. That makes it a great place to let an agent loose, since a fleet-wide change is a single reviewable diff with a build gate in front of it.</p>
<p>As an example, I asked for an observability system using <a href="https://ntfy.sh">ntfy</a>. The topic name is the whole credential, so it lives in a secret, and the app on my phone subscribes to it.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-nix" data-lang="nix"><span style="display:flex;"><span>{
</span></span><span style="display:flex;"><span>  vps<span style="color:#f92672">.</span>fleet<span style="color:#f92672">.</span>notify<span style="color:#f92672">.</span>watch<span style="color:#f92672">.</span>laptop <span style="color:#f92672">=</span> { host <span style="color:#f92672">=</span> laptop; port <span style="color:#f92672">=</span> <span style="color:#ae81ff">22</span>; };
</span></span><span style="display:flex;"><span>  laptop<span style="color:#f92672">.</span>fleet<span style="color:#f92672">.</span>notify<span style="color:#f92672">.</span>watch<span style="color:#f92672">.</span>vps <span style="color:#f92672">=</span> { host <span style="color:#f92672">=</span> vps; port <span style="color:#f92672">=</span> <span style="color:#ae81ff">22</span>; };
</span></span><span style="display:flex;"><span>}
</span></span></code></pre></div><p>The hosts probe each other, and report each transition, from reachable to silent and back again. Any service unit can also wire in:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-nix" data-lang="nix"><span style="display:flex;"><span>systemd<span style="color:#f92672">.</span>services<span style="color:#f92672">.</span>backup<span style="color:#f92672">.</span>onFailure <span style="color:#f92672">=</span> [ <span style="color:#e6db74">&#34;notify-failed@%n.service&#34;</span> ];
</span></span></code></pre></div><p>This way, if there&rsquo;s a rupture in the flows, I&rsquo;ll know about it quickly.</p>
<h2 id="the-knots">The Knots</h2>
<p>A rhizome can still tie itself in a loop, and that&rsquo;s where some actual problem-solving went.</p>
<p>A cross-cutting change triggers a re-deploy of the VPS and the laptop. That means the CI runner deploys itself. A switch that restarts the runner kills every job inside it, including the <code>deploy-rs</code> activation of the VPS. Two rules untangle it. The laptop&rsquo;s pull updater drains the runner before it switches, so no new jobs start mid-deploy. And the updater and CI&rsquo;s VPS deploy share a single <code>flock</code>, so replacing the runner has to wait for any in-flight deploy to finish, and vice versa.</p>
<p>Secrets are the other knot, since they&rsquo;re the one thing that can&rsquo;t be declarative. <a href="https://github.com/Mic92/sops-nix">sops-nix</a> gets most of the way: each file is encrypted for my admin key plus the hosts that consume it, so &ldquo;move a service to another host&rdquo; is add a recipient, re-key, commit.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">creation_rules</span>:
</span></span><span style="display:flex;"><span>  - <span style="color:#f92672">path_regex</span>: <span style="color:#ae81ff">secrets/myapp\.yaml$</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">key_groups</span>: [{ <span style="color:#f92672">age</span>: [ <span style="color:#75715e">*admin,</span> <span style="color:#75715e">*laptop</span> ] }]
</span></span></code></pre></div><p>But the Nebula certificates are still signed by hand from a CA directory and copied out of band. Maybe the rhizome has a root after all. Oops!</p>
<h2 id="summary">Summary</h2>
<p>In my <em>rhizomatic</em> system,</p>
<ul>
<li>the config is a member of the fleet it describes</li>
<li>every node can reach every other</li>
<li><code>main</code> is converged on from three directions</li>
<li>every edge reports its own failures</li>
</ul>
<p>Heterogeneous things connected with no pivot, rupturable anywhere, and a map rather than a tracing. Together they mean I&rsquo;m basically out of the loop, and the commit log on <code>main</code> reads like the fleet maintaining itself.</p>
<p><em>As usual, <a href="https://happysleepy.com/wp-content/uploads/A-Thousand-Plateaus-Drawings-10000BC-49b.jpg">Deleuze and Guattari (illustrated by Marc Ngui and Magda Wojtyra)</a> should help clarify matters.</em></p>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
