{ stdenv, swagger-ui-dist, }: # hyperhive's Catppuccin Mocha re-theme of Swagger UI: overlays our 3 # hand-authored override files (`hive-c0re/swagger-ui-theme/`) onto # the plain vendored dist (./swagger-ui-dist.nix). This is the FULL # tree hive-gateway's nginx serves at `/api/docs/` — hive-c0re hosts # none of it, only the dynamic `/api/openapi.json` (see # nix/host-modules/hive-gateway/vhosts.nix). # # Output layout: every file from `swagger-ui-dist`, with 3 replaced: # index.html — adds s for colors.css (live stylix # theme, same origin) + hyperhive-theme.css # hyperhive-theme.css — new; the re-theme itself, consumes # --baseNN vars from colors.css # swagger-initializer.js — hardcodes `url: "/api/openapi.json"`. The # plain vendored copy points at the # swagger.io petstore demo; normally # `utoipa-swagger-ui`'s `serve()` rewrites # this file per-request from a `{{config}}` # placeholder it injects at its OWN build # time (see that crate's `build.rs`'s # `replace_default_url_with_config` + # `format_config`). hive-c0re no longer # serves this file at all, so that rewrite # has to happen here instead — this copy is # hand-verified to byte-match what # `format_config` would produce for # hive-c0re's actual config (single unnamed # url, otherwise all `Config` defaults): the # same transform applied to the real # vendored file, not hand-typed from # scratch. stdenv.mkDerivation { pname = "hyperhive-swagger-ui-theme"; version = "0.1.0"; dontUnpack = true; dontBuild = true; installPhase = '' runHook preInstall mkdir -p $out cp -r ${swagger-ui-dist}/. $out/ chmod -R u+w $out install -m644 ${../../hive-c0re/swagger-ui-theme/index.html} $out/index.html install -m644 ${../../hive-c0re/swagger-ui-theme/hyperhive-theme.css} $out/hyperhive-theme.css install -m644 ${../../hive-c0re/swagger-ui-theme/swagger-initializer.js} $out/swagger-initializer.js runHook postInstall ''; meta = { description = "hyperhive Swagger UI Catppuccin Mocha re-theme — full static dist, nginx-served at /api/docs/"; homepage = "https://forge.darkest.space/hyperhive/hyperhive"; }; }