- the fake host serves a subset of @endo/agent-mcp-stdio's catalog, with its names, schemas and answers; evaluate takes only E(name).method(arg, ...), and __getMethodNames__ - demo.py --host endo: a real Endo daemon (endo-but-for-bots, llm), its guest served by the package's broker - a downloads folder: the host writes, Hermes reads at ~/Downloads; BindReadOnlyPaths on Linux, a virtiofs share on macOS - .#demo-tools: Hermes and the checks get their whole PATH from the store - each run saves its MCP messages and a transcript - the guide: tools as system calls, names as file descriptors; no Linux networking, but WebApps - grants match a named URL before "download" Generated-by: Claude Opus 5.5
131 lines
3.7 KiB
Nix
131 lines
3.7 KiB
Nix
{
|
|
description = "Hermes, confined to act only as one toybox guest: a systemd unit on Linux, the same unit in a microVM on macOS";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
microvm = {
|
|
url = "github:microvm-nix/microvm.nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
# its own nixpkgs: its fixed-output hashes (pnpm deps) are for its pnpm
|
|
hermes-agent.url = "github:NousResearch/hermes-agent";
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
microvm,
|
|
hermes-agent,
|
|
}:
|
|
let
|
|
inherit (nixpkgs) lib;
|
|
in
|
|
{
|
|
nixosModules = {
|
|
# the unit that ports; whoever imports it serves its two sockets
|
|
hermes-guest = {
|
|
imports = [
|
|
hermes-agent.nixosModules.default
|
|
./nix/hermes-guest.nix
|
|
];
|
|
};
|
|
# a Linux host: the unit, and the inference proxy, under the host's systemd
|
|
linux-host = {
|
|
imports = [
|
|
self.nixosModules.hermes-guest
|
|
./nix/linux-host.nix
|
|
];
|
|
};
|
|
# the macOS VM's NixOS: the unit, with its sockets relayed over vsock
|
|
vfkit-vm = {
|
|
imports = [
|
|
microvm.nixosModules.microvm
|
|
self.nixosModules.hermes-guest
|
|
./nix/vfkit-vm.nix
|
|
];
|
|
};
|
|
};
|
|
|
|
lib = {
|
|
/**
|
|
The macOS VM and its launchd agents, for one person's settings.
|
|
hostDir: where the VM's state image and host sockets live.
|
|
The toybox socket, hostDir/toybox.sock, is toybox's to serve.
|
|
*/
|
|
mkDarwin =
|
|
{
|
|
hostDir,
|
|
model,
|
|
upstream,
|
|
keyFile,
|
|
reasoningEffort ? null,
|
|
system ? "aarch64-darwin",
|
|
}:
|
|
let
|
|
hostPkgs = nixpkgs.legacyPackages.${system};
|
|
vm = lib.nixosSystem {
|
|
system = lib.replaceString "-darwin" "-linux" system;
|
|
modules = [
|
|
self.nixosModules.vfkit-vm
|
|
{
|
|
microvm.vmHostPackages = hostPkgs;
|
|
services.hermes-guest = {
|
|
enable = true;
|
|
inherit model reasoningEffort;
|
|
vm.hostDir = hostDir;
|
|
};
|
|
}
|
|
];
|
|
};
|
|
runner = vm.config.microvm.declaredRunner;
|
|
in
|
|
{
|
|
inherit vm runner;
|
|
host = import ./nix/darwin-host.nix {
|
|
pkgs = hostPkgs;
|
|
inherit
|
|
lib
|
|
runner
|
|
hostDir
|
|
upstream
|
|
keyFile
|
|
;
|
|
};
|
|
};
|
|
};
|
|
|
|
packages = lib.genAttrs [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ] (
|
|
system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
in
|
|
{
|
|
# what test/demo.py puts on PATH for Hermes and its checks, and
|
|
# nothing else: the tools a guest's shell has, from the store, as
|
|
# the confined unit's closure gives them
|
|
demo-tools = pkgs.buildEnv {
|
|
name = "hermes-guest-demo-tools";
|
|
paths = [
|
|
(pkgs.python3.withPackages (ps: [ ps.pip ]))
|
|
pkgs.nodejs
|
|
pkgs.socat
|
|
pkgs.bash
|
|
pkgs.coreutils
|
|
pkgs.findutils
|
|
pkgs.gnugrep
|
|
pkgs.gnused
|
|
pkgs.gnutar
|
|
pkgs.gzip
|
|
pkgs.unzip
|
|
];
|
|
};
|
|
}
|
|
);
|
|
|
|
formatter = lib.genAttrs [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ] (
|
|
system: nixpkgs.legacyPackages.${system}.nixfmt
|
|
);
|
|
};
|
|
}
|