<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="/pretty-feed-v3.xsl" type="text/xsl"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>hayden@web</title><description>Hayden&apos;s blog post feed</description><link>https://hayden.moe/</link><item><title>Developer Tooling</title><link>https://hayden.moe/posts/2025-10-03-developer-tooling/</link><guid isPermaLink="true">https://hayden.moe/posts/2025-10-03-developer-tooling/</guid><description>What I do for toolchains, config, and cross-puter config.</description><pubDate>Fri, 03 Oct 2025 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;This post covers what I do for toolchain management, and keeping config the
same across multiple computers. It was originally given as a talk at
&lt;a href=&quot;https://acquired.com&quot;&gt;Acquired.com&lt;/a&gt; where I work, but now I&apos;m sharing it with
the world because... blog posts.&lt;/p&gt;
&lt;h1&gt;Dotfiles&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;What are they?&lt;/strong&gt; Dotfiles are named after (on *NIX systems at least) all the
config files that live in &lt;code&gt;.&lt;/code&gt; folders (&lt;code&gt;.config&lt;/code&gt;, &lt;code&gt;.local&lt;/code&gt;, etc.). They&apos;re where
all your config probably lives. The Windows equivalent of this is somewhere like
&lt;code&gt;AppData&lt;/code&gt; and all the child directories (&lt;code&gt;Local&lt;/code&gt;, &lt;code&gt;Roaming&lt;/code&gt;, etc.).&lt;/p&gt;
&lt;p&gt;A lot of your tool configurations live in there, and in most cases, you&apos;ve
probably got a handful of tools that you&apos;ve configured to work in a way &lt;em&gt;you&lt;/em&gt;
like that might not necessarily be the default. Those configurations are
annoying to then replicate on other machines manually, especially when you
inevitably forget that one really useful config flag or alias you had that
you&apos;ve got the muscle memory for.&lt;/p&gt;
&lt;p&gt;That&apos;s why I choose to use a tool to help me manage configuration. I like having
my development setup work &apos;just so&apos;, and I like having muscle memory for doing
things. There&apos;s a lot of creature comforts I have in my workflow, like my Neovim
config and how specifically it works, or my shell aliases that let me quickly
run things like &lt;code&gt;dclf&lt;/code&gt; instead of &lt;code&gt;docker compose logs -f&lt;/code&gt;. I also have some
scripts I want on multiple machines, like &lt;code&gt;license&lt;/code&gt;, which pulls down an open
source license and drops it into a &lt;code&gt;LICENSE&lt;/code&gt; file, or &lt;code&gt;gitignore&lt;/code&gt;, which grabs
a well-known &lt;code&gt;.gitignore&lt;/code&gt; file from the web so I don&apos;t have to write them by
hand every time I start a new project.&lt;/p&gt;
&lt;h1&gt;Why not scripts? Why a tool?&lt;/h1&gt;
&lt;p&gt;Scripts suck to manage, and have no way to keep track of state. That&apos;s about it
really, they&apos;re just cumbersome and they have the potential to break constantly.&lt;/p&gt;
&lt;h1&gt;Git &apos;bare repos&apos;&lt;/h1&gt;
&lt;p&gt;I tried bare repos at one point, but quickly ended up looking for something
else. They&apos;re annoying to manage because &lt;code&gt;git status&lt;/code&gt; no longer functions, and
there&apos;s no hydrated copy of the repo anywhere for you to check things in.&lt;/p&gt;
&lt;p&gt;There&apos;s also no way to automate things like tool installations between computers
so you have to remember which tools you install and where you get them from.&lt;/p&gt;
&lt;h1&gt;Nix&lt;/h1&gt;
&lt;p&gt;&lt;a href=&quot;https://nixos.org&quot;&gt;Nix&lt;/a&gt; is &lt;strong&gt;very&lt;/strong&gt; cool conceptually. It lets you build out a
configuration &lt;em&gt;declaratively&lt;/em&gt;, effectively turning your whole setup into one big
config file. It works pretty well until you get into some of the higher-level
concerns than &quot;do I have x tool installed?&quot;&lt;/p&gt;
&lt;p&gt;Nix infects a lot of environment variables, and requires system-wide access to
work properly, which breaks compilers and such (changing the &lt;code&gt;LD_PATH&lt;/code&gt; and
&lt;code&gt;PKG_CONFIG_PATH&lt;/code&gt; env vars for instance breaks a lot of programs like Steam or
&lt;code&gt;gcc&lt;/code&gt;, which prevents things like &lt;code&gt;rustc&lt;/code&gt; from being able to compile sometimes.)&lt;/p&gt;
&lt;p&gt;Nix is also hard to cleanly &lt;em&gt;remove&lt;/em&gt; after you&apos;re done with it without losing
all of your config. Tools like &lt;code&gt;home-manager&lt;/code&gt; use symlinks to files in Nix&apos;s own
file store (&lt;code&gt;/nix/store&lt;/code&gt;), which means that uninstalling Nix also wipes all of
those files and breaks your symlinks. You can&apos;t tell it to dump those files into
your filesystem, so there&apos;s no &apos;clean path&apos; to replace &lt;code&gt;home-manager&lt;/code&gt; or
similar.&lt;/p&gt;
&lt;p&gt;Nix&apos;s package management setup is &lt;em&gt;atomic&lt;/em&gt;, meaning unless you&apos;re willing to
jump through several hoops and learn DSL-specific things like nixpkgs overlays
and pinned dependencies, updating your toolchain can be a pretty destructive
operation.&lt;/p&gt;
&lt;p&gt;Here&apos;s an example of a tiny config that uses &lt;code&gt;home-manager&lt;/code&gt; to manage your
user-specific packages and configuration:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{ pkgs, ... }:
{
    # install my packages
	home.packages = with pkgs; [
		git
		nodejs
		lazygit
		neovim
		terraform
	];
	
	programs.zsh = {
		enable = true;
		enableCompletions = true;
		shellAliases = {
			ll = &quot;ls -l&quot;;
			update = &quot;sudo nixos-rebuild switch&quot;;
		};
	};
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this setup, let&apos;s say there&apos;s a new Neovim version that&apos;s been released. I
want to update my setup, so I do &lt;code&gt;nix flake update&lt;/code&gt; in my config folder, and
Neovim is now running on version &lt;code&gt;0.10&lt;/code&gt; instead of &lt;code&gt;0.9&lt;/code&gt;. Cool. Let me go test
it on my new repo. Oh... Now &lt;code&gt;lazygit&lt;/code&gt; doesn&apos;t open because there&apos;s a bug in it.
But because I&apos;m using Nix, it&apos;s gonna take me an hour to find all the working
configs and write an overlay to roll back the tool version. No bueno, señor.&lt;/p&gt;
&lt;h1&gt;Chezmoi&lt;/h1&gt;
&lt;p&gt;&lt;a href=&quot;https://chezmoi.io&quot;&gt;Chezmoi&lt;/a&gt; is what drives my current setup, and it&apos;s really
easy to use. It works by having a Git repo cloned to &lt;code&gt;~/.local/share/chezmoi&lt;/code&gt;
with features like templating, some filename-based directives to control how
your files are put in your config, and being able to run scripts on different
rules depending on what you want to do.&lt;/p&gt;
&lt;p&gt;It also has the ability to use secrets management tools and password managers
(including your own custom ones if you want), with support for the following at
the time of writing:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;1Password&lt;/li&gt;
&lt;li&gt;BitWarden&lt;/li&gt;
&lt;li&gt;Doppler&lt;/li&gt;
&lt;li&gt;KeePassXC&lt;/li&gt;
&lt;li&gt;gopass&lt;/li&gt;
&lt;li&gt;Encryption tools like &lt;code&gt;age&lt;/code&gt;, &lt;code&gt;gpg&lt;/code&gt; and &lt;code&gt;rage&lt;/code&gt; (&lt;code&gt;age&lt;/code&gt;&apos;s Rust-rewritten cousin)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Using those secrets tools also means you can have your config automatically
authenticate you against other systems and protect more sensitive information
(like your email address or SSH keys) in a password manager instead of having
them in plaintext in a GitHub repo somewhere.&lt;/p&gt;
&lt;p&gt;Because Chezmoi just uses Git, it&apos;s really easy to take it from one system and
just drop it onto another system. They even have a command to make it easier (if
you&apos;re happy with running Bash one-liners):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sh -c &quot;$(curl -fsLS get.chezmoi.io)&quot; -- init --apply hbjydev
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will clone &lt;code&gt;hbjydev/dotfiles&lt;/code&gt; from GitHub and apply it locally, running all
the scripts I configured and all.&lt;/p&gt;
&lt;p&gt;If you want to look through my dotfiles repo, head over to &lt;a href=&quot;https://github.com/hbjydev/dotfiles&quot;&gt;&lt;code&gt;hbjydev/dotfiles&lt;/code&gt;&lt;/a&gt;
and take a look around. Some of the various things you&apos;ll see in there are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Scripts with the &lt;code&gt;run_onchange&lt;/code&gt; directives, etc.&lt;/li&gt;
&lt;li&gt;Symlinks&lt;/li&gt;
&lt;li&gt;File permissions directives&lt;/li&gt;
&lt;li&gt;Using 1Password to inject secrets like tokens &amp;amp; emails&lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;h1&gt;Toolchains&lt;/h1&gt;
&lt;p&gt;Now, my setup extends beyond app configuration. Let&apos;s talk about dev toolchains.
I&apos;m not talking about things like my editor here, I&apos;m talking compilers, SDKs,
runtimes, etc.&lt;/p&gt;
&lt;p&gt;These things are a little less easy than &lt;code&gt;apt-get install &amp;lt;tool&amp;gt;&lt;/code&gt; typically.
Different projects want to run on different versions of the
language/compiler/SDK, so they need a little bit of special attention.&lt;/p&gt;
&lt;p&gt;Previously, Nix kind of solved for this by using Flakes, which are config-local
setups that provide tools and configuration. However, given what I said about
atomic updates, that setup also kind of falls apart pretty quickly. Also, Flakes
in Git repos need to be checked in and committed to work properly, which means
that unless we want configuration for one developer in the repo that nobody else
will use, they&apos;re kinda broken.&lt;/p&gt;
&lt;p&gt;Instead, I found a tool called &lt;a href=&quot;https://mise.jdx.dev&quot;&gt;mise&lt;/a&gt;. Mise is really
cool, because it gives me the project-scoped config that Nix Flakes used to do,
but it works by just keeping a local store of SDK installations that it switches
around in PATH when you go into different directories on your system.&lt;/p&gt;
&lt;p&gt;Here&apos;s a Mise configuration file.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[tools]
dotnet = &quot;9.0&quot;
just = &quot;1.41.0&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This you&apos;d store in a file in your repo called &lt;code&gt;mise.toml&lt;/code&gt;, and when you go into
that folder, Mise will automatically inject environment variables into your
shell that loads the specific versions of &lt;code&gt;dotnet&lt;/code&gt; and &lt;code&gt;just&lt;/code&gt; defined in that
config file.&lt;/p&gt;
&lt;p&gt;It also handles &lt;em&gt;installing&lt;/em&gt; those tools for you, and if you don&apos;t have the
specific versions listed in the file, you just run &lt;code&gt;mise install&lt;/code&gt; and it handles
it all for you.&lt;/p&gt;
&lt;p&gt;Now, this is cool on its own, because now you can have config in a project that
means all of your developers in a repo are running the same exact version, which
helps cut down on those &quot;works on my machine&quot; non-reproducible errors, and also
means nobody&apos;s working with language features that don&apos;t exist in the older
version that everyone else is on.&lt;/p&gt;
&lt;p&gt;However, Mise is so simple that it also works in CI environments, too, by way of
the &lt;code&gt;jdx/mise-action&lt;/code&gt; GitHub Action (and even if that didn&apos;t exist, it&apos;s
stupidly simple to install in a CI setup). Here&apos;s an example GitHub action taken
from the &lt;a href=&quot;https://github.com/acquiredcom/acqctl.git&quot;&gt;&lt;code&gt;acqctl&lt;/code&gt; repo&lt;/a&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;jobs:
  test:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      actions: read
      checks: write
    steps:
      - uses: actions/checkout@v4
      - uses: jdx/mise-action@v2

      - run: just test

      - uses: dorny/test-reporter@v2
        if: ${{ !cancelled() }}
        with:
          name: Acqctl Tests
          path: ./TestResults/acqctl_*.trx
          reporter: dotnet-trx
          fail-on-error: false
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can see that we&apos;re using &lt;code&gt;jdx/mise-action&lt;/code&gt;, which will install all the tools
in our &lt;code&gt;mise.toml&lt;/code&gt; file into the CI environment, which in this case installs
&lt;code&gt;dotnet&lt;/code&gt; 9 and &lt;code&gt;just&lt;/code&gt;, which is my preferred project script tool (like a
Makefile but more modern). This ensures that the version of .NET and &lt;code&gt;just&lt;/code&gt; I&apos;m
running on my machine are the same ones being used in the build &amp;amp; test steps in
CI, which, barring architecture-specific differences, means any issues CI flags
up should be entirely reproducible on my local machine.&lt;/p&gt;
&lt;p&gt;All of this together leads to a much happier developer environment where
everyone&apos;s running the same things, and makes debugging issues a fair bit easier
between developers and between you and automation.&lt;/p&gt;
&lt;h1&gt;Getting Started&lt;/h1&gt;
&lt;p&gt;So now I&apos;ve given you a run-down of how it all fits together, why not give it a
try on your own machines? Get the two tools installed (they&apos;re both in Homebrew
for Mac and Linux users, and they&apos;re available in &lt;code&gt;winget&lt;/code&gt; for Windows users).&lt;/p&gt;
&lt;h2&gt;Mise (Toolchain)&lt;/h2&gt;
&lt;p&gt;Let&apos;s start with Mise because it&apos;s the simpler of the two tools. First, you want
to get Mise to inject itself into your shell.
(&lt;a href=&quot;https://mise.jdx.dev/installing-mise.html#shells&quot;&gt;Documentation here&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Zsh:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;echo &apos;eval &quot;$(mise activate zsh)&quot;&apos; &amp;gt;&amp;gt; ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Bash:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;echo &apos;eval &quot;$(mise activate bash)&quot;&apos; &amp;gt;&amp;gt; ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Fish (weirdo):&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;echo &apos;mise activate fish | source&apos; &amp;gt;&amp;gt; ~/.config/fish/config.fish
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;PowerShell:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;echo &apos;mise activate pwsh | Out-String | Invoke-Expression&apos; &amp;gt;&amp;gt; $HOME\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now we&apos;ve done that, give your shell a restart, and go into one of your project
repos. Let&apos;s say we&apos;ve gone into a repository with a .NET 8 project. To add a
tool to your config (and create a config if it doesn&apos;t already exist), you can
run;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mise use dotnet@8
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This should run for a little bit, install the tool you told it to install into
the installations directory it keeps, and then leave you with a new &lt;code&gt;mise.toml&lt;/code&gt;
that looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[tools]
dotnet = &quot;8&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you do &lt;code&gt;which dotnet&lt;/code&gt; on a UNIX system, you&apos;ll now see something similar to
this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ which dotnet
/Users/hyoung/.local/share/mise/installs/dotnet/8.0.413//dotnet
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Congrats, you&apos;re now using Mise to manage your project-specific toolchain!&lt;/p&gt;
&lt;h2&gt;Chezmoi (Dotfiles)&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;chezmoi init
chezmoi add ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now if you go to &lt;code&gt;~/.local/share/chezmoi&lt;/code&gt;, you&apos;ll see there&apos;s now a file called
&lt;code&gt;dot_zshrc&lt;/code&gt;, and you&apos;ll also see that you&apos;re in a Git repo. Let&apos;s commit the new
ZSH config file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;git add dot_zshrc
git commit -m &quot;feat: add my zsh config&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let&apos;s then get a GitHub repo going (I recommend making it private until you
learn how to do secrets properly in Git):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;gh repo create dotfiles --private --source .
git push -u origin main
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, you have dotfiles managed by Git that you can set up on another machine.
You can test this in a VM. Make one, then run the &lt;code&gt;init --apply&lt;/code&gt; command I gave
above. In my case;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sh -c &quot;$(curl -fsLS get.chezmoi.io)&quot; -- init --apply hbjydev
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will pull down &lt;code&gt;hbjydev/dotfiles&lt;/code&gt; to &lt;code&gt;~/.local/share/chezmoi&lt;/code&gt; and because
we gave it the &lt;code&gt;--apply&lt;/code&gt; flag, it will automatically apply my config locally. In
that VM, you should now have the same &lt;code&gt;~/.zshrc&lt;/code&gt; file you had on your original
machine.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Well done, now you know a little more about dotfiles. Go forth and configure!
Let me know how you get on by @&apos;ing me
&lt;a href=&quot;https://bsky.app/profile/hayden.moe&quot;&gt;on Bluesky&lt;/a&gt; maybe.&lt;/p&gt;
</content:encoded><author>Hayden</author></item><item><title>Platform Engineering - Your Little Cloud in the Big Cloud</title><link>https://hayden.moe/posts/2025-07-20-platform-engineering/</link><guid isPermaLink="true">https://hayden.moe/posts/2025-07-20-platform-engineering/</guid><description>What is Platform Engineering and why is it useful?</description><pubDate>Sun, 20 Jul 2025 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I recently accepted a job offer to work on a Platform team. This is huge news
for me because Platform Engineering is what I&apos;ve always wanted to do in tech,
since the point where I cared enough about infrastructure to have an interest
in DevEx. It&apos;s where I always wanted to end up in my career, so I&apos;m very excited
to be starting that role.&lt;/p&gt;
&lt;p&gt;However, what I&apos;ve also noticed is that while Platform Engineers know what it
is they do, it&apos;s a relatively recent job description in the grand scheme of
things; the vast majority of people I&apos;ve spoken to in the Meatspace(tm)(c)(R)
have no idea what Platform actually does. So this post is me conveying my
personal interpretation of what Platform Engineering is, and why a Platform
team is a really useful tool for any organization with an engineering division.&lt;/p&gt;
&lt;h1&gt;The Problem&lt;/h1&gt;
&lt;p&gt;Why does Platform need to exist in the first place? What problem does a Platform
team aim to solve? In broad terms, because infrastructure management is hard.
I&apos;ve worked with a few companies and &apos;extra-curricular&apos; volunteering projects
now, and one thing they all have in common; not really wanting to put much
effort into infrastructure. Companies want to spend more time building their
products/projects than they do building the several-layer AWS/GCP/Azure
nightmare that it needs to run smoothly. A lot of companies are happy with
&quot;well we can deploy to it, we can fix the weird things later&quot;. Companies with
DevOps teams probably know better, but they&apos;d still rather have engineering
efforts going into the product.&lt;/p&gt;
&lt;p&gt;This is where a Platform Engineer would step in.&lt;/p&gt;
&lt;h1&gt;So what do they do?&lt;/h1&gt;
&lt;p&gt;Platform Engineering, at its core, is all about automation of infrastructure.
The main aim, in my opinion, of a Platform team, is to provide other engineering
teams with a series of &apos;quick wins&apos; with relation to infrastructure management
across the whole software lifecycle. As the (admittedly buzzword-centric)
website platformengineering.org puts it, &quot;Platform engineering is the discipline
of designing and building toolchains and workflows that enable self-service
capabilities for software engineering organizations in the cloud-native era&quot;.&lt;/p&gt;
&lt;p&gt;Your Platform team&apos;s goal in life should be to implement what some have taken to
calling an Internal Development Platform (IDP, not to be confused with IdP, or
&quot;Identity Provider&quot;, tech sucks at acronyms). An IDP in concept is like a mini
cloud inside a bigger cloud. It enables development teams to own their
infrastructure, while not needing them to become experts in &amp;lt;insert your cloud
provider here&amp;gt;.&lt;/p&gt;
&lt;p&gt;The Platform team will prescribe a &apos;golden path&apos; for managing things like
databases, Kubernetes clusters, ECS tasks, SQS queues, BigQuery tables, etc.,
and implement that golden path in some form of domain-specific language (DSL)
that the development teams can interact with. The system that uses this DSL
(whether that takes the form of a web app, a Git repo with YAML, or convoluted
Terraform modules) will then know how to translate the simplified &quot;what do we
need?&quot; specification the devs have put forward into actual deployed
infrastructure.&lt;/p&gt;
&lt;h1&gt;You talk too much, give me a scenario, man!&lt;/h1&gt;
&lt;p&gt;Okay okay, fine. The example I often give in interviews or when talking to
people offline about the benefit of Platform is this; your developers need a
database for the app they&apos;re deploying. They know they need MySQL, they know
their drivers will work fine on MySQL 8, and they know it needs to be accessible
by their app. What they have no care for is how the backups are provisioned, how
the VPC allows connections, how the security groups are set up, etc. They just
want a database and some credentials to feed their app on the next release.&lt;/p&gt;
&lt;p&gt;With an IDP in place, this could be distilled down to a simple YAML file
describing what they want.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;---
version: v1
kind: Database
metadata:
    name: myapp-db
spec:
    engine:
        type: mysql
        version: &apos;8.0.40&apos;
    storageGbs: 10
    readReplica: true
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With this YAML snippet here, the developers have prescribed to us that they
want:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A MySQL database, running version 8.0.40&lt;/li&gt;
&lt;li&gt;10GBs of storage on that database&lt;/li&gt;
&lt;li&gt;A provisioned read replica for the database (maybe they want some sort of
analytics system to talk to it. We don&apos;t care, it&apos;s their database)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So now, our IDP can go away and deploy the system they want. They haven&apos;t had to
learn AWS, they just needed to know in broad strokes what they wanted and tell
us about it, then the IDP went and... did it for them. Just like that.&lt;/p&gt;
&lt;p&gt;Now maybe there are some side effects of this, like having a new database
credentials secret provisioned that the system tells them about, but largely
you get the picture.&lt;/p&gt;
&lt;p&gt;The whole point is distilling down infrastructure into an interface that doesn&apos;t
need developers to be former SREs to manage. It enables self-service
infrastructure management, allowing dev teams to own their infrastructure, and
crucially, allows your organization to move to a more shift-left process
compared to the age-old helpdesk ticket system that someone needs to stare at
constantly for new requests. Which has the added bonus of freeing up your
support and former infrastructure staff to deal with the constant influx of
&quot;whoops this broke&quot; and continuous improvement tasks they&apos;ve been wanting to
nuke off the backlog for the past 18 months.&lt;/p&gt;
&lt;h1&gt;Okay cool, which company&apos;s product should I buy?&lt;/h1&gt;
&lt;p&gt;Well, the short answer to this is... you shouldn&apos;t. Every company has their own
needs, and every &apos;developer experience&apos; platform exists to make money from you.
This includes open-source but off-the-shelf software stacks like Spotify&apos;s
Backstage.&lt;/p&gt;
&lt;p&gt;Your company has its own processes, its own definitions of an &quot;application&quot;, its
own standards to comply with, its own software stacks, etc. You should be
developing your IDP for your company&apos;s needs, not making it fit what Soundcloud
did in the mid-2010s and wrote a whitepaper on. I&apos;m a big believer in &quot;the tools
should fit you, not you fit the tools&quot;. If you&apos;re changing the entire concept of
infrastructure internally by using the tool you picked up, you&apos;ve done it wrong.&lt;/p&gt;
&lt;p&gt;Because of this, my recommendation is to build something in-house. It can start
out small, just a series of infrastructure-as-code files in Terraform in a Git
repo somewhere, then maybe it gets some YAML abstraction to configure it easier.
Maybe a few months down the line, your dev teams complain the YAML is terse, so
you want to put a user interface around it. So you build a web app that edits
that YAML for them, and maybe while you&apos;re doing that, you bake in backup
monitoring and deployment status into that platform, too.&lt;/p&gt;
&lt;p&gt;Let yourself start small. Grow as your teams need. Many a culture-change
initiative have shot themselves in the foot by building too much too early on,
or by being too different from the existing processes from the get-go. Make
waves, advocate for change, but be aware that while you can see the vision, the
burden of proof is on you as well to show the business that it&apos;s a good use of
time, and that it&apos;s not going to be harder than just shooting IT an email.&lt;/p&gt;
&lt;p&gt;With that said, I hope this post has been helpful to you, and that it opens you
up to a potential Platform-driven future. I tried to convey the reasons I&apos;d
implement this best I could, but I&apos;m sure there are better posts out there to
cover the subject should you be so inclined. Thanks for reading.&lt;/p&gt;
</content:encoded><author>Hayden</author></item><item><title>Work Smarter, Not Harder; Template your project configs!</title><link>https://hayden.moe/posts/2025-04-07-work-smarter-not-harder/</link><guid isPermaLink="true">https://hayden.moe/posts/2025-04-07-work-smarter-not-harder/</guid><description>Get rid of consistent inconsistency using configuration templating.</description><pubDate>Mon, 07 Apr 2025 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;So the title here is a touch clickbaity. If you mainly work on open source, or
if you don&apos;t work for a company with enough consistency that your config files
look largely similar project-to-project, this blog post is not for you. However,
if you work somewhere where you feel setting up new projects &amp;amp; updating existing
ones ends up being a copy-paste exercise of &quot;what setting did Project A use?&quot;
and &quot;what was that thing I did that fixed this in Project C?&quot;... Maybe give this
a read.&lt;/p&gt;
&lt;h1&gt;Context&lt;/h1&gt;
&lt;p&gt;A little background; in and out of my day job, I do DevOps work. Whether it&apos;s
for my job, personal projects, or working with friends outside of a job context.
We recently were going through the process of upgrading our projects to a new OS
release. One by one, we kept having to copy configs from the first project we
did to the next one, etc. This took an age to build and test. We were holding
up releases by weeks in some cases. Then we built a templating tool that knows
how we build our software, and more importantly, how we deploy that software,
and can generate all of these configuration files for us. This kept our configs
standardised, which lowered our mental overhead when hopping from project to
project, and has also helped us with applying improvements and optimisations to
multiple projects in short passes since then, too. This has massively helped
with how quickly we can roll out changes and how reliable those changes are, and
the point of this post is to convince you, assumedly a DevOps engineer tired of
copypasta configs, that there is a better way.&lt;/p&gt;
&lt;p&gt;Now, in an environment where you&apos;re deploying things to a platform like EC2,
ECS, Kubernetes, GCE, whichever, and you have multiple projects side-by-side,
you probably have a pretty high level of overlap when it comes to configuration.
This might come in the form of web server configuration (for tools like Gunicorn
or Nginx), it might come in the form of standardised CI/CD pipeline configs (for
GitHub Actions, GitLab CI, whichever), or it might just be your monitoring
configurations. If you look at the files themselves, and you look at how they
look in one project versus two or three others, my bet is that you&apos;ll probably
spot that they&apos;re largely the same. They might be formatted differently, have
different arguments or values passed, but they&apos;re doing the same things, in the
same ways, with some small differences here and there. One project might need a
10s timeout where another might need 30s, for instance.&lt;/p&gt;
&lt;h1&gt;What am I suggesting?&lt;/h1&gt;
&lt;p&gt;Something Blackglasses of ALT-F4 taught me was the value of turning that
overlapping config into a truly standard, reusable configuration by turning them
into templates. I&apos;ve always had a thing for enforcing consistency wherever it
makes sense, because, A, maintaining configuration is way easier if everything
works roughly the same way, and B, it makes it far easier to roll out
configuration updates across the board.&lt;/p&gt;
&lt;p&gt;To achieve this, something we did for ALT-F4 (see &lt;a href=&quot;https://github.com/ALT-F4-LLC/build-configs&quot;&gt;build-configs&lt;/a&gt;)
and at my day job, was build a template CLI that has a set of our &apos;standard&apos;
configurations, divided into &apos;types&apos; based on what kind of project we need
templates for (for instance, you probably need different configs for a Django
app compared to a binary Go Lambda), and set it up for the projects we have to
maintain.&lt;/p&gt;
&lt;p&gt;If I can configure my entire project&apos;s required setup with a simple YAML file,
along these lines:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;---
name: companyapp
template:
  type: django
  grafanacloud:
    alloy:
      prefix: myapp
      log_jobs:
        api: /var/log/company/api.log
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and have it automatically spit out my Gunicorn configuration file, my Alloy log
monitoring configs, my Django environment files, etc., all I need to do is plumb
those into my deployment system, and not actually care at all about
triple-checking that everything works. The configuration templates are standard.
And running this takes maybe 30 seconds. That&apos;s far quicker than going to a few
other projects that have similar needs, copying their config files, &apos;reusing&apos;
(read: probably changing for no reason) the file naming convention, pasting
their config files, searching for instances of the old project name, renaming
it, checking the file is valid, etc.&lt;/p&gt;
&lt;p&gt;Is it foolproof? Very much no. Templating tools don&apos;t do away with human error.
The templates they use to spit out configs are only as good as the person who
wrote them&apos;s knowledge of how the file should work. But saying that, they can be
very beneficial once they reach critical mass in terms of usage and you have
75-80% of the cross-project permutations accounted for in your templates.&lt;/p&gt;
&lt;h1&gt;Go forth and learn&lt;/h1&gt;
&lt;p&gt;Now, instead of rambling on for hours about why this is cool and boring you with
the 7 paragraphs saying the same thing I tend to end up writing when I try to
do longer-form posts like this, I&apos;m going to give an exercise to the reader. Go
forth, build a version of this tool for your job, for your personal projects,
whatever you have time for. Spend maybe an hour on your proof-of-concept form,
and apply it to 3 different projects. The tool should take a configuration file
of sorts, in your chosen format and file type (JSON, YAML, TOML, whatever), and
spit out relevant configurations based on templates bundled with the tool. The
configuration should not include every little detail of the generated
configurations, only the bits you know need to change from project to project.&lt;/p&gt;
&lt;p&gt;I&apos;m not going to tell you how to implement this. That&apos;s out of scope for this
post. However, I can give you a rough plan; pick a language, figure out how to
make small CLI tools with it, pick a templating engine, and pick a
configuration format.&lt;/p&gt;
&lt;p&gt;Go forth and work smarter, not harder. Make cross-project configuration easy.
See the benefits for yourself.&lt;/p&gt;
</content:encoded><author>Hayden</author></item><item><title>Nix - A love-hate relationship</title><link>https://hayden.moe/posts/2025-02-06-nix-a-love-hate-relationship/</link><guid isPermaLink="true">https://hayden.moe/posts/2025-02-06-nix-a-love-hate-relationship/</guid><description>Going over why I fell out of love with Nix and what I use instead</description><pubDate>Sun, 02 Feb 2025 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I&apos;ve been pretty vocal in the past about Nix, and how much I liked it. I&apos;ve used
Nix to configure everything from software projects&apos; compilers and toolchains to
my dotfiles and entire servers. Configuring everything declaratively and having
stuff just magically ✨ work ✨ is a very nice thing. However... As time has
gone on, I just find myself getting less and less happy with the state of it.&lt;/p&gt;
&lt;h1&gt;What does Nix do?&lt;/h1&gt;
&lt;p&gt;Nix is three things, as described by Blackglasses of &lt;a href=&quot;https://twitch.tv/thealtf4stream&quot;&gt;TheAltF4Stream&lt;/a&gt;;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Nix is an operating system, a language, and a package manager, but each of
those things are not the other&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Blackglasses actually has &lt;a href=&quot;https://youtube.com/watch?v=Vdg7jEk7RSY&quot;&gt;a pretty good ELI5 video&lt;/a&gt;
over on YouTube, too.&lt;/p&gt;
&lt;p&gt;Nix allows you to &lt;a href=&quot;https://en.wikipedia.org/wiki/Declarative_programming&quot;&gt;declaratively configure things&lt;/a&gt;
and build and install packages &lt;a href=&quot;https://en.wikipedia.org/wiki/Reproducible_builds&quot;&gt;reproducibly&lt;/a&gt;
so that you get very close to software running &amp;amp; being built exactly the same
way across multiple computers, and sometimes across multiple platforms, too.&lt;/p&gt;
&lt;p&gt;It&apos;s a very powerful tool to add to your belt, because it allows you to build
anything you can set up with a shell script as a package and have it work the
same way everywhere. It&apos;s especially useful in some more high-stakes use cases
such as the Lattice framework being built by Anduril Industries, where the
software deployed to their devices needs to be verifiably identical between
serial numbers, regardless of whether it&apos;s for compliance with defence
standards or for quality control purposes.&lt;/p&gt;
&lt;p&gt;Building packages with Nix is pretty simple, too:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{ stdenv, ... }:
stdenv.mkDerivation {
  name = &quot;haydens-bins&quot;;
  version = &quot;unstable&quot;;
  src = ./bin;
  installPhase = &apos;&apos;
    mkdir -p $out/bin
    cp * $out/bin
    chmod +x $out/bin/*
  &apos;&apos;;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That code block is how I set up my little utility scripts bundle in my old Nix
dotfiles.&lt;/p&gt;
&lt;p&gt;The output of this is a folder in &lt;code&gt;/nix/store&lt;/code&gt; that contains all of the contents
of the &lt;code&gt;./bin&lt;/code&gt; directory, all marked as executable with &lt;code&gt;chmod +x&lt;/code&gt;, which can
then be put into my PATH variable in my shell init file. Very useful stuff.&lt;/p&gt;
&lt;h1&gt;Why is Nix cool?&lt;/h1&gt;
&lt;p&gt;Some of the extra cool stuff with Nix comes in when you start looking at tools
beyond just package management. Things like &lt;a href=&quot;https://nixos.org&quot;&gt;NixOS&lt;/a&gt;,
&lt;a href=&quot;https://github.com/nix-community/home-manager&quot;&gt;home-manager&lt;/a&gt;, and
&lt;a href=&quot;https://github.com/LnL7/nix-darwin&quot;&gt;nix-darwin&lt;/a&gt;. They take the declarative
package generation abilities of Nix, and manage to apply them to configuring an
entire OS (or user environment in the case of home-manager).&lt;/p&gt;
&lt;p&gt;Take this piece of config from NixOS for example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# Phoebe - My home server
{ pkgs, ... }:
let
  gh-mirror = pkgs.callPackage ../../../pkgs/gh-mirror.nix {};
in
{
  environment.systemPackages = [ gh-mirror ];

  systemd.timers.&quot;gh-mirror&quot; = {
    wantedBy = [ &quot;timers.target&quot; ];
    timerConfig = {
      OnBootSec = &quot;5m&quot;;
      OnUnitActiveSec = &quot;5m&quot;;
      Unit = &quot;gh-mirror.service&quot;;
    };
  };

  systemd.services.&quot;gh-mirror&quot; = {
    script = &apos;&apos;
      set -eu
      ${gh-mirror}/bin/gh-mirror hbjydev
    &apos;&apos;;
    serviceConfig = {
      Type = &quot;oneshot&quot;;
      User = &quot;hayden&quot;;
    };
  };
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this block (also taken from my config), we&apos;re building my little &lt;code&gt;gh-mirror&lt;/code&gt;
script, adding it to the system-level &lt;code&gt;PATH&lt;/code&gt; (by placing it in
&lt;code&gt;environment.systemPackages&lt;/code&gt;), creating a SystemD service and timer for it that
runs as my user (&lt;code&gt;hayden&lt;/code&gt;) every five minutes.&lt;/p&gt;
&lt;p&gt;The end result of this is that when I rebuild my NixOS config on my server, it
creates a package for systemd configs which generates what, on any other system,
would be inside &lt;code&gt;/etc/systemd/system&lt;/code&gt;, as a Nix package, including the
&lt;code&gt;gh-mirror.service&lt;/code&gt; and &lt;code&gt;gh-mirror.timer&lt;/code&gt;, with a little script to run
&lt;code&gt;gh-mirror&lt;/code&gt; against my hbjydev GitHub user. It then keeps track of everything
that was rebuilt in my config and creates symlinks where necessary so that
software like SystemD can use them. All-in-all, it means I have one
configuration that declares how my server should run, what it should run,
and when it should run it, in a neat syntax.&lt;/p&gt;
&lt;p&gt;I shouldn&apos;t need to explain much why this is really cool if you&apos;re a sysadmin or
similar, but largely it boils down to the fact that it makes my system config
itself reproducible. I can deploy that config above to as many systems as I
want, and it will work exactly the same way on all of them.&lt;/p&gt;
&lt;h1&gt;Where does Nix fall over?&lt;/h1&gt;
&lt;p&gt;So I&apos;ve explained what Nix is, what it does, why it&apos;s cool, and why I like it.
However, it&apos;s time to get into why I don&apos;t like Nix, and why I&apos;ve ultimately
decided to drop it.&lt;/p&gt;
&lt;p&gt;Nix does a lot of stuff that&apos;s really nice. However, it also throws a lot of how
Linux works to the wind in favour of The Nix Way™. For example, because it puts
everything in /nix/store, unless you run them through Nix, software like
pkg-config and ld just simply won&apos;t work properly, because Nix doesn&apos;t care
about the Linux &lt;a href=&quot;https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard&quot;&gt;FHS (Filesystem Hierarchy Standard)&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Normally, things like dynamic libraries (*.so files) are supposed to live in
&lt;code&gt;/lib&lt;/code&gt;, &lt;code&gt;/usr/lib&lt;/code&gt; and &lt;code&gt;/usr/share/lib&lt;/code&gt;. This is so that every program has a
standard place to look to find whatever kind of file it needs without needing to
do lots of searching around the system. This is pretty much how all software on
Linux works, with exception for statically-linked binaries, but those are a
whole other can of worms that I&apos;m not going to get into here. Baeldung have a
&lt;a href=&quot;https://www.baeldung.com/cs/static-dynamic-linking-differences&quot;&gt;good post explaining this&lt;/a&gt;
if you&apos;re interested.&lt;/p&gt;
&lt;p&gt;Because &lt;code&gt;/nix/store&lt;/code&gt; says &apos;screw you&apos; to FHS, it has to change how software
built with it find their libraries. This means that (especially on NixOS, which
only uses Nix for its software) any dynamically-linked binaries (including
things you might need like the OpenShift development toolkit) just will not
work, and in the worst case, cannot be made to work either.&lt;/p&gt;
&lt;p&gt;Nix also has one big package repository, &lt;a href=&quot;https://github.com/nixos/nixpkgs&quot;&gt;nixpkgs&lt;/a&gt;,
which is (&lt;a href=&quot;https://repology.org/repositories/statistics&quot;&gt;according to Repology&lt;/a&gt;)
the largest package repository in the Linux ecosystem.&lt;/p&gt;
&lt;p&gt;That&apos;s great! But the problem with it is that it works by doing &apos;atomic&apos;
updates. This means that you can&apos;t update just one package like you can on other
distributions, you have to update the entire system in one go unless you&apos;re
willing to jump through several hoops and get deep into the documentation to
find things like &lt;code&gt;specialArgs&lt;/code&gt; or overlays.&lt;/p&gt;
&lt;p&gt;A lot of people say this is a big benefit of Nix/NixOS, but as a former sysadmin
who&apos;s had her fair share of horribly broken systems post-update, this isn&apos;t
something I&apos;m comfortable with. I&apos;m not going to suggest that atomicity is
inherently bad, it&apos;s just not something I personally like.&lt;/p&gt;
&lt;p&gt;All in all, Nix just has... growing pains that I kept hitting, and eventually it
just got too frustrating to be worth the effort I&apos;d been putting in to maintain
my configurations and software installations.&lt;/p&gt;
&lt;h1&gt;What do I do now?&lt;/h1&gt;
&lt;p&gt;So now you know why I do and don&apos;t like Nix, you might wonder what I do now.&lt;/p&gt;
&lt;p&gt;While I can&apos;t keep declaratively configuring everything, I can get somewhat
close to it by using a combination of Chezmoi to manage my dotfiles, and
Homebrew (yes, even on Linux) to manage the software I have installed on my
systems. It&apos;s not perfect, but it gives me far more freedom to screw around with
new software and tooling that I couldn&apos;t do under Nix.&lt;/p&gt;
&lt;p&gt;I hope this post hasn&apos;t turned into just a really long-winded rant, I just
wanted to bring attention to some of the issues I had and explain some of it for
people who might be unaware or want to know why I dislike it nowadays.&lt;/p&gt;
&lt;p&gt;Thanks for reading along, I hope you enjoyed this post somewhat. If you did,
maybe consider following me on Bluesky, and if you&apos;re feeling generous, maybe
consider &lt;a href=&quot;https://ko-fi.com/haydenuwu&quot;&gt;buying me a coffee&lt;/a&gt;. I&apos;m trying to write
more this year, so I&apos;ll see you in the next post. 👋&lt;/p&gt;
</content:encoded><author>Hayden</author></item><item><title>Unifi syslog with Alloy and Grafana Cloud</title><link>https://hayden.moe/posts/2024-10-24-unifi-syslog-with-alloy-and-grafana-cloud/</link><guid isPermaLink="true">https://hayden.moe/posts/2024-10-24-unifi-syslog-with-alloy-and-grafana-cloud/</guid><description>Setting up Alloy to ingest Unifi device logs over syslog and ship them to gcloud.</description><pubDate>Thu, 24 Oct 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Recently, I decided I wanted to keep syslog entries for all of my Unifi devices
somewhere instead of doing nothing with them. However, I&apos;m already pushing up a
lot of my network&apos;s stuff to Grafana Cloud already because I&apos;m a Loki and
Grafana shill. So I decided to set up Unifi to log its stuff over syslog to
Alloy.&lt;/p&gt;
&lt;p&gt;Hang on though, Promtail only lets you log to syslog with a newer format than
what Unifi devices send.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The messages must be compliant with the RFC5424 format.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;- &lt;a href=&quot;https://grafana.com/docs/alloy/latest/reference/components/loki.source.syslog/&quot;&gt;Promtail Docs&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is a problem, because Unifi devices don&apos;t send in RFC5424, they send in
RFC3164 instead. That&apos;s an issue. However, if we put an &apos;intermediary&apos; between
the two and use some of Alloy&apos;s loki.process nodes, we can sort of hack this
together.&lt;/p&gt;
&lt;p&gt;First off, we&apos;ll install syslog-ng. It provides us the ability to parse RFC3164
inbound logs, which makes this process pretty simple. We&apos;ll slap this in its
configuration:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;source udp { syslog(ip(0.0.0.0) port(514) transport(&quot;udp&quot;)); };
destination syslog_in { file(&quot;/var/log/syslog-in&quot;); };
log { source(udp); destination(syslog_in); };
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will open a listener on &lt;code&gt;0.0.0.0:514&lt;/code&gt; over UDP, which we can then point the
Unifi Controller at for logging.&lt;/p&gt;
&lt;p&gt;Once we&apos;ve done that, the logs will end up in &lt;code&gt;/var/log/syslog-in&lt;/code&gt;, which we can
then read and parse with Alloy.&lt;/p&gt;
&lt;p&gt;Let&apos;s look at our Alloy config for this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;loki.process &quot;syslog&quot; {
  stage.regex {
    expression = `(?P&amp;lt;ts&amp;gt;[A-Z][a-z][a-z]\s{1,2}\d{1,2}\s\d{2}[:]\d{2}[:]\d{2})\s(?P&amp;lt;host&amp;gt;[\w][\w\d\.@-]*)\s(?P&amp;lt;log&amp;gt;.*)$`
  }

  stage.labels {
    values = { hostname = &quot;host&quot; }
  }

  stage.timestamp {
    source = &quot;ts&quot;
    format = &quot;Jan _2 15:04:05&quot;
  }

  stage.output {
    source = &quot;log&quot;
  }

  forward_to = [gcloud.stack.default.logs]
}

loki.source.file &quot;syslog&quot; {
  targets = [
    { __path__ = &quot;/var/log/syslog-in&quot;, job = &quot;syslog&quot; },
  ]
  forward_to = [loki.process.syslog.receiver]
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This configuration will go through, read &lt;code&gt;/var/log/syslog-in&lt;/code&gt;, set
&lt;code&gt;job=&quot;syslog&quot;&lt;/code&gt; as a label, then do some processing to pull out the relevant info
we need.&lt;/p&gt;
&lt;p&gt;We parse the log line with a regex query that works for parsing RFC3164 lines,
then read the &lt;code&gt;host&lt;/code&gt; capture group in as the hostname label on the log line, and
finally parse the timestamp value from the &lt;code&gt;ts&lt;/code&gt; capture group with the relevant
Go time format string.&lt;/p&gt;
&lt;p&gt;Finally, we remove everything except the actual log itself (stripping out the
timestamp and hostname from the lines) and forward to Grafana Cloud.&lt;/p&gt;
&lt;p&gt;This is a hacky way around an annoying problem, but it works for me, and
hopefully helps some people do what I was trying to sort out.&lt;/p&gt;
&lt;p&gt;I&apos;ve got this all configured in NixOS, so
&lt;a href=&quot;https://github.com/hbjydev/dots.nix/tree/526fc36d45af789a3a55ee0f7b0320c18a691af8/nixos/roles/unifi&quot;&gt;here&apos;s that configuration&lt;/a&gt;
if you want to steal it. &lt;code&gt;default.nix&lt;/code&gt; has the main configuration (including
setting up syslog-ng), and &lt;code&gt;config.alloy&lt;/code&gt; has the syslog Alloy config shown
above.&lt;/p&gt;
</content:encoded><author>Hayden</author></item><item><title>Prettifying long GitHub Actions scripts</title><link>https://hayden.moe/posts/2024-10-23-prettifying-long-github-actions-scripts/</link><guid isPermaLink="true">https://hayden.moe/posts/2024-10-23-prettifying-long-github-actions-scripts/</guid><description>How to use GitHub Actions workflow commands to improve script output legibility.</description><pubDate>Wed, 23 Oct 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;So I was building out the CI/CD setup for
&lt;a href=&quot;https://github.com/ALT-F4-LLC/vms.nix&quot;&gt;vms.nix&lt;/a&gt; and I wasn&apos;t a fan of how
messy and unreadable the output of the AMI publisher script was. It does a lot,
so there&apos;s a lot of text spewed out.&lt;/p&gt;
&lt;p&gt;Initially, I wanted to just break it up into visual sections with newlines, but
I found that this did very little to actually help out. So I did some digging,
and stumbled across
&lt;a href=&quot;https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions&quot;&gt;workflow commands&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Welp, time to start playing around.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;The TL;DR here is that GitHub Actions actually has a fair few things you can do
to change its behaviour at runtime.&lt;/p&gt;
&lt;p&gt;To steal their entire description from the docs linked above;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Actions can communicate with the runner machine to set environment variables,
output values used by other actions, add debug messages to the output logs,
and other tasks.Most workflow commands use the echo command in a specific
format, while others are invoked by writing to a file.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;They look along these lines:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;echo &quot;::workflow-command parameter1={data},parameter2={data}::{command value}&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Which end up then, like it says, triggering tasks on the runner machine.&lt;/p&gt;
&lt;p&gt;One such magical thing is the &lt;code&gt;group&lt;/code&gt;/&lt;code&gt;endgroup&lt;/code&gt; directive. They let you create
&apos;fenced&apos; output. The syntax is simple:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;echo &quot;::group::Title&quot;
echo &quot;Stuff that&quot;
echo &quot;Goes inside&quot;
echo &quot;The group&quot;
echo &quot;::endgroup::&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That then ends up having a togglable dropdown group to &apos;hide&apos; the output. So
you can focus on the broad strokes and only drill down into your output when
needed.&lt;/p&gt;
&lt;p&gt;You can see how this works in vms.nix;
&lt;a href=&quot;https://github.com/ALT-F4-LLC/vms.nix/actions/runs/9333518231/job/25690648434#step:8:16&quot;&gt;here&apos;s an Actions run&lt;/a&gt;
&lt;a href=&quot;https://github.com/ALT-F4-LLC/vms.nix/blob/def0bfb04fdb21edbbf76f8668e7cd8a42274526/ci-build-publish.sh&quot;&gt;and the script that it runs&lt;/a&gt;.&lt;/p&gt;
</content:encoded><author>Hayden</author></item></channel></rss>