So long SourceHut and Netlify

Intro

For the past six years I've been a happy user of both SourceHut (my code forge) and Netlify (my blog host). A few days ago SourceHut changed their terms of service to no longer accept the "use of LLMs or other generative AI tools to produce or assist with the production of source code, assets, tickets, emails, and so on".

First off, I want to commend SourceHut for taking a stance that aligns with their values. I initially switched to SourceHut because it aligned with some of my values. I like the simplicity of their site, and paying for a service instead of trading my data for something "free". It takes commitment to put one's foot down and turn away potential customers. I'm happy they took their stance and I wish them all the best. While (I hope) I'm not drunk on the LLM craze, I do use LLMs to author some of my code and to help me solve problems. So, SourceHut's change set me looking for an alternative.

I received the email about SourceHut's TOS change while I was in the airport flying home from a work trip. I was in Las Vegas, and maybe it was all of the annoying screens and bright lights of the slot machines that pushed me to want to self-host on a dusty old server. Whatever it was, on my way home from the airport I swung by Colorado State University's Surplus Property store to see what they had in stock. It is like stepping back in time in there. Lots of old doohickeys with one foot in the grave. If I ever need a VGA cable again, I know where to go. I opted for an HP Z240 SFF. Onboard, this beast has an Intel i7-6700, 8GB of DDR4 (at current prices that was probably the entire cost of the machine), and a lovely 250GB spinning hard drive. $70 and it was mine. I got a nice nostalgic feeling booting it up, like firing up my childhood home computer. A great tactile power button, a nice whir to the fans, and the screech of the HDD. I've been using Mac laptops for too long...

To make matters better (worse?), I also decided it was time to switch to a proper config management tool. Something to provision machines so that when this box eventually died I'd be able to easily switch over to something new. Ansible, Salt, and the like have never really grabbed me, but I've read over the years about NixOS and it seemed like an interesting approach. So, with a weekend ahead of me, some fresh metal, and the helpful/infuriating/clever/moronic hand of Claude, I set off.

Porting router to NixOS

My first port of call was converting my BABS (big ass bash scripts) that configured my router (a Beelink EQ14) to NixOS. The scripts were about as close to a 1:1 conversion as I could hope for. For example:

This Bash

install -Z -m 600 /dev/stdin /etc/dnsmasq.d/router.conf <<'EOF'
<snip>
# Don’t read /etc/resolv.conf because we configure our
# own name servers.
no-resolv
server=1.1.1.1
server=9.9.9.9
<snip>
EOF

became this NixOS equivalent

{
  services.dnsmasq = {
<snip>

      # Don't read /etc/resolv.conf because we configure our
      # own name servers.
      no-resolv = true;
      server = [
        "1.1.1.1"
        "9.9.9.9"
      ];
<snip>
  };
};

This went fairly smoothly. Regardless of whether it was Bash or NixOS, I still grind my teeth doing this work. Networking code in particular can "work" but be totally wrong and/or insecure. Likewise, when it doesn't work there isn't a stack trace pointing me to the issue. Just the inability to reach the server. I want to make my configuration repo public, but I'm afraid there will be some glaring bugs in it. Putting aside my epistemic anxiety, I came away really liking NixOS. The internet tells me folks balk at the syntax, which I found fairly pleasant to read and which LLMs were good at generating (after deleting an absolute mountain of comments to get at the actual code underneath...).

Porting blog and code forge

On to my new server. I first needed to figure out which code forge to use. Prior to SourceHut, I used both GitHub and GitLab. I would describe both of them as "meh", or "what I use at work". Recently GitHub has been circling the drain looking for BitBucket down in the p-trap. I chose Forgejo as my new code forge. I thought for a moment about self-hosting SourceHut, but in their TOS change blog post they themselves said Forgejo is "easier to deploy". Maybe a dig at LLM sloppers?;) Only so many oceans I can boil in a weekend...

My blog was very easy to port over. I have had no problems with Netlify, but I also don't really get much from them. Might as well ditch them along the way. My blog is just a static site generated by Pelican. So, it was a matter of pointing nginx at the files it outputs. Again, NixOS made this simple. Friendly settings like "enableACME" are easier than managing the systemd services myself, and their language reads a lot like the nginx conf files I'm used to. For example:

virtualHosts = lib.mkMerge [
    {
    "evan.carlin.com" = {
        enableACME = true;
        forceSSL = true;
        root = "/var/www/blog";
    };
    }
    <snip>
    ];

So long

A Saturday evening, all day Sunday, and I was back up and running. I have another hand-rolled box (Beelink SER8) still to switch to NixOS. This one runs Home Assistant and UniFi OS Server in VMs, so I think it will take a bit more noodling to get them moved over. We'll see how this journey goes. I also switched my yearly payment to SourceHut into a donation split between Forgejo and NixOS. I told my wife recently that I wanted to simplify my life. Too many things vying for my time. I don't think this is what she or I had in mind.

Happy Hacking.