frontend: remove the stylix overlay and add hyperhive and Catppuccin light and dark themes
This commit is contained in:
parent
989d1d578c
commit
91e2d26133
5 changed files with 486 additions and 413 deletions
|
|
@ -1,7 +1,6 @@
|
|||
# The hive-c0re coordinator daemon (runs as the unprivileged
|
||||
# `hive-core` user), socket-activated at /run/hyperhive/host.sock.
|
||||
# Layout: ./options.nix (option declarations), ./theme.nix (stylix
|
||||
# frontend theming → `servedFrontend`), ./vhosts.nix (its gateway vhosts),
|
||||
# Layout: ./options.nix (option declarations), ./vhosts.nix (its gateway vhosts),
|
||||
# ./environment.nix (the daemon unit's env attrset). The root privileged
|
||||
# helper it delegates to is its own module (../hive-priv.nix).
|
||||
{
|
||||
|
|
@ -102,7 +101,6 @@ in
|
|||
{
|
||||
imports = [
|
||||
./options.nix
|
||||
./theme.nix
|
||||
./vhosts.nix
|
||||
# Hive-CA trust for this daemon's outbound TLS. The swarm services it
|
||||
# reaches over https serve a leaf chaining to the store's pki root —
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ in
|
|||
# nix store directly; dynamic API paths still proxied to the
|
||||
# agent daemon. nginx runs on the host, which is where this
|
||||
# store path already is, so it is reachable as written.
|
||||
HIVE_AGENT_FRONTEND_DIR = "${controllerCfg.servedFrontend}/agent";
|
||||
HIVE_AGENT_FRONTEND_DIR = "${controllerCfg.frontend}/agent";
|
||||
}
|
||||
// {
|
||||
# Identity env vars threaded into c0re's own service env and
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
# own outputs (they carry no in-module defaults; see ../../../flake.nix)
|
||||
# live under `services.hyperhive.deploy.hive-controller`, alongside the
|
||||
# values the meta-flake render hands the hive's agents. The flake-source
|
||||
# option the swarm builder also reads is `services.hyperhive.deploy.hyperhiveFlake`. The read-only
|
||||
# `servedFrontend` option lives in ./theme.nix with the stylix wiring
|
||||
# that computes it.
|
||||
# option the swarm builder also reads is `services.hyperhive.deploy.hyperhiveFlake`.
|
||||
{
|
||||
lib,
|
||||
...
|
||||
|
|
|
|||
|
|
@ -1,58 +0,0 @@
|
|||
# Stylix theme integration (zero-op auto-detect). When the operator's
|
||||
# host config has stylix enabled, generate a base16 `colors.css` from
|
||||
# its palette and overlay it onto the bundled frontend dist so the
|
||||
# dashboard re-themes with no operator action and no npm/esbuild
|
||||
# rebuild (a pure file-copy over the prebuilt dist). `colors.css` is
|
||||
# the entire swap contract — `theme.css` derives every semantic var
|
||||
# from the 16 base16 slots (see docs/4-implementation/web-ui/css-vars.md). The guarded
|
||||
# access makes this a clean no-op when stylix isn't imported into the
|
||||
# host config. Exposed as the read-only `deploy.hive-controller.servedFrontend` option.
|
||||
#
|
||||
# Detection + CSS-generation itself lives in `../stylix-theme.nix`
|
||||
# (shared with `swarm-ui.nix`) — this file is the c0re-specific overlay
|
||||
# consumer (which subtrees, which option).
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.hyperhive.deploy.hive-controller;
|
||||
stylixTheme = import ../stylix-theme.nix { inherit lib config pkgs; };
|
||||
inherit (stylixTheme) stylixThemeColors themedColorsCss;
|
||||
# Overlay the generated colors.css onto both dist subtrees. Both the
|
||||
# dashboard (served by hive-c0re via HIVE_STATIC_DIR) and the agent UIs
|
||||
# (served by the gateway from HIVE_AGENT_FRONTEND_DIR — static files
|
||||
# straight from the store) read their colors.css from this host-side
|
||||
# tree, so swapping both re-themes both surfaces.
|
||||
#
|
||||
# Not covered here: an agent reached directly on its own harness web
|
||||
# server (no gateway) serves from its per-agent `mergedDist`, built in
|
||||
# the agent's own nixosSystem with no access to the host's stylix
|
||||
# colours — theming that path needs the base16 palette forwarded
|
||||
# host→agent, tracked separately.
|
||||
themedFrontend =
|
||||
c:
|
||||
pkgs.runCommand "hyperhive-frontend-themed" { } ''
|
||||
cp -r ${cfg.frontend} $out
|
||||
chmod -R u+w $out
|
||||
install -m644 ${themedColorsCss c} $out/dashboard/static/colors.css
|
||||
install -m644 ${themedColorsCss c} $out/agent/static/colors.css
|
||||
'';
|
||||
in
|
||||
{
|
||||
options.services.hyperhive.deploy.hive-controller.servedFrontend = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
internal = true;
|
||||
readOnly = true;
|
||||
default = if stylixThemeColors != null then themedFrontend stylixThemeColors else cfg.frontend;
|
||||
defaultText = lib.literalExpression "<stylix-themed overlay of `frontend`>";
|
||||
description = ''
|
||||
Internal, read-only: `frontend` re-themed with the active stylix
|
||||
palette (or `frontend` verbatim when unthemed); has `dashboard/`
|
||||
and `agent/`. Exposed so the hive-gateway module can static-serve
|
||||
`dashboard/` as an nginx root instead of proxying to hive-c0re.
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ let
|
|||
inherit (gatewayCfg.lib) errorPages;
|
||||
|
||||
# Dashboard SPA dist, static-served by nginx.
|
||||
dashboardDist = "${hyperhiveCfg.deploy.hive-controller.servedFrontend}/dashboard";
|
||||
dashboardDist = "${hyperhiveCfg.deploy.hive-controller.frontend}/dashboard";
|
||||
|
||||
# `/agent/` catch-all 404 + the two internal error-page targets it
|
||||
# points at. Per-agent `location /agent/<name>/` blocks live in the
|
||||
|
|
|
|||
Loading…
Reference in a new issue