diff --git a/nix/module-eval/agent-matrix.nix b/nix/module-eval/agent-matrix.nix index 0ca35876..5366637e 100644 --- a/nix/module-eval/agent-matrix.nix +++ b/nix/module-eval/agent-matrix.nix @@ -140,16 +140,24 @@ let && !(lib.any (lib.hasInfix "swarm/agents") (lib.attrValues e)); } { - # 🩸 A secret is a path: every `BAO_*` entry is the store's address or a - # file under this unit's own credentials directory, never bytes in an - # environment `/proc//environ` publishes. + # 🩸 A secret is a path: every `BAO_*` entry is the store's address, a + # file under this unit's own credentials directory, or the one file of + # the live pair ./bao.nix keeps that its name stands for — never bytes + # in an environment `/proc//environ` publishes. The live pair is + # spelled out rather than read from the option, so a default that + # turned into a value would fail here too. name = "the matrix daemon is handed store paths and never store values"; ok = let store = lib.filterAttrs (n: _: lib.hasPrefix "BAO_" n) (daemon agentMatrixBao).environment; + livePair = { + BAO_CLIENT_CERT = "/run/hive-agent-bao-identity/current/cert"; + BAO_CLIENT_KEY = "/run/hive-agent-bao-identity/current/key"; + }; + isPath = + n: n == "BAO_ADDR" || lib.hasPrefix "%d/" store.${n} || (livePair.${n} or null) == store.${n}; in - store != { } - && lib.all (n: n == "BAO_ADDR" || lib.hasPrefix "%d/" store.${n}) (lib.attrNames store); + store != { } && lib.all isPath (lib.attrNames store); } { # A token the swarm mints or replaces in the store changes no file, so