hive-gateway: serve the swagger-ui theme via nginx alias, not a c0re build hook

This commit is contained in:
damocles 2026-08-02 20:19:33 +02:00 committed by mara
commit de1659d10e
7 changed files with 117 additions and 8 deletions

View file

@ -158,6 +158,11 @@ in
xdg-icons = pkgs.callPackage ./hive-xdg-icons.nix {
hyperhiveSvg = ../../branding/hyperhive.svg;
};
# Swagger UI re-theme static override files — see
# ./swagger-ui-theme.nix. The gateway `alias`es these straight from
# the store; a theme tweak is a gateway config change, not a
# hive-c0re rebuild.
swagger-ui-theme = pkgs.callPackage ./swagger-ui-theme.nix { };
# Pre-built per-container system closures. Exposed as packages
# so operators can `nix build .#agent-base-toplevel` (or wire

View file

@ -0,0 +1,49 @@
{
stdenv,
}:
# The hand-authored Swagger UI re-theme files (`hive-c0re/swagger-ui-
# theme/`), shipped as a standalone derivation so the gateway can
# `alias` them straight from the nix store instead of hive-c0re's own
# build serving them — see nix/host-modules/hive-gateway/vhosts.nix's
# `swaggerThemeLocations`. This is what lets a CSS tweak ship as a
# gateway config change (activate the gateway container) rather than a
# hive-c0re rebuild+restart: the two files nginx exact-matches
# (`/api/docs/` and `/api/docs/hyperhive-theme.css`) come from here;
# every other Swagger UI asset (bundle.js, openapi.json, favicons, …)
# still falls through the existing `/api/` prefix proxy to hive-c0re's
# own vendored (unthemed) `utoipa-swagger-ui` embed, unchanged.
#
# Pure data: copied verbatim, no build step.
#
# Output layout:
# $out/index.html — themed index.html Swagger UI page
# $out/hyperhive-theme.css — the re-theme, consumes --baseNN vars
# from the dashboard's own colors.css
# (loaded via an absolute /static/
# colors.css <link>, same origin)
stdenv.mkDerivation {
pname = "hyperhive-swagger-ui-theme";
version = "0.1.0";
# Narrow src keeps this derivation's input hash decoupled from the
# rest of the tree — a theme tweak only re-hashes this.
src = ../../hive-c0re/swagger-ui-theme;
dontBuild = true;
dontConfigure = true;
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r ./* $out/
runHook postInstall
'';
dontFixup = true;
meta = {
description = "hyperhive Swagger UI Catppuccin Mocha re-theme (static override files)";
homepage = "https://forge.darkest.space/hyperhive/hyperhive";
};
}