From 3e1b98432931cd6a1491be4762dcb508dd9085f3 Mon Sep 17 00:00:00 2001 From: eti Date: Wed, 15 Apr 2026 16:49:37 +0000 Subject: [PATCH] blog: add favicon to blog build Add nix/pkgs/blog.nix to build the blog with proper static assets including the dolly favicon files. Update the CI workflow to generate favicons using the dolly tool before building. The favicon was missing in production because appview/pages/static/* is gitignored, and the CI workflow wasn't generating the dolly icons. Signed-off-by: eti --- .tangled/workflows/deploy-blog.yml | 13 +++++++++++-- flake.nix | 2 ++ nix/pkgs/blog.nix | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 file(s) changed, 56 insertion(s)(+), 2 deletion(s)(-) diff --git a/.tangled/workflows/deploy-blog.yml b/.tangled/workflows/deploy-blog.yml --- a/.tangled/workflows/deploy-blog.yml +++ b/.tangled/workflows/deploy-blog.yml @@ -13,8 +13,17 @@ steps: - name: patch static dir command: | - mkdir -p appview/pages/static - touch appview/pages/static/x + mkdir -p appview/pages/static/logos + + - name: build dolly + command: | + go build -o dolly.out ./cmd/dolly + + - name: generate favicons + command: | + ./dolly.out -template appview/pages/templates/fragments/dolly/logo.html -output appview/pages/static/logos/dolly.png -size 180x180 + ./dolly.out -template appview/pages/templates/fragments/dolly/logo.html -output appview/pages/static/logos/dolly.ico -size 48x48 + ./dolly.out -template appview/pages/templates/fragments/dolly/logo.html -output appview/pages/static/logos/dolly.svg -color currentColor - name: generate css command: | diff --git a/flake.nix b/flake.nix --- a/flake.nix +++ b/flake.nix @@ -98,6 +98,7 @@ appview-static-files = self.callPackage ./nix/pkgs/appview-static-files.nix { inherit htmx-src htmx-ws-src lucide-src inter-fonts-src ibm-plex-mono-src actor-typeahead-src mermaid-src; }; appview = self.callPackage ./nix/pkgs/appview.nix {}; + blog = self.callPackage ./nix/pkgs/blog.nix {}; docs = self.callPackage ./nix/pkgs/docs.nix { inherit inter-fonts-src ibm-plex-mono-src lucide-src; inherit (pkgs) pagefind; @@ -124,6 +125,7 @@ inherit (packages) appview appview-static-files + blog lexgen goat spindle diff --git a/nix/pkgs/blog.nix b/nix/pkgs/blog.nix new file mode 100644 --- /dev/null +++ b/nix/pkgs/blog.nix @@ -0,0 +1,43 @@ +{ + buildGoApplication, + runCommandLocal, + modules, + appview-static-files, + sqlite-lib, + src, +}: let + blog-bin = buildGoApplication { + pname = "blog"; + version = "0.1.0"; + inherit src modules; + + postUnpack = '' + pushd source + mkdir -p appview/pages/static + cp -frv ${appview-static-files}/* appview/pages/static + popd + ''; + + doCheck = false; + subPackages = ["cmd/blog"]; + + tags = ["libsqlite3"]; + env.CGO_CFLAGS = "-I ${sqlite-lib}/include "; + env.CGO_LDFLAGS = "-L ${sqlite-lib}/lib"; + CGO_ENABLED = 1; + }; +in + runCommandLocal "blog" {} '' + mkdir -p working + cp -r --no-preserve=mode ${src}/blog working/ + cp -r --no-preserve=mode ${src}/appview working/ + + mkdir -p working/appview/pages/static + cp -fr --no-preserve=mode ${appview-static-files}/* working/appview/pages/static/ + + cd working + ${blog-bin}/bin/blog build + + mkdir -p $out + cp -r build/* $out/ + '' -- tangled.sh