A NixOS module (nix/hermes-guest.nix) layers confinement on upstream's services.hermes-agent: no network (PrivateNetwork), an empty /run with two Unix sockets bound back in, and no user manager. Hermes reaches the world through host.sock, the guest's Endo methods (listMessages, request, lookup, reply, ...) as MCP, and llm.sock, an inference proxy that holds the API key. The same unit runs on a Linux host (nix/linux-host.nix) and in a vfkit microVM on macOS (nix/vfkit-vm.nix), where systemd relays the two sockets over vsock to launchd on the host (nix/darwin-host.nix). test/demo.py runs unmodified Hermes against a fake host and a scripted model, and checks what the host received. Generated-by: Claude Opus 5.5
44 lines
990 B
Nix
44 lines
990 B
Nix
# On a Linux host: Hermes's unit runs here, confined by systemd, and the
|
|
# host's systemd serves both of its sockets.
|
|
{
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.services.hermes-guest;
|
|
in
|
|
{
|
|
imports = [
|
|
./hermes-guest.nix
|
|
./llm-proxy.nix
|
|
];
|
|
|
|
options.services.hermes-guest.hostSocketUnit = lib.mkOption {
|
|
type = lib.types.str;
|
|
example = "endo-guest-hermes.socket";
|
|
description = ''
|
|
The socket unit that serves hostSocket: the guest's host (toybox, say), bound to Hermes's
|
|
guest agent, with SocketUser set to Hermes's user and SocketMode 0600.
|
|
'';
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
services.hermes-llm-proxy = {
|
|
enable = true;
|
|
socket = cfg.llmSocket;
|
|
socketUser = config.services.hermes-agent.user;
|
|
};
|
|
systemd.services.hermes-agent = {
|
|
after = [
|
|
"hermes-llm.socket"
|
|
cfg.hostSocketUnit
|
|
];
|
|
requires = [
|
|
"hermes-llm.socket"
|
|
cfg.hostSocketUnit
|
|
];
|
|
};
|
|
};
|
|
}
|