# The hive this container runs on, read at boot rather than built in, so an # agent's closure does not carry it. # # hive-priv writes `/etc/hyperhive-hive-facts` into the container before every # start (`HYPERHIVE_HIVE_NAME`, `HYPERHIVE_HIVE_DOMAIN`, one `KEY=value` line # each). This environment generator hands those lines to the container's # systemd, which passes them to every unit it starts and to `machinectl shell` # sessions; a unit's own `Environment=` still overrides them. { config, lib, pkgs, ... }: let userName = config.services.hyperhive.agent.user.name; in { # Shell builtins only: nothing is assumed on PATH this early. Only the two # known keys are passed on. environment.etc."systemd/system-environment-generators/50-hyperhive-hive-facts".source = pkgs.writeShellScript "hyperhive-hive-facts" '' hive=unknown if [ -r /etc/hyperhive-hive-facts ]; then while IFS='=' read -r key value; do case "$key" in HYPERHIVE_HIVE_NAME) hive=$value ;; HYPERHIVE_HIVE_DOMAIN) ;; *) continue ;; esac printf '%s=%s\n' "$key" "$value" done < /etc/hyperhive-hive-facts fi # Names claude's remote-control sessions `-`. printf 'CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX=%s-%s\n' "$hive" ${lib.escapeShellArg userName} ''; }