Files
nixos-router/pkgs/router-webui/package.nix
T
nilsandClaude Sonnet 5.5 876080d3f5 Show the API reference with Redoc
Replace the hand-built reference page with Redoc rendering the generated
OpenAPI document. The bundle is fetched by package.nix (pinned hash) and
served from the UI's own address; only that page gets a style nonce and
worker-src blob: in its CSP.

The spec now explains authentication, saved-not-applied, ETags (If-Match,
409) and errors, documents the ETag header, gives each operation a curl
sample, and no longer names MCP tools. Area GETs no longer emit
"parameters": null, which Redoc could not render.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV9dZrK6nipHkPfyM4F
2026-11-01 22:01:30 +01:00

38 lines
968 B
Nix

{
lib,
buildGo127Module,
fetchurl,
}:
let
# The API reference page is Redoc (MIT), served from the web UI's own address.
redoc = fetchurl {
url = "https://cdn.jsdelivr.net/npm/redoc@2.5.2/bundles/redoc.standalone.js";
hash = "sha256-a+ta6iO3HQkSLuNd6PMm44rsBQ53Tzv7ofNOXDZgiYY=";
};
in
buildGo127Module {
pname = "router-webui";
version = "0.1.0";
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [
./go.mod
(lib.fileset.fileFilter (f: f.hasExt "go") ./.)
./providers.json
./templates
./static
];
};
# static/redoc.standalone.js is not in the source tree (git ignores it); it
# is embedded in the binary with the other static files.
preBuild = ''
cp ${redoc} static/redoc.standalone.js
'';
# Standard library only.
vendorHash = null;
meta = {
description = "Web UI for a nixos-router configured by settings.json";
mainProgram = "router-webui";
};
}