Eliminate the git-clone dependency entirely

hermenix setup/migrate/remote no longer need a local checkout anywhere:

- Host-specific settings (cache signing key, SSH keys) now live at
  /etc/hermenix/local.nix on the host itself, read via an absolute-path
  import in common.nix (--impure, deliberately - reading outside the
  flake's own source tree). No more guest/common.nix patching, no more
  guest/common.nix.bak, no more git-pull conflicts on a locally-edited
  tracked file (see the hermes-vm.service incident on hl-fwdesk).
- `setup` builds directly from the flake's own git+ssh URL by default
  (--flake to override), so it works from any directory on any host -
  dropped the "run this from the hermenix repository root" requirement
  entirely.
- `remote` now just runs `nix run <flake>#hermenix -- ...` on the target
  host directly - dropped the clone-if-missing/--dir/--repo machinery,
  since there's no checkout to manage anymore.

guest/local.nix.example documents the expected shape. Verified the
write-then-read-back round trip (nix-instantiate --eval --json) and the
simplified remote command construction against sandboxed stubs before
pushing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ariandClaude Sonnet 5 committed 2026-09-15 15:10:13 -04:00
1 parent 2078204168
commit 41ea93a28f
5 files changed
+142 -98

No files matched your search

+42 -29
View File
@@ -13,26 +13,26 @@ so.
### Guided
The `hermenix` CLI (`nu/hermenix.nu`) is a flake package — no separate install
step, `nix run` builds and runs it directly from a checkout of this repo:
The `hermenix` CLI (`nu/hermenix.nu`) is a flake package — no checkout needed
anywhere. Run it straight from its Gitea URL:
```bash
nix run .#hermenix -- setup
nix run git+ssh://gitea@minipc1.lab.internal:22/ari/hermenix.git#hermenix -- setup
```
(Or `nix profile install .#hermenix` once, then just `hermenix setup` from
here on. Either way, run it from this repo's root — it reads and writes
`guest/common.nix` relative to your current directory.)
(Or `nix profile install git+ssh://gitea@minipc1.lab.internal:22/ari/hermenix.git#hermenix`
once, then just `hermenix setup` from here on — or get it declaratively via
the nixos-setup overlay, same as any other package. Any of these work from
any directory, on any host with SSH access to Gitea.)
Walks the host-side steps: checks prerequisites, creates the disks, generates
the cache signing key, fills in `guest/common.nix` from your SSH keys, builds
the bootstrap image and writes it to the disk. It prints the module snippet
to paste into your own configuration at the end, with your uplink interface
already filled in.
the cache signing key, writes `/etc/hermenix/local.nix` from your SSH keys,
builds the bootstrap image and writes it to the disk. It prints the module
snippet to paste into your own configuration at the end, with your uplink
interface already filled in.
Safe to re-run — every step detects what's already done and offers to skip,
and nothing destructive happens without an explicit confirmation. It keeps a
`guest/common.nix.bak`.
and nothing destructive happens without an explicit confirmation.
It deliberately stops short of `nixos-rebuild`, since that's your config.
@@ -91,20 +91,32 @@ sudo chmod 0400 /var/lib/secrets/hermes-cache.secret
cat /var/lib/secrets/hermes-cache.pub
```
### 3. Fill in `guest/common.nix`
### 3. Write `/etc/hermenix/local.nix`
Near the top:
Host-specific settings live here, not in this repo — see
`guest/local.nix.example` for the reference shape:
- `cachePublicKey` — paste the key you just printed. Leaving it empty is safe;
the guest just skips the host cache.
- `authorizedKeys` — your SSH public key.
```nix
{
cachePublicKey = "hermes-cache-1:AbCd..."; # the key you just printed; leave
# empty and the guest just skips
# the host cache
authorizedKeys = [ "ssh-ed25519 AAAA... you@laptop" ];
}
```
`sudo mkdir -p /etc/hermenix` first if it doesn't exist.
### 4. Build the image and write it to the system disk
The two extra options stop you compiling Determinate Nix from source.
The two extra substituter options stop you compiling Determinate Nix from
source. `--impure` is needed because `guest/common.nix` reads
`/etc/hermenix/local.nix` from outside this flake's own source tree —
deliberately, so the flake itself stays generic and shareable while your
settings stay on your host.
```bash
nix build .#hermes-guest-image \
nix build --impure git+ssh://gitea@minipc1.lab.internal:22/ari/hermenix.git#hermes-guest-image \
--option extra-substituters https://install.determinate.systems \
--option extra-trusted-public-keys cache.flakehub.com-3:hJuILl5sVK4iKm86JzgdXW12Y2Hwd5G07qKtHTOcDCM=
@@ -113,11 +125,14 @@ sudo dd if=result/nixos.img of=/var/lib/hermes-vm/system/system.raw \
bs=4M conv=notrunc,fsync status=progress
```
(Building from a local checkout instead — e.g. while developing this flake —
works the same way with `.` in place of the git URL.)
### 5. Add the module to your system flake
```nix
{
inputs.hermenix.url = "path:/etc/nixos/hermenix";
inputs.hermenix.url = "git+ssh://gitea@minipc1.lab.internal:22/ari/hermenix.git";
outputs = { nixpkgs, hermenix, ... }: {
nixosConfigurations.myserver = nixpkgs.lib.nixosSystem {
@@ -194,13 +209,11 @@ hermenix remote fwdesk.lab.internal setup
hermenix remote fwdesk.lab.internal migrate /var/lib/hermes
```
It clones this repo to `~/hermenix` on the remote host **only if that
directory doesn't already exist there**, then `cd`s into it and runs
`nix run .#hermenix -- <the rest of the command>`. An existing checkout is
never touched beyond running the command — it won't overwrite a host's own
`guest/common.nix` (cache key, authorized keys) or anything else it's
accumulated. Override the checkout path or repo URL with `--dir`/`--repo` if
you need to.
It runs `nix run <flake>#hermenix -- <the rest of the command>` directly on
the remote host — no checkout involved, on either end. The remote host does
need its own SSH access to Gitea (the same access a `git clone` would need).
Override the flake URL with `--flake` if you're pointing at a fork or a
branch.
It connects with `ssh -t`, which allocates a real pty — required for the
interactive prompts in `setup`/`migrate` to work at all over the connection.
@@ -694,10 +707,10 @@ at some directory full of `SOUL.md`, `memories/`, `sessions/`, `state.db`,
etc.):
```bash
nix run .#hermenix -- migrate /path/to/existing/HERMES_HOME
nix run git+ssh://gitea@minipc1.lab.internal:22/ari/hermenix.git#hermenix -- migrate /path/to/existing/HERMES_HOME
```
Run `nix run .#hermenix -- migrate --help` for the full set of options
Run `... -- migrate --help` for the full set of options
(vsock CID, guest user, destination path, hostname rewrites). It copies —
never moves or deletes — the source data, so the original stays a safe
fallback until you've verified the new VM.