swarm: move the swarm UI's package to deploy, emptying swarm.ui
Same rule as the four movers before it. What makes this one different is that `package` was the LAST option under `services.hyperhive.swarm.ui` — `enable` moved in an earlier slice — so the namespace now holds nothing and survives only as its two rename entries. Two consequences worth naming: flake.nix set `swarm.ui.package` directly. Left alone the shim would have kept it working, which is exactly the trap: this repo's own flake would then be setting the option through its own deprecation shim and warning on every eval. It is repointed here. Four sibling assignments in that file name movers this commit does not touch; they move with theirs. The `cfg` alias is deleted. With the one code reader repointed it bound nothing but an empty attrset — which still evaluates, so nothing would have failed; it would just have sat there implying `swarm.ui` still held something. Three comments naming `cfg.package` are repointed with it. `uiOldPath` sets both old paths, so dropping either rename fails the eval. Its case reads the vhost's rendered `root` rather than the option, because that is the half a resolving-but-unwired shim would break. Not touched: swarm-ui.nix's description says its default is wired "the same way `swarm.controller.package` is", which is true until the controller moves. It belongs to that commit, not this one. Refs #3772.
This commit is contained in:
parent
e091add37a
commit
190763b3a2
4 changed files with 62 additions and 22 deletions
|
|
@ -16,7 +16,7 @@
|
|||
#
|
||||
# ⚠️ **This evaluates, it does not execute** — a command line, a request or
|
||||
# a certificate needs something that *runs* it. A case needing a rendered
|
||||
# file must stub what it drags in (`swarm.ui.package = pkgs.emptyDirectory`).
|
||||
# file must stub what it drags in (`deploy.swarm-ui.package = pkgs.emptyDirectory`).
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
|
|
@ -154,6 +154,14 @@ let
|
|||
swarm.controller.queue.clientSecretFile = "/run/secrets/ctrl-queue.secret";
|
||||
};
|
||||
|
||||
# The swarm UI, whose namespace this slice empties: `swarm.ui` had exactly
|
||||
# two options and both have moved, so BOTH old paths are set here and the
|
||||
# whole namespace now lives or dies by its two rename entries.
|
||||
uiOldPath = hive {
|
||||
swarm.ui.enable = true;
|
||||
swarm.ui.package = pkgs.emptyDirectory;
|
||||
};
|
||||
|
||||
# The two stores, which had NO old-path fixture at all until this slice —
|
||||
# their `enable` and `retentionPeriod` shims have been uncovered since they
|
||||
# landed, which is precisely the "a missing shim reads as a clean tree"
|
||||
|
|
@ -490,6 +498,31 @@ let
|
|||
# host-side half depends on: no store here, so no bind mount and no unit.
|
||||
# Without it a hive that merely names a token would drag the store's
|
||||
# container config into its evaluation.
|
||||
# Reads the vhost's rendered `root`, not the option: the UI is served
|
||||
# straight out of a store path, so a shim that resolves but stops
|
||||
# reaching the module would leave nginx pointing at the default build.
|
||||
name = "a config written against the pre-rename swarm-ui paths still serves the operator's build";
|
||||
#
|
||||
# ⚠️ `unsafeDiscardStringContext` on both sides, load-bearing rather than
|
||||
# tidy: interpolating a derivation carries string *context*, and this
|
||||
# suite renders its results into a `buildCommand` that may not reference
|
||||
# store paths. Comparing the paths as plain text is the intent — the case
|
||||
# asks "does nginx point HERE", not "depend on what it points at".
|
||||
ok =
|
||||
let
|
||||
want = builtins.unsafeDiscardStringContext "${pkgs.emptyDirectory}";
|
||||
# `or ""` is NOT enough: nginx's `locations.<l>.root` is `nullOr`, so
|
||||
# a vhost that HAS the attribute set to null skips the default and
|
||||
# reaches the coercion. Filter nulls, then discard context.
|
||||
roots = map builtins.unsafeDiscardStringContext (
|
||||
lib.filter (r: r != null) (
|
||||
map (v: v.locations."/".root or null) (builtins.attrValues uiOldPath.services.nginx.virtualHosts)
|
||||
)
|
||||
);
|
||||
in
|
||||
builtins.elem want roots;
|
||||
}
|
||||
{
|
||||
# Reads the package the CONTAINER renders, not the option: a shim that
|
||||
# resolves but stops reaching the module would leave the store running
|
||||
# nixpkgs' default while the operator's override read back fine.
|
||||
|
|
|
|||
Loading…
Reference in a new issue