Author SHA1 Message Date
jackos1998andClaude Opus 5.5 b56ce8ff5d flake: Pin slop-broker to its progress branch
For testing slop-broker#22 on real deploys; not for merging.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 20:38:59 +00:00
jackos1998andClaude Opus 5.5 d95309b4d3 flake: Update slop-broker to v0.3.0
Build llm-agents / build (pull_request) Skipped
CI / Check, build and cache nixfiles (push) Successful in 29m42s
Update docs / update (push) Failing after 1m11s
Containers as targets (protocol 3, so every `slop` moves with the
broker), copying from the builder's store, and stdin no longer hiding
a disconnect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 18:33:41 +00:00
jackos1998andClaude Opus 5.5 0a8c98f76f nixos/slop-cannon: Keep agents' running notes in issues
Build llm-agents / build (pull_request) Skipped
CI / Check, build and cache nixfiles (push) Canceled after 0s
Update docs / update (push) Canceled after 0s
Plans and status notes kept in files on branches go stale once the
work moves on or the branch is forgotten. Have agents keep them in
Gitea issues on the repository they're about, one per piece of work,
and say the same in `AGENTS.md` for `dev/nixfiles`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 18:17:46 +00:00
jackos1998andClaude Opus 5.5 5fcd2f29be nixos/palace: Hide guest NVMe disks from LVM by every name
Build llm-agents / build (pull_request) Skipped
CI / Check, build and cache nixfiles (push) Canceled after 0s
Update docs / update (push) Canceled after 0s
`global_filter` rejected `/dev/nvme*` but then accepted everything
else, and LVM accepts a device if any of its names is accepted: the
disk's `/dev/disk/by-*` links were. So `palace` saw `slop-cannon`'s
volume group, also called `main`, and LVM commands naming `main`
refused to run while the disk was connected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 16:26:08 +00:00
jackos1998andClaude Opus 5.5 57a21b459b flake: Update slop-broker to v0.2.2
Build llm-agents / build (pull_request) Skipped
CI / Check, build and cache nixfiles (push) Successful in 38m50s
Update docs / update (push) Failing after 1m29s
Says how long approvers have to answer when a request starts waiting,
instead of the guide giving the five-minute default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 19:44:29 +00:00
jackos1998andClaude Opus 5.5 36c42e7c6f flake: Update slop-broker to v0.2.1
Build llm-agents / build (pull_request) Skipped
Update docs / update (push) Canceled after 0s
CI / Check, build and cache nixfiles (push) Canceled after 16m42s
Names secret recipients by their comments in `secrets.nix`, shows what
approvers saw in the audit history as approvals do, and reads unsigned
size changes from newer Nix in deploy approvals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 18:52:58 +00:00
jackos1998andClaude Opus 5.5 68de43b467 secrets: Name host keys for slop-broker approvals
Update docs / update (push) Failing after 1m44s
CI / Check, build and cache nixfiles (push) Canceled after 8m38s
Approvals list host keys abbreviated, which says little about which box
a secret goes to. Write each system's name after its key as the key's
comment, which age ignores and slop-broker shows as the name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 16:09:08 +00:00
jackos1998andClaude Opus 5.5 44f0358fef flake: Update the Paseo fork for stale jj workspaces
CI / Check, build and cache nixfiles (push) Canceled after 1m51s
Update docs / update (push) Failing after 1m18s
The fork now reports a jj workspace that another workspace made
stale, keeps its diffs readable, and offers an update-stale action.
It also logs skipped idle compactions at info.

Update the slop-cannon page, which still described Paseo before the
fork's jj workspaces.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 16:07:34 +00:00
jackos1998andClaude Opus 5.5 08cb5828e8 middleman: Add a Pocket ID client for mailcow
Build llm-agents / build (pull_request) Skipped
CI / Check, build and cache nixfiles (push) Successful in 28m43s
Update docs / update (push) Failing after 1m25s
mailcow's Generic-OIDC identity provider can sign mailboxes in to
its UI and SOGo with Pocket ID. mailcow isn't NixOS, so its side is
set up by hand in the admin UI with the secret from
`mailcow/oidc-secret.txt`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 14:42:21 +00:00
jackos1998andClaude Opus 5.5 712fabcb62 git: Sign in to Gitea with Pocket ID
Build llm-agents / build (pull_request) Skipped
Update docs / update (push) Failing after 1m10s
CI / Check, build and cache nixfiles (push) Successful in 29m1s
Add an `id.nul.ie` OpenID Connect login source to Gitea, kept up to
date from `preStart` since Gitea stores login sources in its database.
Its client is declared on `middleman` with the secret shared by both.
Registration stays disabled, so a Pocket ID sign-in links to an
existing account.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 00:35:02 +00:00
jackos1998andClaude Opus 5.5 eeb1f2d15c middleman: Replace nginx-sso with Pocket ID SSO
CI / Check, build and cache nixfiles (push) Canceled after 25m17s
Update docs / update (push) Failing after 1m53s
Gate the vhosts without their own sign-in with oauth2-proxy, which
signs in with Pocket ID and allows members of the `admins` group.
Each gated vhost serves its own `/oauth2/` endpoints with a host-only
session cookie, so other `.nul.ie` sites never receive it. Sessions
last a week, and a refresh token lets oauth2-proxy check back with
Pocket ID every hour without a passkey.

Add `my.pocket-id`, which declares Pocket ID groups and OIDC clients
in Nix; `pocket-id-sync` applies them through the API with a static
API key that nginx keeps from outside requests. This lets apps move
to Pocket ID with their client defined next to them, with secrets
from `slop secret generate`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 00:15:06 +00:00
jackos1998 a3950b9bb3 flake: Update slop-broker to v0.1.1
Build llm-agents / build (pull_request) Skipped
CI / Check, build and cache nixfiles (push) Successful in 31m1s
Update docs / update (push) Failing after 1m7s
2026-11-26 22:57:59 +00:00
jackos1998andClaude Opus 5.5 d0eed3943d ci: Evaluate with a pool of nix-eval-jobs workers
CI / Check, build and cache nixfiles (push) Successful in 30m7s
Update docs / update (push) Failing after 1m9s
Each CI job ran in its own `nix build`, and its output path came from
a second `nix eval`. Every one of those evaluations paid ~15s and
~4 GiB to evaluate the flake before reaching its job, and import from
derivation stalled each job in turn. The final `ciDrv` evaluation
covered every job once more.

Evaluate everything once with `nix-eval-jobs` instead: workers keep
the shared evaluation for several jobs and wait on import from
derivation in parallel, and the worker count and memory bound cap
evaluation at 24 GiB of the 40 GiB `git` VM. Build every job in one
`nix build --keep-going`, push the results in one copy, and build the
profiled link farm from the known output paths, which makes `ciDrv`
unnecessary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 22:07:15 +00:00
jackos1998andClaude Opus 5.5 cc38f152be ci: Cancel runs superseded by a newer push
A run builds every system for an hour or more, and only the newest
commit on `master` needs building and caching.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 22:07:15 +00:00
jackos1998 25dfa0684f flake: Pin slop-broker to v0.1.0
Build llm-agents / build (pull_request) Skipped
Update docs / update (push) Canceled after 0s
CI / Check, build and cache nixfiles (push) Canceled after 3m6s
2026-11-26 21:49:38 +00:00
github-actions[bot] 6220289079 flake: Update llm-agents
Update docs / update (push) Canceled after 0s
CI / Check, build and cache nixfiles (push) Successful in 1h8m53s
claude-code 2.1.330 -> 2.1.332
codex 0.170.0 -> 0.172.0
2026-11-26 18:31:01 +00:00
jackos1998andClaude Opus 5.5 f806a59cd3 ci/llm-agents: List version changes in the PR body
CI / Check, build and cache nixfiles (push) Canceled after 0s
Update docs / update (push) Canceled after 0s
Show the installed version changes as a table in the update PR's
description, with a link to the upstream comparison, rather than
pointing reviewers at the commit message. The updater rewrites the
description of an existing PR whenever it no longer matches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 18:20:47 +00:00
jackos1998andClaude Opus 5.5 b047a563d2 Ignore Python bytecode caches
Build llm-agents / build (pull_request) Skipped
Update docs / update (push) Canceled after 0s
CI / Check, build and cache nixfiles (push) Canceled after 31s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 18:20:01 +00:00
jackos1998andClaude Opus 5.5 2a14417315 ci/llm-agents: Propose and build version updates
Build llm-agents / build (pull_request) Skipped
Update docs / update (push) Canceled after 0s
CI / Check, build and cache nixfiles (push) Canceled after 13s
Discover the upstream derivations installed by the box and home
configurations. Refresh one update PR when their versions change,
and run the targeted package build against its new commit.

Closing the PR declines its versions until a later release, and
the updater closes an open PR once master already has the latest
versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 18:11:10 +00:00
jackos1998 1119371d2e nixos/palace: Extend slop approval timeout
Update docs / update (push) Canceled after 0s
CI / Check, build and cache nixfiles (push) Successful in 1h13m47s
Give approvers 45 minutes to answer each request. Install guidance
for Claude and Codex on `slop-cannon` to report expired requests
and pause work that depends on approval.
2026-11-26 14:19:04 +00:00
jackos1998andClaude Opus 5.5 bc7c2e36b9 flake: Update slop-broker
Update docs / update (push) Canceled after 0s
CI / Check, build and cache nixfiles (push) Canceled after 1m24s
`slop ssh` sends its stdin with the request so approvers see it, which
bumps the protocol version; activations finish when their connection
drops, and switching no longer restarts the broker. Document restarting
it after deploying `palace`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 14:18:45 +00:00
jackos1998andClaude Opus 5.5 cca27d60b0 flake: Update the Paseo fork to v0.17.5
CI / Check, build and cache nixfiles (push) Successful in 1h16m51s
Update docs / update (push) Failing after 1m17s
`fork/jujutsu-v0.17.5` replays the Jujutsu commits on upstream
`v0.17.5` and adds idle compaction: an idle Claude agent with a large
context is compacted shortly before its one-hour prompt cache expires,
following Claude Code's own rules. It is on by default.

Deploy `slop-cannon` and `middleman` together, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 11:05:23 +00:00
jackos1998andClaude Opus 5.5 6996096765 nixos: Use BBR for TCP sent from colony and home
CI / Check, build and cache nixfiles (push) Successful in 1h17m9s
Update docs / update (push) Failing after 1m10s
`estuary`'s port in ColoClue DC6 loses bursts of packets whenever the
members switch floods other members' traffic to it. CUBIC treats each
burst as congestion and takes 20-30 s to recover, longer than the gap
between floods. BBR keeps going. Between `estuary` and `river`, it
averaged 899 Mbit/s against CUBIC's 258 Mbit/s downloading from
colony, and 185 against 149 Mbit/s uploading to it.

Add a `my.network.bbr` option. Congestion control is chosen by the
sender, so enable it on the colony boxes that send data off-box
(`colony`, `shill` and its `middleman` proxy, `git`, `whale2`), and
for uploads on `castle` and the home routers. Forwarded traffic isn't
affected, so the routers only gain for their own connections and
`estuary` is left alone. BBR paces itself, so the default qdisc
stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:11:53 +00:00
jackos1998andClaude Opus 5.5 c3e7a4daa3 secrets/slop-cannon: Replace the Gitea token
CI / Check, build and cache nixfiles (push) Canceled after 0s
Update docs / update (push) Successful in 1m11s
The bot's new token can also read its own profile (`read:user`), which
`tea` asks for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 00:21:24 +00:00
jackos1998andClaude Opus 5.5 1a7c632dce flake: Switch Paseo to our Jujutsu fork
Update docs / update (push) Canceled after 0s
CI / Check, build and cache nixfiles (push) Canceled after 23m56s
The fork on `git.nul.ie/dev/paseo` carries colocated Jujutsu support
on upstream `v0.17.4`. `slop-cannon` runs its daemon and `middleman`
serves its web app, so both need deploying together.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 00:11:18 +00:00
jackos1998andClaude Opus 5.5 51c26fbcec nixos/slop-cannon: Reach Gitea as the bot user
Agents pushed with a write-enabled deploy key, added to each repo by
hand, and had no way to open pull requests. The bot user's token now
does both: Git uses HTTPS with a credential helper that sends it, and
`tea` is wrapped to log in with it. Only Dev pushes and merges to
`master`.

A new `my.agents.rules` option gives every agent extra instructions.
`slop-cannon`'s make a pull request the default way to finish work,
unless a repository's own instructions allow more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 00:11:18 +00:00
jackos1998andClaude Opus 5.5 cb4937f230 nixos/palace: Let slop-broker change secrets
Update docs / update (push) Successful in 1m6s
CI / Check, build and cache nixfiles (push) Successful in 1h12m51s
The broker gets its age identity and `slop secret` for agents.
Listing keys doesn't ask; everything else does, with approvals
checked against `master`, which only Dev can push to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:45:27 +00:00
jackos1998andClaude Opus 5.5 0de9124c3a secrets: Add slop-broker as a recipient
`slop-broker` on `palace` gets its own age identity, so it can change
secrets for agents without the dev key. Every secret is rekeyed once
to include it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:45:27 +00:00
jackos1998andClaude Opus 5.5 93f9309c91 nixos/castle: Use slop-broker over SSH
`castle` gets a requester and an approver key for `palace`'s broker,
set up with `programs.slop`, to try the SSH transport. `palace` lets
the keys in as the requester `castle`, sharing `slop-cannon`'s `agent`
policy, and the approver `castle`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:45:27 +00:00
jackos1998andClaude Opus 5.5 2519c3c86c nixos/palace: Run slop-broker for agents
`slop-cannon`'s agents reach the broker on `palace` through a vsock
device, under an `agent` policy: box queries run without asking,
`slop ssh` asks (offering 5 min and 1 h leases), and so do deploys.
The deploy key moves to `palace` as an age secret for the broker, so
the VM never holds it, and `AGENTS.md` points agents there at `slop`.

`palace` runs the builder itself, as `slop-broker-build`, reached over
SSH like a separate box and fetching `dev/nixfiles` with a read-only
deploy key, so `slop-cannon` shrinks to 24 GiB. `slop build` pushes
into Harmonia's store on `object` with a key of the broker's own,
which can only speak the store protocol and add GC roots there.
Agents' use of the builder asks, unless the commit is already on
`master`. Builds run agent-written Nix, so they only reach the
Internet, like `lan-untrusted`, and `nix-daemon` is limited so they
can't starve the VMs.

The approvals web app listens on `palace` for `middleman` only, the
one client the firewall lets in, which publishes it at
`approve.slop.nul.ie`. Approvers sign in with Pocket ID, and deploys
to the routers need a fresh passkey.

The broker's SSH targets are the deploy-rs nodes on `master`, which
the builder reads there, so agents can't add or redirect one.

With the broker gating what needs credentials, `slop-cannon`'s agents
are permissive by default: Claude bypasses permission prompts and
Codex runs without approvals or its sandbox, with matching Paseo
profiles. The deny rules for raw `deploy` and `ssh-machine` stay as
steers towards `slop`; the ones for `.keys/` go, since the VM's
checkout only has the committed public keys there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:45:27 +00:00
jackos1998andClaude Opus 5.5 71ed076f12 flake: Add slop-broker from its own repository
The broker, its NixOS and home-manager modules and the agents' guide
now live in the `slop-broker` repository, which this flake takes as an
input: its overlay provides `pkgs.slop-broker`, and the common modules
import `services.slop-broker*` and `programs.slop`. What's specific to
these boxes stays here: tmproot persistence for the broker and its
builder, `my.agents.slop` and the devshell's `slop` commands, which
`docs/slop-broker.md` describes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:45:27 +00:00
jackos1998andClaude Opus 5.5 75f6c1a064 nixos/middleman: Add Pocket ID at id.nul.ie
Pocket ID is a passkey-only OpenID Connect provider. It will sign in
to the slop-broker approvals web app, and later replace nginx-sso's
Google sign-in. Creating the first admin is restricted to internal
networks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:45:27 +00:00
jackos1998andClaude Opus 5.5 1622d9dda9 nixos/middleman: Move Paseo web app to slop.nul.ie
The public certificate also gains `*.slop.nul.ie` for agent dev
server previews.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:45:27 +00:00
jackos1998andClaude Opus 5.5 3d9da0efda AGENTS.md: Spell out blank lines and nested bullets
Separate logical steps with blank lines inside functions too, and break
long bullets and steps into a short lead with nested bullets rather
than growing them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:45:27 +00:00
jackos1998andClaude Opus 5.5 9c61198937 colony/git: Start Actions runner after Gitea
Update docs / update (push) Successful in 1m29s
CI / Check, build and cache nixfiles (push) Successful in 1h25m52s
The runner exits when Gitea isn't serving yet, so an activation that
restarts both made it hit its start limit and failed the deploy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 16:04:08 +00:00
jackos1998andClaude Opus 5.5 3bc6885a14 nix: Add nix-community binary cache
CI / Check, build and cache nixfiles (push) Successful in 1h52m34s
Update docs / update (push) Successful in 33s
The nix-community cache builds unfree packages that `cache.nixos.org`
skips, such as the MongoDB used by UniFi, which otherwise takes hours
to build in CI. Add it to the flake's `nixConfig` (used by CI) and to
`lib.my.c.nix.cache` for boxes, homes and the devshell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 15:51:28 +00:00
jackos1998andClaude Opus 5.5 139afc004e colony/git: Match Gitea task timeout to runner
Gitea's default `ENDLESS_TASK_TIMEOUT` of 3h marked long CI jobs as
failed while the runner kept building, leaving an orphaned job
container. Raise it to the runner's 8h job timeout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 15:51:05 +00:00
jackos1998andClaude Opus 5.5 7694945041 nixos/containers: Hash rendered nspawn file
CI / Check, build and cache nixfiles (push) Failing after 3h20m33s
Update docs / update (push) Canceled after 7m47s
The container restart trigger hashed the whole `systemd.nspawn.<name>`
option value. Newer NixOS adds a `warnings` list to it, which embeds
module source paths. With lazy trees those paths change on every
evaluation, so the toplevel differed between `nix build` and `nix eval`
and CI failed to push `system-kelder`.

Hash the rendered `.nspawn` text instead, so containers restart exactly
when the file systemd reads changes. Older NixOS renders all units into
one directory, so fall back to the JSON hash there until 26.11.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 10:17:08 +00:00
jackos1998 fabbb43fbf ci/nix: Allow IFD for runtime dependency replacements
Update docs / update (push) Successful in 1m5s
CI / Check, build and cache nixfiles (push) Failing after 1h2m10s
Share a single replacement list between NixOS and standalone Home
Manager. CI checks that list against its targets' nixpkgs channels.

When a replacement applies, warn and defer the flake check until
after the target builds. Runtime replacement needs to generate and
import store reference graphs during evaluation, which fails under
`nix flake check --no-build` on a fresh runner.

Keep the early eval-only check and disable IFD when the list is empty.
2026-11-23 23:45:23 +00:00
github-actions[bot] d5e2b93fd0 docs: Update generated references 2026-11-23 17:11:58 +00:00
jackos1998 af32a8dd4b lib/json-c: Work around the 0.19 memory leak
Update docs / update (push) Successful in 1m28s
CI / Check, build and cache nixfiles (push) Failing after 1m31s
In json-c 0.19, json_object_put calls the function that frees detached
JSON objects inside assert(). Release builds with NDEBUG skip that
call. Sway's frequent IPC replies then leak memory, eventually making
workspace switches lag.

Patching json-c in the main package set changes the library's store
path and forces dependent packages, including Firefox and Chromium,
to rebuild. Keep the pin with SPDK 26.09 and build the ABI-compatible
fix separately. Rewrite runtime references in NixOS systems and
standalone Home Manager generations to reuse their existing binaries.

Drop the replacement when the pinned nixpkgs includes the fix.

https://github.com/NixOS/nixpkgs/pull/586077
2026-11-23 17:09:05 +00:00
jackos1998 a75d94f492 devshell: Add container support to ssh-machine
Update docs / update (push) Canceled after 0s
CI / Check, build and cache nixfiles (push) Canceled after 25m22s
Port `ssh-machine` to Python and derive container targets from their
hosting boxes. Configure `tower` to prefer its home DNS name and fall
back to its Tailscale name.
2026-11-22 23:26:00 +00:00
jackos1998 19265dfc75 openwrt/feeds: Refresh fergal firmware pins
Update docs / update (push) Successful in 1m25s
CI / Check, build and cache nixfiles (push) Failing after 58m12s
Update the snapshot and release feeds and record the serial console
settings for firmware recovery.
2026-11-22 16:18:48 +00:00
jackos1998 6894b5c1ab skills: Share flash-openwrt and install-box 2026-11-22 16:18:48 +00:00
github-actions[bot] a45cbf4c3d docs: Update generated references 2026-11-22 15:21:30 +00:00
jackos1998andClaude Opus 5.5 f7c733c2d1 nixos/spdk: Move to SPDK 26.09
CI / Check, build and cache nixfiles (push) Failing after 6m19s
Update docs / update (push) Successful in 1m23s
SPDK 26.01 crashes while scanning the PCI bus with DPDK 26.07. Pick
up the fork's bump to SPDK 26.09, which adds the 26.07 compatibility
layer, and drop the 26.01-only DPDK 26.03 workaround.

SPDK 26.09 sizes transport caches from the shared iobuf pool, so the
RDMA transport on `cellar` starved the bdev and accel caches. Set its
caches explicitly and enlarge the pools. Also retry `spdk-tgt` on
failure, as loading its config can fail intermittently at startup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:11:44 +00:00
jackos1998andClaude Opus 5.5 65221ee403 middleman: Set nginx workers through the module
The nginx module now writes `worker_processes` itself, so the copy in
`appendConfig` duplicated it and nginx failed its config test. Keep
`auto` explicit through `services.nginx.workerProcesses`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:11:44 +00:00
jackos1998andClaude Opus 5.5 4d4404a254 colony: Install ipmitool and document the BMC
Record the BMC's management address and how to reach and recover it
through the in-band IPMI interface while the host is up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:11:44 +00:00
jackos1998andClaude Opus 5.5 f51a4db577 hass: Drop the ignored HTTP YAML configuration
Home Assistant 2026.8 imported the `http` block into `.storage/http`
and has ignored it since, raising a repair to remove it. Keeping it in
Nix suggested that `trusted_proxies` still followed `middleman`'s
assignments. Remove it and document that the HTTP settings are
managed in the UI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:11:44 +00:00
jackos1998andClaude Opus 5.5 288d68b954 colony-psql: Upgrade PostgreSQL to 18
Return the container to `mine` with PostgreSQL 18. The live cluster
was migrated from 14 with `pg_upgrade --link` before this config
first started. The new cluster was initialized with
`-E UTF8 --locale=en_US.UTF-8 --no-data-checksums` to match the old
one, and every B-tree index on a `character(n)` column was reindexed
afterwards because `amcheck` rejected their 14-built deduplication
flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:11:44 +00:00
jackos1998andClaude Opus 5.5 31b5e3b608 nixpkgs: Refresh pins and flake inputs
Move all four channels and both home-manager inputs to the rebased
fork and current channels, and refresh the other moving inputs. Bump
the latest kernel to 7.3 and the release metadata to 26.11.

Follow upstream removals: pin `colony-psql` (PostgreSQL 14) to
`mine-stable` until the PostgreSQL 18 migration that follows, and
`spoder` (Nextcloud 32) until its own migration, and take MinIO for
`object` from `mine-stable` through a compatibility import. Replace
Gitea's removed `DOMAIN` with `SSH_DOMAIN`, let `determinate-nix` pick
its own nixpkgs, and drop the nginx bump now that every pin ships fixed
releases. Move Frigate's recording retention to the `record.continuous`
layout, since 0.18 rejects `record.retain`. Pass the borgbackup wrapper
flags as separate arguments now that the package uses structured
attributes. Stop `britway`'s mesh link gating `network-online.target`:
systemd 262 holds it in configuring until `tailscale0` exists for its
policy rule, and tailscaled only starts once the network is online.

Keep the SCTP module block: no kernel in use carries the NGINX2Root
SCTP fix yet. Record the checks `kelder` missed while out of service
on its page.

Notable upgrades:

- Kernels: 6.18.64 LTS and 7.3.5 latest.
- Gitea 1.27.2 -> 28.3.0, with schema migrations.
- Home Assistant 2026.8.2 -> 2026.11.2 and Frigate 0.17.2 -> 0.18.3.
- Jellyfin 10.11.11 -> 12.4, Radarr 6.1 -> 7.0.3 and Sonarr
  4.0.17 -> 5.0.0 (a prerelease), each migrating its database.
- HedgeDoc 1.11.1 -> 1.12.0, mautrix-whatsapp 26.08 -> 26.11,
  Vaultwarden 1.37.1 -> 1.37.5, Seerr 3.3.0 -> 3.5.2.
- Headscale 0.29.3 -> 0.29.7, BIRD 2.19.2 -> 2.20.0 and Tuwunel
  1.8.3 -> 1.9.4.
- nginx 1.30.7 and 1.31.9 from the channels, with the NGINX2Root
  fixes.
- `determinate-nix` 3.22.2 -> 3.24.3, `harmonia` 3.2.0 -> 3.3.0,
  `deploy-rs` 1.0.0, `copyparty` 1.20.21 -> 1.20.26, and `llm-agents`
  with Codex 0.170.0 and Claude Code 2.1.330.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:11:44 +00:00
jackos1998andClaude Opus 5.5 a3d4918095 docs/nixpkgs: Expand the upgrade procedure
Add the review and bookkeeping the last upgrade needed:

- Keep a progress document in the workspace, out of the upgrade's
  commits, and delete it at wrap-up after moving open follow-ups to
  TODOs, box pages or commit messages.
- Check the published stable release rather than the newest release
  branch, and fetch the upstream branches explicitly.
- Verify requested backports on each rebase base and compare both
  fork patch stacks with `git range-diff` before pushing.
- Review the apps and services each channel supplies, and every
  direct flake input, for removals, migrations and breaking changes.
- Present channel moves and migrations as choices, and mark any
  temporary pin with a TODO naming its exit condition.
- Commit the refresh apart from procedure changes and service
  migrations, and list notable version upgrades in its description.

Default the fork checkout to `../nixpkgs` and update the
`upgrade-nixpkgs` skill to match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:42:08 +00:00
jackos1998 f5ef9031a6 home-manager/gui: Keep screenshots on clipboard
CI / Check, build and cache nixfiles (push) Successful in 47m40s
Update docs / update (push) Successful in 1m18s
Use `wl-copy` for Satty copies so screenshots remain available after
closing the editor.
2026-11-22 12:42:08 +00:00
jackos1998 b5be218f14 nixos/common: Block SCTP kernel module loading
CI / Check, build and cache nixfiles (push) Successful in 52m10s
Update docs / update (push) Successful in 58s
2026-11-19 00:26:50 +00:00
jackos1998andClaude Opus 5.5 01c8261de9 nixos: Bump nginx for NGINX2Root fixes
Override `nginxStable` and `nginxMainline` to 1.30.7 and 1.31.9 until
the pinned channels ship them. OpenResty has no fixed release yet, so
disable HTTP/2 on `spoder`'s vhosts in the meantime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 00:26:50 +00:00
github-actions[bot] 3370823ed5 docs: Update generated references 2026-11-18 22:51:24 +00:00
jackos1998andClaude Opus 5.5 a6491c7535 nixos/slop-cannon: Move to a VM on palace
CI / Check, build and cache nixfiles (push) Successful in 45m39s
Update docs / update (push) Successful in 1m0s
Give agents their own kernel, Nix daemon and disk for workloads that
need root. Put the VM on the `untrusted` VLAN with MAC spoof
checking on VF 5.

Export a dedicated partition from `cellar` and connect it on
`palace`. Give the VM its own SSH host key and age secrets for Paseo
and Gitea. Keep the agent home and Paseo identity on persistent
storage and provide `slop-pair` for pairing clients.

Retire the container, restore `sfh` to 8 cores and 32 GiB, and rekey
the shared password secret. Document the VM and its operating
procedures on the relevant box pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:02:14 +00:00
jackos1998andClaude Opus 5.5 5058dec3f1 nixos/cellar: Keep spdk-tgt running on deploy
Restarting `spdk-tgt` takes every NVMe-oF root disk away (river,
castle, sfh), so don't do it on deploy.

`spdk-debug` repeated the RAID definition by hand. Generate its config
from the real one instead (no examine, no exports, ublk disks from
`my.spdk.debug.ublkDisks`), so it can't drift and runs without a
terminal. Document adding a partition export with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:01:54 +00:00
jackos1998andClaude Opus 5.5 5fb8e8d280 nixos/home: Keep untrusted to the Internet
The routers reject new connections from the `untrusted` VLAN to
internal destinations before the firewall's ICMP rules, then allow
Internet transit via `wan` and `as211024`. The shared
`lib.my.c.internalNets` also covers the modem's management subnet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 22:01:54 +00:00
jackos1998 89cc4b679c nixos/sfh: Start Home Assistant without the webcam
An absent webcam made the nspawn bind mount fail before Home
Assistant could start. Give the container an always-present
directory and bind the video device into it when it is available.
Point go2rtc at the device in that directory.
2026-11-18 22:01:54 +00:00
jackos1998 4307939aab devshell: Fix ssh-machine caching in jj workspaces
CI / Check, build and cache nixfiles (push) Successful in 48m33s
Update docs / update (push) Successful in 1m15s
2026-11-18 21:08:24 +00:00
github-actions[bot] fc92ff9ba1 docs: Update generated references 2026-11-17 13:40:06 +00:00
jackos1998 15e12613fb nixos/estuary: Update LUJE and NL-ix peering
CI / Check, build and cache nixfiles (push) Successful in 51m18s
Update docs / update (push) Successful in 1m18s
Replace the ColoClue LUJE sessions with IPv6 peering on Clue-IX.
Add IPv4 and IPv6 LUJE sessions on NL-ix.

Share the lower NL-ix peer preference through dedicated templates,
including Meta alongside the other NL-ix direct peers.
2026-11-17 12:47:15 +00:00
jackos1998 c1242b12ed nixos/estuary: Add Clue-IX IPv6 peering
Attach `clue-ix` VLAN 121 directly to `wan` with the assigned IPv6
address. Add sessions to both AS218511 route servers using `rs_client`
roles and mandatory GTSM, following the existing IXP policy.

Include the interface in the direct protocol and IXP firewall set,
and document the VLAN and peers. Omit IPv4 peering because no address
was assigned.
2026-11-17 12:47:15 +00:00
github-actions[bot] 4b78cbe841 docs: Update generated references 2026-11-16 02:28:39 +00:00
jackos1998 1f4d058ba4 nixos/slop-cannon: Fix Codex procfs fallback
Update docs / update (push) Successful in 1m0s
CI / Check, build and cache nixfiles (push) Successful in 48m35s
Restore the bubblewrap diagnostic expected by Codex so its existing
container fallback handles nspawn procfs restrictions.

Verified workspace writes succeed and outside writes are denied.
`check-system slop-cannon` passes.
2026-11-16 01:01:18 +00:00
jackos1998andClaude Opus 5.5 9c508caeb5 nixos/palace: Grow sfh VM for slop-cannon
CI / Check, build and cache nixfiles (push) Successful in 55m9s
Update docs / update (push) Failing after 1m10s
Give `sfh` 16 cores x 2 threads (overcommitted) and 96 GiB, so the
coding agents in `slop-cannon` have room alongside `hass` and `unifi`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 00:39:48 +00:00
jackos1998andClaude Opus 5.5 b0a7f3cd89 nixos/middleman: Serve Paseo web app ourselves
Serve the web app from the Paseo package on `paseo.nul.ie` and point
the daemon's pairing links there, so browsers no longer load Paseo's
hosted app. It connects through our relay, so the daemon stays on
loopback.

Move the patched Paseo package into the shared overlay so `middleman`
and `slop-cannon` use the same build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 00:39:48 +00:00
jackos1998andClaude Opus 5.5 a62b8351fa nixos/sfh: Add slop-cannon container for agents
A container on `sfh` for coding agents driven remotely through Paseo,
using our relay on `middleman`. Agents run as the unprivileged
`slop-cannon` user; Claude managed settings disable bypass mode and
deny raw deploy and `ssh-machine` access.

Move the Claude Code and Codex configuration out of `gui` into a
shared `my.agents` home-manager module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 00:39:48 +00:00
jackos1998andClaude Opus 5.5 5af71ea231 nixos/middleman: Add self-hosted Paseo relay
Package paseo-relay and add a small `my.paseo-relay` module running it
as a single node without Erlang distribution. Publish it on
`paseo-relay.nul.ie` so Paseo daemons and the app can use our own
relay instead of the hosted one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 23:48:19 +00:00
jackos1998andClaude Opus 5.5 f567a43bc0 nixos/common: Disable bootvine in containers
Update docs / update (push) Successful in 1m6s
CI / Check, build and cache nixfiles (push) Successful in 43m36s
bootvine attaches to a console TTY, which nspawn containers do not
have, so the unit fails and leaves containers degraded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 19:49:56 +00:00
github-actions[bot] 3f63cf5938 docs: Update generated references 2026-11-15 17:16:18 +00:00
jackos1998 314be7620f nixos/home: Gate DDNS updates on WAN readiness
Update docs / update (push) Successful in 1m0s
CI / Check, build and cache nixfiles (push) Successful in 47m46s
Start updates when the WAN gate opens and skip timer runs while it
is inactive. Keep periodic retries and wait for the local DNS services.
2026-11-15 16:23:06 +00:00
jackos1998 a04d11423a nixos/home: Separate router storage and uplinks
Give `river` a dedicated RDMA VF and two RSTP trunk attachments.
Keep client services on the router VIPs and carry Digiweb VLANs
over both switch paths.

Set VF trust, multicast reception, bridge MAC and ARP behavior for
local switching. Wait for Kea interface readiness and apply RSTP
costs through `mstpd` despite port-registration and rename races.

Load `palace`'s RAID module in the initrd. Record RouterOS and
RouterBOOT upgrades and validate port, carrier and switch outages.

Document the deployed architecture, interface handoffs and recovery
procedures. Add physical socket maps, NIC capacities and cable
connections alongside the logical topology and failover checks.
2026-11-15 16:23:06 +00:00
jackos1998 b02948d826 nixos/spdk: Handle released DPDK 26.03
Use the supported PCI layout for released DPDK 26.03, matching the
upstream fix in SPDK 26.05. Otherwise SPDK 26.01 selects an older
layout and crashes during PCI scanning.
2026-11-15 16:23:06 +00:00
jackos1998 08c0ebf9e8 nixos/whale2: Add Quad to Valheim whitelist
Update docs / update (push) Canceled after 0s
CI / Check, build and cache nixfiles (push) Canceled after 17m0s
2026-11-15 16:08:48 +00:00
jackos1998andClaude Opus 5.5 60324c5ff5 devshell: Add docs Markdown previewer
Update docs / update (push) Canceled after 0s
CI / Check, build and cache nixfiles (push) Canceled after 2m48s
Wraps `go-grip` to preview docs in the browser before pushing,
rendered locally with live reload. Defaults to `docs/README.md`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:27:37 +00:00
jackos1998andClaude Opus 5.5 2606d0e4ae home-manager/gui: Update Claude status line to v1.4.5
Upstream v1.4.5 moves the effort level into parentheses after the
model name.

Also read the CLI version from the `version` field Claude Code passes
on stdin instead of caching `claude --version` for an hour, which kept
showing the old version after an upgrade. `claude --version` remains
as an uncached fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:21:48 +00:00
jackos1998 991ca5ee2a home-manager/gui: Pull Claude from llm-agents
CI / Check, build and cache nixfiles (push) Canceled after 0s
Update docs / update (push) Canceled after 0s
2026-11-15 15:12:38 +00:00
jackos1998 b1b27b5bc3 nixos: Enable bootvine everywhere
Update docs / update (push) Canceled after 0s
CI / Check, build and cache nixfiles (push) Successful in 47m21s
2026-11-15 14:04:08 +00:00
jackos1998 b705b66bfc devshell: Replace deploy-multi with --targets
CI / Check, build and cache nixfiles (push) Successful in 42m1s
Update docs / update (push) Failing after 1m7s
2026-11-15 13:57:04 +00:00
jackos1998 93ac20e053 devshell: Cache SSH connection settings
Cache all deploy node connection settings and invalidate them when
HEAD or tracked working-tree contents change. Preserve SSH argument
boundaries and support explicit refreshes.
2026-11-15 13:52:52 +00:00
jackos1998 99f105ed5f Update llm-agents
CI / Check, build and cache nixfiles (push) Successful in 53m55s
Update docs / update (push) Failing after 2m24s
2026-11-15 13:11:13 +00:00
jackos1998 d8cd889e1d nixos/gui: Add bootvine 2026-11-15 13:05:13 +00:00
jackos1998 198b172186 Update llm-agents
CI / Check, build and cache nixfiles (push) Successful in 48m59s
Update docs / update (push) Successful in 1m11s
2026-10-31 15:22:46 +00:00
jackos1998 4281aa9234 nix: Add Numtide binary cache for llm-agents
Configure the Numtide substituter and signing key in the shared cache
settings and flake configuration so Codex can use prebuilt binaries.
Document the cache and retain the input’s tested nixpkgs pin.
2026-10-31 15:21:26 +00:00
jackos1998 20ac77d8a0 devshell: Accept flake config in build-n-switch
Pass `--accept-flake-config` explicitly because `doas` drops the
devshell configuration that enables it. This avoids prompts for the
flake’s binary cache settings when rebuilding as root.
2026-10-31 15:19:14 +00:00
jackos1998 967faad269 home-manager/gui: Switch from swappy to satty for screenshots
CI / Check, build and cache nixfiles (push) Successful in 47m47s
Update docs / update (push) Successful in 1m14s
2026-10-30 12:16:16 +00:00
jackos1998 ebedb6b494 Update llm-agents
CI / Check, build and cache nixfiles (push) Successful in 1h24m33s
Update docs / update (push) Successful in 1m1s
2026-10-29 21:45:49 +00:00
jackos1998 cbe54f7523 home/gui: Guard newer Codex settings option
CI / Check, build and cache nixfiles (push) Successful in 2h42m49s
Update docs / update (push) Successful in 1m20s
Only set `programs.codex.mutableSettings` when Home Manager exposes it.
This fixes evaluation on 26.05, including boxes with the GUI disabled.
Record the removal TODO and guidance for future compatibility guards.
2026-10-19 17:14:21 +01:00
jackos1998 46008cb25a common: Add python3 to system and home packages
Update docs / update (push) Successful in 1m12s
CI / Check, build and cache nixfiles (push) Failing after 12m25s
2026-10-18 18:25:45 +01:00
jackos1998 5edb5e8ff6 Update llm-agents and allow Codex access to network 2026-10-18 18:16:52 +01:00
jackos1998 ee6b34dbd7 home-manager: Share Git and Jujutsu configuration
Update docs / update (push) Successful in 51s
CI / Check, build and cache nixfiles (push) Failing after 17m56s
Move Git, Git LFS and `diff-so-fancy` into the common home module.
Enable Jujutsu with the same identity and add it to the devshell.

Document `jj` workflows and prefer them in Jujutsu workspaces.
2026-10-03 22:16:42 +01:00
jackos1998 e7ec6740f1 home-manager/gui: Manage Codex with mutable settings
Pin Codex independently through `llm-agents.nix` and update unstable
home-manager for `programs.codex.mutableSettings`.

Declare the status line, including both usage windows, while preserving
imperative settings during activation.
2026-10-03 22:11:19 +01:00
jackos1998 73e538ad1f nixos/whale2: Refresh Valheim server and world
CI / Check, build and cache nixfiles (push) Successful in 55m5s
Update docs / update (push) Successful in 1m10s
Pin the community image and start simpland3 while retaining
simpland2. Correct the server-files volume name and reuse the
admin ID in both access lists.
2026-09-20 21:23:01 +01:00
github-actions[bot] 9e9027a250 docs: Update generated references 2026-08-25 19:59:15 +00:00
jackos1998 b904922356 ci/docs: Fix repository URL for push
CI / Check, build and cache nixfiles (push) Has been cancelled
Update docs / update (push) Successful in 1m4s
2026-08-25 20:57:26 +01:00
jackos1998 02c965dd96 ci/cache: Keep collection in preflight
CI / Check, build and cache nixfiles (push) Successful in 47m34s
Update docs / update (push) Failing after 1m4s
Group cache collection separately in the Actions log and avoid repeating
it after updating the CI profile.
2026-08-25 08:58:57 +01:00
jackos1998 adea4bd9e5 ci/cache: Prune profile generations
Update docs / update (push) Failing after 1m5s
CI / Check, build and cache nixfiles (push) Failing after 3h5m51s
Explicitly remove expired generations from the nonstandard Harmonia
profile before collecting garbage. This keeps old CI closures from
remaining rooted until the cache exhausts its inodes.
2026-08-25 08:46:45 +01:00
jackos1998 e875971237 nixos/hass: Use packaged pyirishrail
CI / Check, build and cache nixfiles (push) Failing after 29m48s
Update docs / update (push) Failing after 1m9s
Fix pyirishrail metadata in the nixpkgs fork, update the mine pin,
and remove the local package now supplied by the Home Assistant
component.
2026-08-25 00:12:01 +01:00
jackos1998 1a9c601c2b ci/cache: Collect garbage before pushes
Update docs / update (push) Failing after 1m3s
CI / Check, build and cache nixfiles (push) Failing after 26m9s
Run retention cleanup before uploading build results so inode
exhaustion cannot prevent CI from reaching its only garbage-collection
step.
2026-08-24 22:57:10 +01:00
jackos1998 92855606a4 pkgs/firefox-memory-control: React to swap-outs
CI / Check, build and cache nixfiles (push) Failing after 20m49s
Update docs / update (push) Failing after 1m9s
Firefox can exhaust swap while `MemAvailable` remains above the unload threshold. Track new `pswpout` pages so active swapping triggers tab unloading without treating stale swap occupancy as permanent pressure.
2026-08-24 15:19:23 +01:00
jackos1998 5171a10079 nixpkgs: Refresh channels and inputs
CI / Check, build and cache nixfiles (push) Failing after 59m32s
Update docs / update (push) Failing after 1m12s
Rebase the fork branches and refresh nixpkgs, home-manager, and the
approved ancillary inputs. Update kernel and release metadata, adapt
removed package and Home Assistant options, and keep Determinate Nix
on its tested nixpkgs revision to avoid duplicate Boost patches.

Retire Sharry and its public endpoint because copyparty replaces it.
Document the GitHub mirror gate and require real devshell and system
builds in the upgrade validation workflow.
2026-08-24 00:10:18 +01:00
jackos1998 e93e9f7a08 openwrt: Pin vendored feed indexes
Update docs / update (push) Failing after 1m12s
CI / Check, build and cache nixfiles (push) Successful in 58m0s
Pin `openwrt-feeds` to repository state that includes vendored APK
indexes, keeping image builds independent of mutable upstream indexes.

Document the corresponding refresh workflow.
2026-08-23 23:08:41 +01:00
jackos1998 5e036d17c4 docs/nixpkgs: Expand upgrade workflow
Move the skill to the shared agent location while retaining Claude
compatibility. Document kernel refreshes and the release metadata
policy as part of each upgrade, and make commit-message wrapping
explicit and verifiable.
2026-08-23 21:44:07 +01:00
jackos1998 57b94b64bb openwrt: Keep SFP LuCI app snapshot-only
CI / Check, build and cache nixfiles (push) Failing after 7m19s
Update docs / update (push) Failing after 1m13s
2026-08-23 21:27:32 +01:00
jackos1998andClaude Opus 5 bf411e03e2 nixos/portcullis: Tune NICs, IOMMU and EEE
Router-sized 4096-entry rings on every port with GRO kept across
forwarding, the IOMMU in passthrough mode, and EEE pinned off on the
I226-V ports as one trigger for their link-drop erratum. The ring and
GRO settings are .link files, so they land on a device add event rather
than at switch time.

Also document the tuning deliberately not done -- coalescing and PCIe
ASPM -- and what measuring the NICs' ESP offload found, since the
esp4_offload modules are software batching and easy to mistake for it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-23 10:54:22 +01:00
jackos1998andClaude Opus 5 81b7ca9d05 nixos/l2mesh: Load the ESP offload modules
CI / Check, build and cache nixfiles (push) Failing after 6m55s
Update docs / update (push) Failing after 1m11s
esp4_offload/esp6_offload provide GSO/GRO batching for ESP and are not
autoloaded when an SA is created, costing around a third of the mesh's
encrypted throughput. Load the one matching each secured mesh's
underlay family.

Also document the per-SA single-core limit and pcrypt as an option.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-22 14:09:23 +01:00
jackos1998andClaude Opus 5 dd0b318a44 nixos/castle: Set lan-lo to the standard MTU
lan-lo is a VLAN on et100g, which carries hi's jumbo frames, so it
inherited 9000 rather than the 1500 the lo VLAN runs at. MSS clamping
hid this from TCP; UDP without working PMTUD was silently dropped.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-22 14:09:01 +01:00
jackos1998andClaude Opus 5 d24d71113f docs: Clarify what a logically distinct commit is
CI / Check, build and cache nixfiles (push) Failing after 6m50s
Update docs / update (push) Failing after 1m7s
"Keep logically distinct changes in separate commits" was being read as
split anything separable, which turns one piece of work into several
commits that only make sense read together.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-22 01:34:15 +01:00
jackos1998andClaude Opus 5 87cdfdbd97 nixos/portcullis: Bring up 10G on the home hi VLAN
portcullis is wired over 10G to fergal, which uplinks to jim's spare
SFP+ port. That uplink is untagged VLAN 1, so hi is carried tagged on a
lan-hi VLAN interface: a static assignment at 192.168.68.41 / ::6:1,
resolving through the router VIPs like any other hi client. Its gateway
route outranks the DHCP default, making 10G the preferred path while the
2.5G bootstrap stays as a fallback. Deploy now targets that address.

The hi MTU goes on the .network rather than the .link, since a .link is
only applied at udev device-add -- with it there, et10g-0 stays at 1500
across a switch and lan-hi cannot take 9000.

jim's sfp-spare was tagged into hi and lo out of band to match.

fergal turns out to belong with portcullis rather than to the home
fabric -- it goes to Nikhef when the box does -- so its documentation
moves to the colony site, leaving home/switches.md a short section on
what it borrows from that fabric.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-22 01:30:50 +01:00
jackos1998andClaude Opus 5 7bebac194c docs: Note commit trailer and body conventions
Co-Authored-By is the only trailer wanted here; session links are not.
Also spell out that bodies should stay concise.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-22 01:17:11 +01:00
jackos1998andClaude Opus 5 cdc5d9c1db openwrt: Build fergal's firmware in the flake
fergal is an 8-port SFP+ switch on a Realtek RTL9303, running OpenWrt
rather than RouterOS or UniFi. It is not part of the fabric yet, but
its firmware is now built here via astro's nix-openwrt-imagebuilder.
Packages are baked into the image: OpenWrt's package server keeps only
the current build of each feed, so installing at runtime stops working
as soon as the feed moves past the running firmware.

Those feed indexes rotate constantly, and upstream pins only the
indexes -- a mismatch drops evaluation into import-from-derivation,
putting this flake's eval on the network. The openwrt-feeds input pins
expanded per-package hashes instead, in a repository of its own
because they run to hundreds of thousands of generated lines.

Flashing gets a procedure doc and a thin skill pointing at it, the
same split as the box installation and nixpkgs upgrade procedures.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-22 01:16:53 +01:00
jackos1998andClaude Opus 5 e7122b8862 docs: Add box installation procedure
CI / Check, build and cache nixfiles (push) Successful in 56m36s
Update docs / update (push) Successful in 1m11s
Canonical, agent-agnostic procedure for bringing a new box into the
flake, from a booted installer through to a deployable system, plus a
thin Claude Code skill pointing at it -- same split as the nixpkgs
upgrade procedure.

Records the conventions that were not written down anywhere: sgdisk
plus an LVM PV for the nix and persist volumes, adopting the
installer's SSH host keys so secrets can be encrypted before first
boot, and taking whatever show-hw-config emits that the flake's own
modules do not already set.

Also notes in AGENTS.md that a changed recipient list should be
re-encrypted per file with ragenix --rekey-one; --rekey rewrites every
secret in secrets/ and buries the actual change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 01:30:59 +01:00
jackos1998andClaude Opus 5 0aade09d7e nixos/portcullis: Add initial config
New bare-metal box headed for Nikhef, intended to take over most of
estuary's colony edge routing. This is the bootstrap config only: the
hardware, the single-NVMe ESP + LVM layout, and enough networking to
boot and be reachable.

It is being staged at home before it is racked, so it has no colony
assignments yet. Every 2.5G port takes DHCP and whichever one is
patched in brings the box up; kea registers the DHCP hostname, so the
deploy node points at portcullis.dyn.h.nul.ie until there is a real
colony FQDN for it.

The host key was adopted from the installer session and seeded onto
the persist volume before first boot, so my.secrets.key could be set
up front -- which makes portcullis a recipient of the user-passwd
secret that my.user declares for every box.

Documented with a box page, a row in the colony site index, and a note
in the colony section of networking.md that the topology is expected
to change once portcullis takes over from estuary.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 01:30:59 +01:00
208 changed files with 8900 additions and 2397 deletions

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
---
name: flash-openwrt
description: >-
Flash a flake-built OpenWrt image onto one of the OpenWrt boxes (currently fergal): build the
image, pre-flight the box, back up its config, validate and stage the image, run sysupgrade, and
verify what came back. Use when the user wants to flash, reflash, upgrade or sysupgrade an OpenWrt
box, or after changing its baked-in package list.
---
# Flash an OpenWrt box
The canonical, agent-agnostic procedure lives in the repo at
[`docs/openwrt-flash.md`](../../../docs/openwrt-flash.md). Read it and follow the phases in order.
Key reminders (see the doc for the full steps):
- **Stop at the ⏸ before Phase 5.** Flashing reboots the box and cannot be interrupted partway.
Confirm with the user, and confirm a serial console is reachable, *before* writing anything.
- **Packages are baked into the image**, so a package change means a reflash. Edit the box's list in
[`openwrt/default.nix`](../../../openwrt/default.nix), rebuild, and check the built `.manifest` —
a package name that doesn't exist is not a build error, it just isn't in the image.
- **`scp` does not work** on these boxes (no `sftp-server`). Move files with
`ssh <box> 'cat > /dev/…' < file` and `ssh <box> 'cat …' > file`.
- **Detach the upgrade with `setsid`**, not `nohup` (absent on busybox). `sysupgrade` kills the SSH
session mid-run, and an attached run dies with it — possibly after the firmware is erased.
- **Never reach for `sysupgrade -c`.** It needs `/overlay/upper/etc` and aborts *after* erasing the
firmware when that is missing, which is exactly the initramfs case. Plain `sysupgrade` already
keeps everything in `/lib/upgrade/keep.d/`.
- **Poll SSH to detect the reboot, never ping.** Successful pings return in milliseconds, so a
"wait for down" loop completes instantly and reports nonsense. Sleep between probes; expect about
three minutes.
- **Verify after**, don't assume: revision, management address, package count against the manifest,
and that the new packages are present and running.
The images are declared in [`openwrt/default.nix`](../../../openwrt/default.nix); background on the
outputs and the pinned package feeds is in
[`docs/deployment.md`](../../../docs/deployment.md#openwrt-images).
+40
View File
@@ -0,0 +1,40 @@
---
name: install-box
description: >-
Install a new NixOS box into this flake, from bare hardware booted into the custom installer
through to a deployable system: probe the hardware, partition and format the disks, write the box
config and flake entry, run do-install, and document the box. Use when the user wants to install,
bootstrap, provision or add a new box/host/machine.
---
# Install a box
The canonical, agent-agnostic procedure lives in the repo at
[`docs/install-box.md`](../../../docs/install-box.md). Read it and follow the phases in order.
Key reminders (see the doc for the full steps):
- It is **guided, not automated** — stop at the ⏸ points: settling what the box actually is
(Phase 1), wiping and partitioning disks (Phase 3), and running `do-install` (Phase 6). The user
often wants to do the install step by hand.
- **Phase 1 is not derivable from the hardware.** Name, site, role, channel and whether the box gets
assignments now all have to come from the user. Ask before writing files.
- **`show-hw-config` is a shell alias**, so it needs `installer-shell bash -lic show-hw-config`.
Run it twice: once early for the kernel-module lists, once after mounting for the filesystems.
- **`git add` the new box directory before evaluating** — the flake reads through git, and an
untracked path fails as "Path … is not tracked by Git" rather than as a Nix error.
- **Validate with `check-system <host>`**, not `build-system` — evaluation catches module and option
errors cheaply.
- **Seed the SSH host key from the installer** (Phase 3) by copying `/etc/ssh/ssh_host_*` onto the
persist volume. The installer regenerates them each boot, so they are safe to adopt, and it means
`my.secrets.key` can be set and secrets encrypted before the install rather than after first boot.
- **Every box declares a secret even when its own config declares none** — `my.user` pulls in
`user-passwd.txt` by default — so setting `my.secrets.key` always requires
`ragenix --rekey-one secrets/user-passwd.txt.age`. Check with
`nix eval .#nixosConfigurations.<host>.config.age.secrets --apply builtins.attrNames` rather than
assuming there is nothing to do. Re-encrypt selectively; `ragenix --rekey` rewrites every secret
in `secrets/` and drowns the real change in churn.
- Take **everything** useful out of `show-hw-config`, not just the modules and filesystems — drop an
option only when a nixfiles module already sets it.
- Finish with Phase 8: box page, site index row, `networking.md` prose. Don't hand-edit anything
between `<!-- ... -->` markers.
+51
View File
@@ -0,0 +1,51 @@
---
name: upgrade-nixpkgs
description: >-
Upgrade all four nixpkgs channels (unstable, stable, mine, mine-stable) and home-manager for this
flake: check for a NixOS stable bump, rebase the devplayer0 nixpkgs fork, update kernel and
release metadata, refresh pins, sweep version-gated TODOs, and review compatibility of nixpkgs
apps and services and other flake inputs. Use when the user wants to update/bump nixpkgs,
refresh the pins, or do the periodic nixpkgs/home-manager upgrade.
---
# Upgrade nixpkgs
Read [`docs/nixpkgs-upgrade.md`](../../../docs/nixpkgs-upgrade.md), the canonical procedure, and
follow its phases in order.
Key reminders (see the doc for the full steps):
- Read and update the progress document, `docs/nixpkgs-upgrade-progress.md`, as you work.
On resume, reconcile it with the working copy and remote refs. Record what was reviewed,
what was approved, the reason and exit condition for each workaround, and the next open step.
Keep it out of the upgrade's commits. At wrap-up, move open follow-ups to TODOs, box pages or
commit messages, then delete it.
- Commit the pin and input refresh separately from procedure changes and from each service
migration, and list the notable version upgrades in the refresh's description.
- It is **guided, not automated** — do the mechanical and investigative work but stop at the ⏸
points: pushing the fork, resolving rebase conflicts, applying a stable-channel bump, choosing a
new release codename, deleting version guards, and choosing how to handle service compatibility
blockers. Present channel moves and migrations as choices before making either change.
If a temporary pin is chosen, add a TODO for the deferred migration.
- **Check the current NixOS stable first** (Phase 1) — the fork's `devplayer0-stable` rebase target
and the `flake.nix` stable pins must agree on one release.
- Use `../nixpkgs` relative to this flake's root as the default checkout of the
`devplayer0/nixpkgs` fork.
- **Fetch the upstream branches explicitly** and re-verify the fork patch stack with `git log`.
Check for requested backports on each rebase base before cherry-picking them.
Compare both patch stacks with `git range-diff` and summarize the changes before asking to push.
- After pushing the rebased fork branches, **wait for the GitHub mirror to catch up** before
refreshing flake pins. The `nixpkgs-mine*` inputs fetch from GitHub, not the fork's primary
remote; verify both GitHub branch tips match the pushed local tips first.
- After refreshing the pins, update `lib/constants.nix` to the current explicit LTS and latest
kernel package attributes, and update the `lib/default.nix` version overlay's `YY.MM` prefix to
the current month. Change its codename only when the stable channel advances.
- Review the apps and services supplied by each nixpkgs channel in use (Phase 3). Compare the old
and candidate versions and module options, and check release notes for removals, changed defaults,
compatibility with persisted data, and migrations that evaluation may miss.
- Compare each direct flake input's pin with its candidate for fixes and breaking changes.
Include the refreshes in the main upgrade. Ask before changing the release track, moving an
intentional compatibility pin, or deferring an update that needs a migration.
- After the cheap evaluations pass, build the actual devshell and one representative NixOS system
(prefer the local box). `nix flake check --no-build` does not expose dependency build failures;
this is especially important when updating build-tool inputs such as Determinate Nix.
+1
View File
@@ -0,0 +1 @@
../.agents/skills
-25
View File
@@ -1,25 +0,0 @@
---
name: upgrade-nixpkgs
description: >-
Upgrade all four nixpkgs channels (unstable, stable, mine, mine-stable) and home-manager for this
flake: check for a NixOS stable bump, rebase the devplayer0 nixpkgs fork against upstream, run the
update commands, sweep version-gated TODOs, and review flake inputs. Use when the user wants to
update/bump nixpkgs, refresh the pins, or do the periodic nixpkgs/home-manager upgrade.
---
# Upgrade nixpkgs
The canonical, agent-agnostic procedure lives in the repo at
[`docs/nixpkgs-upgrade.md`](../../../docs/nixpkgs-upgrade.md). Read it and follow the phases in
order.
Key reminders (see the doc for the full steps):
- It is **guided, not automated** — do the mechanical/investigative work but stop at the ⏸ points:
pushing the fork, resolving rebase conflicts, editing the `flake.nix` stable pins, and deleting
version guards. Report and let the user decide.
- **Check the current NixOS stable first** (Phase 1) — the fork's `devplayer0-stable` rebase target
and the `flake.nix` stable pins must agree on one release.
- **Re-verify the patch stack against freshly fetched upstream**, not stale refs — enumerate it with
`git log`, don't assume a remembered list (stale `upstream/*` refs make already-upstreamed commits
masquerade as fork-only patches).
+1 -1
View File
@@ -1,4 +1,4 @@
watch_file devshell/{default,commands,install,vm-tasks}.nix
watch_file devshell/*
# --accept-flake-config trusts the flake's nixConfig (our Harmonia cache) non-interactively, so
# direnv doesn't stall on the trust prompt.
use flake . --accept-flake-config
+20 -15
View File
@@ -4,6 +4,11 @@ on:
push:
branches: [master]
# Only the newest commit is worth building and caching
concurrency:
group: ci
cancel-in-progress: true
jobs:
check:
name: Check, build and cache nixfiles
@@ -30,23 +35,23 @@ jobs:
extra-trusted-public-keys = nix-cache.nul.ie-1:BzH5yMfF4HbzY1C977XzOxoPhEc9Zbu39ftPkUbH+m4=
- name: Check flake
run: nix flake check --no-build
id: ifd
run: |
reasons="$(nix eval --option allow-import-from-derivation false --json .#ciIfdReasons.x86_64-linux)"
required="$(jq -r 'length > 0' <<< "$reasons")"
echo "required=$required" >> "$GITHUB_OUTPUT"
if [[ "$required" == true ]]; then
jq -r '.[] | "::warning::\(.). The flake check will run after the target builds."' <<< "$reasons"
else
nix flake check --no-build --option allow-import-from-derivation false
fi
- name: Build (and cache) the world
id: build
env:
HARMONIA_SSH_KEY: ${{ secrets.HARMONIA_SSH_KEY }}
run: |
nix eval --json --apply "builtins.attrNames" .#ci.x86_64-linux | jq -cr '.[]' | while read job; do
echo "::group::Build $job"
nix build --no-link .#ci.x86_64-linux."$job"
echo "::endgroup::"
echo "::group::Cache $job"
ci/push-to-cache.sh "$(nix eval --raw .#ci.x86_64-linux."$job")"
echo "::endgroup::"
done
echo "Building and caching CI derivation"
nix build --no-link .#ciDrv.x86_64-linux
UPDATE_PROFILE=1 ci/push-to-cache.sh "$(nix eval --raw .#ciDrv.x86_64-linux)"
CI_IFD_REQUIRED: ${{ steps.ifd.outputs.required }}
run: >-
nix shell .#nixpkgs.unstable.x86_64-linux.python3 .#nixpkgs.unstable.x86_64-linux.nix-eval-jobs
--command python3 ci/build-and-cache.py
+47
View File
@@ -0,0 +1,47 @@
name: Build llm-agents
on:
pull_request:
branches: [master]
types: [opened, synchronize, reopened]
workflow_dispatch:
jobs:
build:
# Only the update branch, whether dispatched by the updater or pushed by hand
if: >-
(github.event_name == 'workflow_dispatch' &&
github.ref == 'refs/heads/automation/llm-agents') ||
(github.event.pull_request.head.repo.full_name == github.repository &&
github.event.pull_request.head.ref == 'automation/llm-agents')
runs-on: ubuntu-26.04
permissions:
contents: read
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: DeterminateSystems/determinate-nix-action@v3
with:
github-token: ${{ secrets.GH_PULL_TOKEN }}
extra-conf: |
sandbox-fallback = false
lazy-trees = true
eval-cores = 0
- name: Build installed agent packages
shell: bash
run: |
attrs="$(nix eval --accept-flake-config --no-update-lock-file --raw \
.#llmAgentPackages.x86_64-linux \
--apply 'packages: builtins.concatStringsSep "\n" (builtins.attrNames packages)')"
if [[ -n "$attrs" ]]; then
mapfile -t packages <<< "$attrs"
nix build --accept-flake-config --no-update-lock-file --no-link \
"${packages[@]/#/.#llmAgentPackages.x86_64-linux.}"
fi
+1 -1
View File
@@ -39,10 +39,10 @@ jobs:
- name: Commit and push if changed
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
REPO_URL: ${{ gitea.repositoryUrl }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
REPO_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}"
git remote set-url origin "${REPO_URL/https:\/\//https:\/\/oauth2:${GITEA_TOKEN}@}"
git add docs/
if ! git diff --cached --quiet; then
+36
View File
@@ -0,0 +1,36 @@
name: Update llm-agents
on:
schedule:
- cron: '19 */4 * * *'
workflow_dispatch:
concurrency:
group: update-llm-agents
jobs:
update:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-26.04
permissions:
contents: write
pull-requests: write
actions: write
steps:
- uses: actions/checkout@v6
with:
ref: master
persist-credentials: false
- uses: DeterminateSystems/determinate-nix-action@v3
with:
github-token: ${{ secrets.GH_PULL_TOKEN }}
- name: Update the dependency PR
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: >-
nix shell --accept-flake-config .#nixpkgs.unstable.x86_64-linux.python3
--command python3 ci/update-llm-agents.py
+2
View File
@@ -1,7 +1,9 @@
.direnv
/.cache
result*
/.vms/*
!/.vms/.gitkeep
/.keys/*.key
*.swp
__pycache__/
/.claude/settings.local.json
+1
View File
@@ -0,0 +1 @@
age1f7vpehgfe3043y76kvmqnhs9h98gga3wangqv6hjfaqxjnac855sl23j6p
+90 -18
View File
@@ -20,6 +20,9 @@ committed allow list of safe-to-auto-approve commands) and `.claude/settings.loc
gitignored — where interactive "always allow" grants accumulate). Put durable, generally-safe
commands in the shared file; leave one-off or workstation-specific grants in the local one.
Project skills live under `.agents/skills/`. Claude Code discovers them through the
`.claude/skills` symlink.
## Overview
Personal Nix flake managing NixOS systems and home-manager configurations for a set of
@@ -35,14 +38,16 @@ see its help, or browse `devshell/commands.nix` / `devshell/install.nix` / `devs
Common ones:
- `fmt` — format Nix with `nixpkgs-fmt` (the canonical formatter here).
- `build-system <host> [nix args]` — build a NixOS system's `toplevel`.
- `build-n-switch <args>` — wraps `doas nixos-rebuild --flake .`.
- `build-n-switch <args>` — wraps `doas nixos-rebuild --accept-flake-config --flake .`.
- `build-home <name>` / `home-switch` — build / switch a home-manager config.
- `run-vm <host>` — build & boot a system as a dev VM (installs `.keys/dev.key` into the VM).
- `build-iso` / `build-kexec` / `build-netboot <host>` — alternate build outputs via `config.my.buildAs.*`.
- `check-system <host> [nix args]` — evaluate a system (catches eval errors without a full build).
**Prefer this over `build-system` to validate a config change** — evaluation surfaces module/option
errors quickly and cheaply; only do a full build when you specifically need the built artifact.
- `deploy <host>` and `deploy-multi <hosts...>` — deploy-rs deployment (uses `.keys/deploy.key`, `--skip-checks`).
- `deploy <host>` — deploy-rs deployment (uses `.keys/deploy.key`, `--skip-checks`).
Use `deploy --targets .#<host1> .#<host2>` for multiple targets; shared options go directly
on the command, e.g. `deploy --boot --targets .#river .#stream`.
Pass the flake-qualified node, e.g. `deploy .#git`. The deploy node name is **always** the system
name (`deploy-rs.nix` keys nodes directly off `nixos.systems` / `home-manager.homes`); a system is
only a deploy target when `config.my.deploy.enable` is true (defaults true; auto-disabled for dev
@@ -53,24 +58,34 @@ Common ones:
(`deploy --boot .#<host>`) — the box keeps running its current generation until it reboots. Use this
when a live `switch` would break connectivity mid-change (e.g. a router's WAN VLAN rework), then
reboot to cut over.
- `ssh-machine <name> [cmd]` — SSH to a NixOS system or home-manager config by name. Resolves the
target and ssh options (identity, port) from its deploy-rs node, so it needs `my.deploy.enable`
(same gate as `deploy`). Boxes default to the `fish` login shell, so pipe multi-statement remote
- `ssh-machine <name> [cmd]` — connect to a box, home-manager config or NixOS container by name.
Uses SSH settings from the deploy-rs node, so the box or container host needs `my.deploy.enable`.
For containers use the instance name or `<host>.container-<name>` to get a root shell through
the host. Connection settings for all nodes are cached together and invalidated
by checkout changes (the jj working copy, else tracked Git changes); use
`ssh-machine --refresh` to force a refresh (see `docs/deployment.md#ssh-machine`).
Boxes default to the `fish` login shell, so pipe multi-statement remote
scripts through `bash` (e.g. `ssh-machine <name> bash -s < script.sh`) rather than `&&`/`for`.
If outbound SSH hangs at the publickey step (flaky `ssh-agent`), disable the agent for the call:
`SSH_AUTH_SOCK= ssh-machine …` (or add `-o IdentityAgent=none` to a raw `ssh`).
- `ragenix` — edit age secrets using `.keys/dev.key` as identity (see Secrets).
- `repl` — `nix repl .#`.
- `installer-shell` / `do-install <system>` — drive an install against a booted installer at
`$INSTALLER`. For bringing up a new box end to end follow the guided procedure in
[`docs/install-box.md`](docs/install-box.md).
- `update-nixpkgs` / `update-home-manager` — bump pinned inputs. For the full periodic upgrade
(rebasing the `devplayer0` nixpkgs fork, stable-release bumps, version-gate sweep, input review)
follow the guided procedure in [`docs/nixpkgs-upgrade.md`](docs/nixpkgs-upgrade.md).
(rebasing the `devplayer0` nixpkgs fork, stable-release bumps, kernel and release-metadata
refreshes, version-gate sweep, input review) follow the guided procedure in
[`docs/nixpkgs-upgrade.md`](docs/nixpkgs-upgrade.md).
Use the narrowest relevant evaluation while iterating: `check-system <host>` for a box config,
`nix eval .#nixfiles.config.nixos.allAssignments --json` for assignment generation, or
`nix build --no-link .#nixfiles.config.nixos.optionsDoc` for the option reference. Reserve
`nix flake check --no-build` for final broad validation or reproducing CI.
CI builds each attr of `.#ci.x86_64-linux` (systems, homes, packages, shell) and pushes to the
Harmonia binary cache; see `.gitea/workflows/ci.yaml` and `ci/push-to-cache.sh`. A separate
`nix build --no-link .#nixfiles.config.nixos.optionsDoc` for the option reference. Runtime
dependency replacement can build store reference graphs during evaluation, so use
`nix flake check` for broad validation when replacements are enabled.
CI runs an eval-only flake check before building and caching `.#ci.x86_64-linux`. An active
`ciIfdReasons` entry allows import from derivation and moves the flake check after the builds.
See [CI in `docs/deployment.md`](docs/deployment.md#ci). A separate
workflow (`.gitea/workflows/update-docs.yaml`) regenerates the network assignments, NixOS option
reference and live DNS reference under `docs/`.
@@ -112,6 +127,11 @@ Four pkgs sets are threaded everywhere as `pkgsFlakes` / `pkgs'` (and `hmFlakes`
channel via `nixpkgs` / `home-manager` / `hmNixpkgs` options (e.g. `nixpkgs = "mine-stable"`).
Modules receive `pkgs'` = an attrset of all channels for the current system.
For options absent from older channels, omit the attribute with `optionalAttrs` guarded by
the module's `options` argument. `mkIf false` still checks option existence. Add a `TODO`
comment explaining which older release needs the guard and which release upgrade allows
its removal, matching the existing release-gated TODOs.
### `lib.my` and the `my` option namespace
`lib/default.nix` extends `lib` with a `my` attrset (helpers like `mkOpt'`, `mkBoolOpt'`,
`mkDefault'`, `inlineModule'`, `mkDefaultSystemsPkgs`, `homeStateVersion`). It also pulls in:
@@ -168,17 +188,48 @@ change, and keep the documented layout and `lib.my.c.home.vlans` in sync.
These APs are not managed by the flake; only their DNS records are. Read and update
`docs/sites/home/aps.md` when changing an AP or its VLAN layout.
## Working from `slop-cannon`
Agents on `slop-cannon` have no deploy or SSH keys, so `deploy` and `ssh-machine` don't work there.
Use `slop` instead; `slop guide` explains it. Run requests that need approval in the background
or give the tool enough time for the [approval window](docs/slop-broker.md#approval-timeout).
If a request expires and the task still depends on it, tell the user what is blocked and pause
for their direction. Continue any independent work you can do under the existing approvals.
- `slop status`, `slop logs` and `slop failed` look at a box without waiting for approval.
- `slop ssh <node> -- <cmd>` runs anything else. Nodes are the deploy-rs nodes on `master`;
`--host <user>@<host>` reaches other boxes.
- `slop deploy <node>…` builds and deploys a pushed commit; `--boot` stages it for the next boot.
- `slop build <attr>…` builds a pushed commit's flake attributes into the binary cache.
- `slop secret keys|read|set|generate|rekey <file>` changes age secrets instead of `ragenix`.
- `slop requests` lists your pending requests and leases.
- Push your work to a branch and open a pull request with `tea pulls create`; only Dev merges into
`master`. Git and `tea` use the bot user's token (see
[`docs/sites/home/slop-cannon.md`](docs/sites/home/slop-cannon.md#gitea)).
## Secrets
age-encrypted secrets in `secrets/`, managed with **ragenix**. Each module declares
`my.secrets.files.<name>` and `my.secrets.key` (the host pubkey to encrypt for). `secrets.nix`
(the ragenix rules file) is generated by reading every system's declared secrets and computing the
recipient key list (always including `.keys/dev.pub`). Edit secrets with the `ragenix` devshell
command, which supplies `.keys/dev.key` as the identity. The `.keys/` directory (dev + deploy
private keys) is required for editing secrets, deploying, and running dev VMs.
recipient key list (always including `.keys/dev.pub` and `.keys/slop-broker.pub`, the broker's
age identity on `palace`). Edit secrets with the `ragenix` devshell command, which supplies
`.keys/dev.key` as the identity. The `.keys/` directory (dev + deploy private keys) is required for
editing secrets, deploying, and running dev VMs.
When a recipient list changes, re-encrypt selectively with `ragenix --rekey-one <file>` for each
affected secret. `ragenix --rekey` rewrites **every** secret in `secrets/`, burying the real change
in churn.
## Conventions
- Prefer `jj` for status, diffs, history, commits, rebases and remote operations when it is
available and the checkout has a Jujutsu workspace. Use Git when `jj` is unavailable or the
checkout is Git-only, and for Git-specific tooling. The shared home config and devshell install
`jujutsu`; see [`docs/deployment.md#version-control`](docs/deployment.md#version-control) for
setup and the workflow. Inspect `jj status`, `jj diff` and `jj log` before editing; `jj`
snapshots working-copy changes automatically, so preserve existing user changes and use
explicit revisions when rewriting history or moving bookmarks.
- Format with `nixpkgs-fmt` (`fmt`). 2-space indent, `inherit (...)` blocks at the top of `let` —
prefer `inherit (lib) mkOption ...;` (and bare use) over qualifying inline as `lib.mkOption`.
**Ask before running `fmt`** — some files aren't canonically formatted, so `fmt` can reindent a
@@ -187,6 +238,10 @@ private keys) is required for editing secrets, deploying, and running dev VMs.
- Comment where it genuinely aids understanding, but not for trivial/obvious code — match the file's
existing (fairly sparse) comment density. When adding something general, comment its general
purpose, not the specific change or one-off reason it was introduced for.
- Separate logical steps in code with blank lines, in every language and inside function bodies: a
function that gathers its inputs, checks them, acts and reports should read as short paragraphs,
not one block. Keep closely related statements together, and leave a blank line before a comment
that introduces the next step.
- Prefer `lib.my` helpers (`mkOpt'`, `mkBoolOpt'`, `mkDefault'`) and `lib.my.c` constants over
reimplementing.
- New shared functionality → a module in `*/modules/` + entry in `_list.nix`, options under `my.*`.
@@ -204,11 +259,26 @@ private keys) is required for editing secrets, deploying, and running dev VMs.
command, option or upstream technical term such as QEMU's machine type.
- Commit subjects follow `area/scope: Capitalized summary` (e.g. `nixos/home: ...`); keep logically
distinct changes in separate commits. Aim for 50-character subjects and do not exceed 72
characters. Wrap commit bodies at 72 columns. A concise body describing the change and its
rationale is welcome when the subject alone does not provide enough context.
characters. Hard-wrap commit body lines at 72 characters; `-m` preserves unwrapped text, so
include literal line breaks or use a commit-message file. Before reporting a commit, inspect
`jj log --no-graph -r <revision> -T description` (or `git show -s --format=%B HEAD` in a Git-only
checkout) and amend its description if any line exceeds 72 characters. A concise body describing
the change and its rationale is welcome when the subject alone does not provide enough context —
keep it to the essentials rather than restating the diff.
`Co-Authored-By` is the only trailer used here; do **not** add a `Claude-Session` link (or any
other session/tooling trailer).
- **"Logically distinct" means unrelated** — two different applications, two boxes that have nothing
to do with each other, a drive-by fix that happens to sit in a file you were editing anyway. One
piece of work stays in one commit even when it touches a config, several docs and a switch: if the
parts only make sense together, splitting them just makes each half unreviewable. Err towards one
commit and split when a reader would ask why two things arrived together.
## Documentation
**Work in progress goes in Gitea issues** on `dev/nixfiles`, not in `docs/` or in files on
branches: plans, status, next steps and handoffs for a piece of work, one issue each, with its
description kept current. When the work is done, move what lasts into `docs/` and close the issue.
Human-readable docs live under `docs/` (index: `docs/README.md`). Box pages are under
`docs/sites/<site>/`, `docs/remote/`, `docs/mobile/`. A box that itself hosts sub-systems
(containers/nested VMs) gets a **directory named for it** with a `README.md` and the child pages
@@ -227,8 +297,10 @@ gets the section with a short explanation instead of a generated-table link.
**Structure and layout:**
- Use **tables** for lists of structured items (BGP peers, forwarded ports, vhosts, containers,
VMs, VLANs). Make the item **name the link**; don't add a separate `Page`/`Docs` column.
- Break up **long prose**: any bullet running past ~4 lines over several distinct facts becomes a
`###` subheading (lead sentence + nested bullets). Don't leave walls of long bullets.
- Break up **long prose**. A bullet or numbered step running past ~3 lines over several facts
becomes a short lead (a bold phrase or one sentence) with nested bullets, a fact each; several
such points on one topic become a `###` subheading. A paragraph listing several facts becomes
bullets or a table. Restructure a long bullet you're adding to rather than lengthening it.
- Prefer durable concepts and named configuration identifiers over copying exact numbers that are
tunable, generated or likely to drift. Exact values are appropriate when they are useful parts of
the inventory or interface: VM resource allocations, hardware-fixed properties, network and
+158
View File
@@ -0,0 +1,158 @@
#!/usr/bin/env python3
"""Evaluate, build and cache every attribute of `.#ci.<system>`.
Then point the cache's `nixfiles` profile at a link farm of the results.
CI_IFD_REQUIRED=true allows import from derivation and runs the flake check
after the builds, when the evaluation-time reference graphs are available.
Expects `nix-eval-jobs` on PATH.
"""
import json
import os
import re
import subprocess
import sys
from contextlib import contextmanager
from pathlib import Path
from tempfile import TemporaryDirectory
SYSTEM = "x86_64-linux"
PUSH = "ci/push-to-cache.sh"
# Every evaluation worker first pays for a shared evaluation of the flake (a
# few GiB), so keep workers alive for several jobs. workers * memory is the
# evaluation budget; it must leave room on the runner for Gitea and for builds
# started by import from derivation.
EVAL_WORKERS = os.environ.get("CI_EVAL_WORKERS", "4")
EVAL_WORKER_MEMORY = os.environ.get("CI_EVAL_WORKER_MEMORY", "6144")
ANSI_ESCAPE = re.compile(r"\x1b\[[0-9;]*m")
@contextmanager
def group(title: str):
print(f"::group::{title}")
try:
yield
finally:
print("::endgroup::")
def annotate_error(title: str, message: str):
# Workflow commands are single lines, so escape multi-line messages
message = ANSI_ESCAPE.sub("", message)
for char, escape in (("%", "%25"), ("\r", "%0D"), ("\n", "%0A")):
message = message.replace(char, escape)
print(f"::error title={title}::{message}")
def succeeds(*command: str) -> bool:
return subprocess.run(command).returncode == 0
def evaluate(nix_options: list[str], work: Path) -> tuple[bool, list[dict]]:
"""Evaluate every CI job, returning whether all of them evaluated."""
result = subprocess.run(
[
"nix-eval-jobs", *nix_options,
"--workers", EVAL_WORKERS, "--max-memory-size", EVAL_WORKER_MEMORY,
"--gc-roots-dir", str(work / "gc-roots"),
"--flake", f".#ci.{SYSTEM}",
],
stdout=subprocess.PIPE,
text=True,
)
jobs = [json.loads(line) for line in result.stdout.splitlines() if line]
ok = result.returncode == 0
for job in jobs:
if "error" in job:
annotate_error(f"Evaluation of {job['attrPath'][0]} failed", job["error"])
ok = False
return ok, [job for job in jobs if "error" not in job]
def build(jobs: list[dict]) -> tuple[bool, dict[str, str]]:
"""Build the jobs' outputs, returning whether all built and the built ones by job."""
ok = succeeds(
"nix", "build", "--keep-going", "--no-link",
*(f"{job['drvPath']}^out" for job in jobs),
)
built = {}
for job in jobs:
name = job["attrPath"][0]
path = job["outputs"]["out"]
if succeeds("nix-store", "--check-validity", path):
built[name] = path
else:
annotate_error(f"Build of {name} failed", "See the build log above.")
ok = False
return ok, built
def link_farm(outputs: dict[str, str], work: Path) -> str:
"""Build a link farm of the outputs from their paths, without evaluating them again."""
outputs_file = work / "outputs.json"
outputs_file.write_text(json.dumps(outputs))
drv = subprocess.check_output(
[
"nix", "eval", "--impure", "--raw", f".#nixpkgs.unstable.{SYSTEM}",
"--apply",
f"""pkgs: (pkgs.linkFarm "ci" (builtins.mapAttrs (_: builtins.storePath)
(builtins.fromJSON (builtins.readFile {json.dumps(str(outputs_file))})))).drvPath""",
],
text=True,
)
return subprocess.check_output(
["nix", "build", "--no-link", "--print-out-paths", f"{drv}^out"],
text=True,
).strip()
def main():
allow_ifd = os.environ.get("CI_IFD_REQUIRED", "false") == "true"
nix_options = ["--option", "allow-import-from-derivation", str(allow_ifd).lower()]
with group("Collect cache garbage"):
subprocess.run([PUSH, "--gc"], check=True)
with TemporaryDirectory() as work:
work = Path(work)
with group("Evaluate"):
ok, jobs = evaluate(nix_options, work)
built = {}
if jobs:
with group("Build"):
built_all, built = build(jobs)
ok = ok and built_all
# Cache whatever built, even when the run fails
if built:
with group("Cache"):
subprocess.run([PUSH, *built.values()], check=True)
if not ok:
sys.exit(1)
if allow_ifd:
with group("Check flake"):
subprocess.run(["nix", "flake", "check", *nix_options], check=True)
with group("Update cache profile"):
farm = link_farm(built, work)
subprocess.run([PUSH, farm], env=os.environ | {"UPDATE_PROFILE": "1"}, check=True)
if __name__ == "__main__":
# Keep this script's output in order with its commands'
sys.stdout.reconfigure(line_buffering=True)
main()
+29
View File
@@ -0,0 +1,29 @@
{ lib, inputs, nixfiles, system }:
let
inherit (builtins) any attrValues filter tryEval;
inherit (lib) concatMap filterAttrs getName groupBy isDerivation;
inherit (nixfiles.config) nixos home-manager;
systems = filter (box: box.system == system) (attrValues nixos.systems);
homes = filter (home: home.system == system) (attrValues home-manager.homes);
installedPackages =
concatMap
(box:
let cfg = box.rendered.config;
in cfg.environment.systemPackages
++ concatMap (home: home.home.packages) (attrValues cfg.home-manager.users))
systems
++ concatMap (home: home.configuration.config.home.packages) homes;
installedByName = groupBy getName installedPackages;
in
filterAttrs
(_: package:
# Check names before forcing output paths. Some unrelated upstream exports
# are helpers or packages that cannot be evaluated on this platform.
let name = tryEval (if isDerivation package then getName package else null);
in name.success && name.value != null
&& any (installed: installed.drvPath == package.drvPath)
(installedByName.${name.value} or [ ]))
(inputs.llm-agents.packages.${system} or { })
+22 -8
View File
@@ -10,6 +10,14 @@ remote_cmd() {
ssh -i "$SSH_KEY" "$SSH_HOST" env HOME=/run/harmonia NIX_REMOTE="$REMOTE_STORE" "$@"
}
collect_garbage() {
echo "Collecting garbage..."
remote_cmd nix-env \
-p "$REMOTE_STORE"/nix/var/nix/profiles/nixfiles \
--delete-generations 60d
remote_cmd nix-collect-garbage
}
umask_old=$(umask)
umask 0066
echo "$HARMONIA_SSH_KEY" | base64 -d > "$SSH_KEY"
@@ -17,15 +25,21 @@ umask $umask_old
mkdir -p ~/.ssh
cp ci/known_hosts ~/.ssh/
path="$1"
echo "Pushing $path to cache..."
nix copy --no-check-sigs --to "$STORE_URI" "$path"
if [ "${1-}" = "--gc" ]; then
collect_garbage
exit
fi
if [ -n "$UPDATE_PROFILE" ]; then
if [ -n "${UPDATE_PROFILE-}" ] && [ $# -ne 1 ]; then
echo "UPDATE_PROFILE needs exactly one path" >&2
exit 1
fi
echo "Pushing $# path(s) to cache..."
nix copy --no-check-sigs --to "$STORE_URI" "$@"
if [ -n "${UPDATE_PROFILE-}" ]; then
echo "Updating profile..."
remote_cmd nix-env -p "$REMOTE_STORE"/nix/var/nix/profiles/nixfiles --set "$path"
echo "Collecting garbage..."
remote_cmd nix-collect-garbage --delete-older-than 60d
remote_cmd nix-env -p "$REMOTE_STORE"/nix/var/nix/profiles/nixfiles --set "$1"
fi
+239
View File
@@ -0,0 +1,239 @@
#!/usr/bin/env python3
"""Keep the llm-agents update PR and its package build current."""
import base64
import json
import os
import subprocess
from itertools import count
from pathlib import Path
from tempfile import TemporaryDirectory
from urllib.error import HTTPError
from urllib.parse import urlencode
from urllib.request import Request, urlopen
BASE = "master"
BRANCH = "automation/llm-agents"
REF = f"refs/heads/{BRANCH}"
TITLE = "flake: Update llm-agents"
LOCK = Path("flake.lock")
BUILD_WORKFLOW = "actions/workflows/llm-agents.yaml"
def git_output(*args: str) -> bytes:
return subprocess.check_output(["git", *args])
def versions(lock_file: Path | None = None) -> dict[str, str]:
command = [
"nix", "eval", "--accept-flake-config", "--no-update-lock-file", "--json",
".#llmAgentPackages.x86_64-linux",
"--apply", "builtins.mapAttrs (_: package: package.version)",
]
if lock_file is not None:
command.extend(["--reference-lock-file", str(lock_file)])
return json.loads(subprocess.check_output(command))
def api(path: str, *, method: str | None = None, query=None, data=None):
server = os.environ["GITHUB_SERVER_URL"].rstrip("/")
repo = os.environ["GITHUB_REPOSITORY"]
url = f"{server}/api/v1/repos/{repo}/{path}"
if query is not None:
url += "?" + urlencode(query)
headers = {"Authorization": f"token {os.environ['GITEA_TOKEN']}"}
payload = None
if data is not None:
headers["Content-Type"] = "application/json"
payload = json.dumps(data).encode()
request = Request(url, data=payload, headers=headers, method=method)
try:
with urlopen(request, timeout=30) as response:
body = response.read()
except HTTPError as error:
message = error.read(4096).decode(errors="replace")
raise RuntimeError(
f"{request.get_method()} {path} returned HTTP {error.code}: {message}"
) from None
return json.loads(body) if body else None
def find_pull_request(state: str, sort: str | None = None):
"""Return the first update PR in the listing, or None."""
repo = os.environ["GITHUB_REPOSITORY"]
query = {"state": state, "base_branch": BASE, "limit": 50}
if sort is not None:
query["sort"] = sort
for page in count(1):
pulls = api("pulls", query=query | {"page": page})
if not pulls:
return None
for pull in pulls:
head = pull["head"]
if head["ref"] == BRANCH and (head["repo"] or {}).get("full_name") == repo:
return pull
def version_changes(before: dict[str, str], after: dict[str, str]) -> list[tuple[str, str, str]]:
return [
(name, before.get(name, "absent"), after.get(name, "absent"))
for name in sorted(before.keys() | after.keys())
if before.get(name) != after.get(name)
]
def locked_source(lock: bytes) -> dict[str, str]:
nodes = json.loads(lock)["nodes"]
return nodes[nodes["root"]["inputs"]["llm-agents"]]["locked"]
def pull_request_body(
before: dict[str, str], after: dict[str, str], base_lock: bytes, proposed_lock: bytes,
) -> str:
rows = "\n".join(
f"| `{name}` | {old} | {new} |" for name, old, new in version_changes(before, after)
)
old, new = locked_source(base_lock), locked_source(proposed_lock)
source = f"`{old['rev'][:12]}` → `{new['rev'][:12]}`"
if new.get("type") == "github":
compare = f"https://github.com/{new['owner']}/{new['repo']}/compare/{old['rev']}...{new['rev']}"
source = f"[{source}]({compare})"
return (
f"Updates the `llm-agents` pin ({source}). Installed package versions:\n"
"\n"
f"| Package | `{BASE}` | Proposed |\n"
"| --- | --- | --- |\n"
f"{rows}\n"
"\n"
"Close this PR to skip these versions; a later release opens a new one."
)
def create_pull_request(body: str):
return api("pulls", data={"base": BASE, "head": BRANCH, "title": TITLE, "body": body})
def close_obsolete(pull) -> None:
if pull is None:
return
api(f"issues/{pull['number']}/comments", data={
"body": f"`{BASE}` already has the latest installed llm-agents versions.",
})
api(f"pulls/{pull['number']}", method="PATCH", data={"state": "closed"})
print(f"Closed the obsolete update PR {pull['html_url']}.")
def declined(after: dict[str, str], reference: Path) -> bool:
"""Check whether the most recently closed update PR rejected these versions."""
pull = find_pull_request("closed", sort="recentclose")
if pull is None or pull["merged"]:
return False
# Gitea keeps the PR's head at close time even if the branch moves on.
subprocess.run([
"git", "fetch", "--no-tags", "--depth=1", "origin", f"refs/pull/{pull['number']}/head",
], check=True)
reference.write_bytes(git_output("show", f"FETCH_HEAD:{LOCK}"))
if versions(reference) != after:
return False
print(f"Skipping the versions declined in {pull['html_url']}.")
return True
def publish(previous: str, before: dict[str, str], after: dict[str, str]) -> str:
changes = "\n".join(
f"{name} {old} -> {new}" for name, old, new in version_changes(before, after)
)
subprocess.run(["git", "add", "--", str(LOCK)], check=True)
subprocess.run([
"git", "-c", "user.name=github-actions[bot]",
"-c", "user.email=github-actions[bot]@users.noreply.github.com",
"commit", "-m", TITLE, "-m", changes,
], check=True)
# Pass the credential to Git without putting it in the remote URL.
auth = base64.b64encode(f"oauth2:{os.environ['GITEA_TOKEN']}".encode()).decode()
subprocess.run([
"git", "push", f"--force-with-lease={REF}:{previous}", "origin", f"HEAD:{REF}",
], check=True, env=os.environ | {
"GIT_CONFIG_COUNT": "1",
"GIT_CONFIG_KEY_0": "http.extraHeader",
"GIT_CONFIG_VALUE_0": f"Authorization: Basic {auth}",
})
return git_output("rev-parse", "HEAD").decode().strip()
def main() -> None:
# Capture the tip before evaluating so the lease protects concurrent updates.
previous = git_output("ls-remote", "origin", REF).decode().partition("\t")[0]
if previous:
subprocess.run(["git", "fetch", "--no-tags", "--depth=2", "origin", REF], check=True)
base_lock = git_output("show", f"HEAD:{LOCK}")
subprocess.run(["nix", "flake", "update", "--accept-flake-config", "llm-agents"], check=True)
candidate_lock = LOCK.read_bytes()
pull = find_pull_request("open")
if candidate_lock == base_lock:
print("The llm-agents pin is current.")
close_obsolete(pull)
return
with TemporaryDirectory() as temp:
reference = Path(temp) / LOCK.name
reference.write_bytes(base_lock)
before = versions(reference)
after = versions()
if before == after:
print("Installed llm-agents package versions are unchanged.")
close_obsolete(pull)
return
if pull is None and declined(after, reference):
return
pending = None
pending_lock = None
if previous and git_output("show", f"{previous}^:{LOCK}") == base_lock:
pending_lock = git_output("show", f"{previous}:{LOCK}")
reference.write_bytes(pending_lock)
pending = after if pending_lock == candidate_lock else versions(reference)
if pending == after:
head, proposed_lock = previous, pending_lock
else:
head, proposed_lock = publish(previous, before, after), candidate_lock
# Keep the description in step with the branch, including after master moves.
body = pull_request_body(before, after, base_lock, proposed_lock)
if pull is None:
pull = create_pull_request(body)
elif pull["body"] != body:
api(f"pulls/{pull['number']}", method="PATCH", data={"body": body})
print(f"Update PR {pull['html_url']}")
# Gitea suppresses events from the Actions token. Dispatch explicitly and
# recover on the next poll if there is still no build for this commit.
runs = api(f"{BUILD_WORKFLOW}/runs", query={"head_sha": head, "limit": 1})
if runs["total_count"] == 0:
api(f"{BUILD_WORKFLOW}/dispatches", data={"ref": BRANCH})
print(f"Queued the llm-agents build for {head[:12]}.")
if __name__ == "__main__":
main()
+19
View File
@@ -27,6 +27,11 @@ in
internal = true;
description = "Rendered deploy-rs configuration.";
};
sshConnections = mkOption {
type = attrsOf unspecified;
internal = true;
description = "SSH connection settings and container names for ssh-machine.";
};
};
config = {
@@ -53,6 +58,20 @@ in
# Filter out null values so deploy merges overriding options correctly
rendered = lib.my.deploy-rs.filterOpts cfg.deploy;
sshConnections = mapAttrs (name: node:
let
system = systems.${name}.configuration.config or null;
hostnames = if system == null then [ ] else system.my.deploy.sshHostnames;
instances = if system == null then { } else system.my.containers.instances;
in
{
inherit (node) sshUser;
sshOpts = cfg.rendered.sshOpts ++ node.sshOpts;
hostnames = if hostnames == [ ] then [ node.hostname ] else hostnames;
containers = attrNames instances;
sudo = node.sudo or (cfg.rendered.sudo or "sudo -u");
}) cfg.rendered.nodes;
};
};
}
+39 -28
View File
@@ -2,6 +2,11 @@
let
homeFlake = "$HOME/.config/home-manager/flake.nix";
devKey = ".keys/dev.key";
sshMachine = pkgs.writeShellApplication {
name = "ssh-machine";
runtimeInputs = with pkgs; [ git jujutsu netcat-openbsd openssh ];
text = ''exec ${pkgs.python3.interpreter} ${./ssh-machine.py} "$@"'';
};
in
{
commands = [
@@ -30,6 +35,27 @@ in
help = "Remove home-manager flake.nix link";
command = "rm -f ${homeFlake}";
}
{
name = "slop";
category = "utilities";
help = "Ask slop-broker for privileged operations (`slop guide`); uses `.keys/slop-request.key` if present";
# Built from this checkout, so it matches the branch. Without a key it uses `SLOP_BROKER`,
# `~/.config/slop/config.toml` or vsock, as the installed client does.
command = ''
key="$PRJ_ROOT/.keys/slop-request.key"
if [ -z "''${SLOP_BROKER-}" ] && [ -f "$key" ]; then
export SLOP_BROKER=ssh:slop@palace.h.nul.ie
export SLOP_SSH="ssh -i $key -o IdentitiesOnly=yes -o IdentityAgent=none"
fi
exec ${pkgs.slop-broker}/bin/slop "$@"
'';
}
{
name = "slop-approve";
category = "utilities";
help = "Answer slop-broker requests; its key stays outside the checkout, where agents can't read it";
command = ''exec ${pkgs.slop-broker}/bin/slop-approve "$@"'';
}
{
name = "ragenix";
category = "utilities";
@@ -51,20 +77,18 @@ in
{
name = "ssh-machine";
category = "utilities";
help = "SSH to a machine by NixOS system or home-manager config name";
help = "Connect to a box, home-manager config or NixOS container by name";
command = ''exec ${sshMachine}/bin/ssh-machine "$@"'';
}
{
name = "docs";
category = "utilities";
help = "Preview Markdown docs in the browser (default: `docs/README.md`)";
command = ''
name="$1"
shift
# Run from the project root so deploy's relative identity path (.keys/deploy.key) resolves
cd "$PRJ_ROOT"
# deploy-rs node names are the system/home name, with `@` mangled to `-at-`
node="''${name//@/-at-}"
# Single eval: resolve `user@host` plus merged (global + node) deploy-rs ssh options
info="$(nix eval --raw .#deploy --apply 'd: let n = d.nodes."'"$node"'"; in "''${n.sshUser}@''${n.hostname} ''${builtins.concatStringsSep " " (d.sshOpts ++ n.sshOpts)}"')"
target="''${info%% *}"
opts="''${info#* }"
# shellcheck disable=SC2086
exec ${pkgs.openssh}/bin/ssh $opts "$target" "$@"
if [ $# -eq 0 ] || [[ "$1" == -* ]]; then
set -- "$PRJ_ROOT/docs/README.md" "$@"
fi
exec ${pkgs.go-grip}/bin/go-grip "$@"
'';
}
{
@@ -106,7 +130,8 @@ in
# HACK: Upstream changes in Git + Nix makes this necessary
# https://github.com/NixOS/nix/issues/10202
doas git config --global --add safe.directory "$PWD"
doas nixos-rebuild --flake . "$@"
# doas drops the devshell's NIX_USER_CONF_FILES, including accept-flake-config.
doas nixos-rebuild --accept-flake-config --flake . "$@"
'';
}
{
@@ -163,19 +188,5 @@ in
help = "Update installer tag (to trigger new release)";
command = ''git tag -f installer && git push -f origin installer'';
}
{
name = "deploy-multi";
category = "tasks";
help = "Deploy multiple flakes at once";
command = ''
for f in $@; do
if [ -n "''${O:-}" ]; then
deploy "$O" $f
else
deploy $f
fi
done
'';
}
];
}
+2
View File
@@ -32,5 +32,7 @@ in
exec ${deploy-rs.deploy-rs}/bin/deploy --skip-checks "$@"
'')
home-manager
jujutsu
go-grip
];
}
+171
View File
@@ -0,0 +1,171 @@
import hashlib
import json
import os
import shlex
import subprocess
import sys
import tempfile
from pathlib import Path
CACHE = Path(".cache/ssh-machine/connections.json")
CACHE_VERSION = 2
def fingerprint():
# The jj working-copy commit covers the snapshotted tree, even in secondary workspaces.
if subprocess.run(["jj", "root"], capture_output=True).returncode == 0:
return subprocess.check_output(
["jj", "log", "--no-pager", "--color", "never", "--no-graph", "-r", "@", "-T", "commit_id"],
text=True,
).strip()
diff = ["git", "diff", "--no-ext-diff", "--no-textconv", "--binary"]
digest = hashlib.sha256()
for command in (["git", "rev-parse", "HEAD"], [*diff, "HEAD", "--"], [*diff, "--cached", "--"]):
digest.update(subprocess.check_output(command))
return digest.hexdigest()
def load_connections(refresh):
key = fingerprint()
if not refresh:
try:
cached = json.loads(CACHE.read_text(encoding="utf-8"))
except (OSError, ValueError):
cached = {}
if (
isinstance(cached, dict)
and cached.get("fingerprint") == key
and cached.get("version") == CACHE_VERSION
and isinstance(cached.get("nodes"), dict)
):
return cached["nodes"]
print("Refreshing ssh-machine connection cache…", file=sys.stderr)
nodes = json.loads(subprocess.check_output(
["nix", "eval", "--json", ".#nixfiles.config.deploy-rs.sshConnections"]
))
if fingerprint() != key:
sys.exit("Checkout changed during evaluation; retry ssh-machine.")
CACHE.parent.mkdir(parents=True, exist_ok=True)
with tempfile.NamedTemporaryFile(
mode="w", encoding="utf-8", dir=CACHE.parent, prefix=".connections.", delete=False
) as temporary:
try:
json.dump({"fingerprint": key, "version": CACHE_VERSION, "nodes": nodes}, temporary)
temporary.flush()
os.replace(temporary.name, CACHE)
finally:
Path(temporary.name).unlink(missing_ok=True)
return nodes
def resolve_target(nodes, name):
# deploy-rs mangles home configuration names containing @.
node_name = name.replace("@", "-at-")
if node_name in nodes:
return nodes[node_name], None
matches = {}
for host, node in nodes.items():
for container in node["containers"]:
qualified = f"{host}.container-{container}"
if name in (container, qualified):
matches[qualified] = (node, container)
if len(matches) == 1:
return next(iter(matches.values()))
if matches:
sys.exit(f"Ambiguous container name: {', '.join(sorted(matches))}")
sys.exit(f"Unknown deploy node or container: {name}")
def ssh_port(node, hostname):
config = subprocess.run(
["ssh", "-G", *node["sshOpts"], f"{node['sshUser']}@{hostname}"],
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True,
)
if config.returncode == 0:
for line in config.stdout.splitlines():
key, _, value = line.partition(" ")
if key == "port":
return value
return None
def select_hostname(node):
# Check preferred addresses before starting SSH so a remote command only runs once.
*preferred, fallback = node["hostnames"]
for hostname in preferred:
port = ssh_port(node, hostname)
if port is None:
continue
try:
probe = subprocess.run(
["nc", "-z", "--", hostname, port], timeout=2,
stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
)
except subprocess.TimeoutExpired:
continue
if probe.returncode == 0:
return hostname
return fallback
def container_command(node, container, command, tty):
args = [
"root", "systemd-run", "--quiet", "--wait", "--collect",
"--expand-environment=no", "--working-directory=~",
"--pty" if tty else "--pipe",
f"--machine={container}", "--", "/run/current-system/sw/bin/bash", "-l",
]
if command:
# SSH joins command arguments with spaces before passing them to the remote shell.
args += ["-c", " ".join(command)]
return f"{node['sudo']} {shlex.join(args)}"
def main(args):
refresh = args[:1] == ["--refresh"]
if refresh:
args = args[1:]
if args[:1] == ["--help"] or (not refresh and not args):
print("Usage: ssh-machine [--refresh] <name> [cmd ...]")
print(" ssh-machine [--refresh] <host>.container-<name> [cmd ...]")
print(" ssh-machine --refresh")
return
# Resolve deploy's relative identity path from the checkout root.
project_root = os.environ.get("PRJ_ROOT")
if not project_root:
sys.exit("ssh-machine: PRJ_ROOT is unset. Enter the devshell first.")
os.chdir(project_root)
nodes = load_connections(refresh)
if not args:
return
name, *command = args
node, container = resolve_target(nodes, name)
hostname = select_hostname(node)
destination = f"{node['sshUser']}@{hostname}"
ssh = ["ssh", *node["sshOpts"]]
if container is not None:
tty = not command and sys.stdin.isatty()
if tty:
ssh.append("-t")
command = [container_command(node, container, command, tty)]
os.execvp("ssh", [*ssh, destination, *command])
if __name__ == "__main__":
try:
main(sys.argv[1:])
except subprocess.CalledProcessError as error:
sys.exit(error.returncode)
except (OSError, ValueError) as error:
sys.exit(f"ssh-machine: {error}")
+19 -10
View File
@@ -24,9 +24,13 @@ Not every box fits this pattern, but **colony** and **home** are organised this
nixpkgs channels, shared module inventory.
- [`networking.md`](networking.md) — network assignments, domains, site topologies, router HA,
the AS211024 L2 mesh, BGP, WireGuard, Tailscale.
- [`deployment.md`](deployment.md) — deploy-rs, devshell commands, secrets workflow, CI.
- [`deployment.md`](deployment.md) — deploy-rs, devshell commands, `jj` workflow, secrets, CI.
- [`nixpkgs-upgrade.md`](nixpkgs-upgrade.md) — guided procedure for the periodic upgrade of the four
nixpkgs channels and home-manager (fork rebase, stable bumps, input review).
- [`install-box.md`](install-box.md) — guided procedure for installing a new box, from the booted
installer through partitioning, the box config, `do-install` and documentation.
- [`openwrt-flash.md`](openwrt-flash.md) — guided procedure for flashing a flake-built image onto an
OpenWrt box, from the build through pre-flight, `sysupgrade` and verification.
- [`reference/dns.md`](reference/dns.md) — generated forward and reverse DNS record reference.
- [`reference/nixos-options.md`](reference/nixos-options.md) — generated per-option reference for
the custom `my.*` NixOS modules.
@@ -38,12 +42,12 @@ Physical host and public-infrastructure hub — see [`sites/colony/README.md`](s
```
colony (physical VM host, ams1)
├── estuary ── edge router: WAN, firewall/NAT, DNS, BGP (AS211024), WireGuard
├── shill ──── NixOS container host ──┬── middleman (reverse proxy, ACME, nginx-sso, librespeed)
├── shill ──── NixOS container host ──┬── middleman (reverse proxy, ACME, Pocket ID, librespeed)
│ ├── vaultwarden (password manager)
│ ├── colony-psql (shared PostgreSQL)
│ ├── chatterbox (Matrix Synapse + bridges)
│ ├── jackflix (media stack)
│ ├── object (MinIO, Harmonia Nix cache, Sharry, HedgeDoc, wastebin)
│ ├── object (MinIO, Harmonia Nix cache, HedgeDoc, wastebin)
│ ├── toot (Bluesky PDS; Mastodon disabled)
│ ├── waffletail (Tailscale subnet router / exit node)
│ ├── qclk (WireGuard management appliance)
@@ -53,24 +57,28 @@ colony (physical VM host, ams1)
├── git ────── Gitea + Gitea Actions runner
├── mail ───── Debian VM running mailcow (not NixOS)
└── darts ──── third-party/customer VM (opaque, not NixOS)
portcullis (bare-metal edge box for Nikhef — staged, not yet in service)
└── fergal OpenWrt SFP+ switch, staged and moving with it
```
## Site: home
Redundant routers, VM host, storage, IoT containers and the workstation — see
[`sites/home/README.md`](sites/home/README.md). The hand-configured switch fabric (jim/dave/brian)
and the Digiweb WAN path are documented in [`sites/home/switches.md`](sites/home/switches.md); the
5G modem being evaluated as a replacement for `stream`'s WAN is in
[`sites/home/wwan.md`](sites/home/wwan.md).
[`sites/home/README.md`](sites/home/README.md). The hand-configured switch fabric
(`jim`/`dave`/`brian`/`shytzel`) and WAN paths are documented in
[`sites/home/switches.md`](sites/home/switches.md); the 5G modem being evaluated as a replacement
for `stream`'s WAN is in [`sites/home/wwan.md`](sites/home/wwan.md).
```
h.nul.ie
├── palace (physical VM host — AMD, 100G, SR-IOV)
│ ├── river ── primary router VM (PPPoE / Digiweb WAN)
│ ├── cellar ─ NVMe-oF / SPDK storage target VM
│ └── sfh ──── container host VM ("shill from home")
│ ├── hass ── Home Assistant + Frigate + MQTT (container)
│ └── unifi ─ UniFi controller (container)
│ ├── sfh ──── container host VM ("shill from home")
│ │ ├── hass ── Home Assistant + Frigate + MQTT (container)
│ │ └── unifi ─ UniFi controller (container)
│ └── slop-cannon ─ coding agents via Paseo (VM, on untrusted)
├── stream (physical secondary router — Virgin Media WAN)
└── castle (workstation / gaming desktop — netboot, NVMe-oF root)
```
@@ -86,6 +94,7 @@ The laptop is indexed in [`mobile/README.md`](mobile/README.md).
## Misc
- [`misc/installer.md`](misc/installer.md) — the custom NixOS installer image.
- [`slop-broker.md`](slop-broker.md) — how these boxes use `slop-broker`, the agents' approval broker.
## A note on the assignment tables
+3 -4
View File
@@ -51,8 +51,7 @@ Per platform (`eachDefaultSystem`), the flake produces:
- `devShells.default` — the `numtide/devshell` from [`devshell/`](../devshell) (see
[deployment.md](deployment.md)).
- `ci.<system>` — one attr per buildable thing (`system-<name>`, `home-<name>` with `@` mangled
to `-at-`, `package-<name>`, plus `shell`), consumed by CI; `ciDrv` is a `linkFarm` of all of
them.
to `-at-`, `package-<name>`, plus `shell`), consumed by CI.
## Systems: `systemOpts` and `mkSystem`
@@ -175,7 +174,7 @@ descriptions) see [`reference/nixos-options.md`](reference/nixos-options.md).
| Module | Provides |
|---|---|
| `common` | Baseline for all boxes: imports the impermanence, ragenix (age), sharry, copyparty and harmonia NixOS modules; pins `system.stateVersion`; `doas` instead of `sudo`; immutable users; nix settings (flakes, `ca-derivations`, the `nix-cache.nul.ie` substituter); declares the `my` option root. |
| `common` | Baseline for all boxes: imports the impermanence, ragenix (age), copyparty and harmonia NixOS modules; pins `system.stateVersion`; `doas` instead of `sudo`; immutable users; nix settings (flakes, `ca-derivations`, the `nix-cache.nul.ie` substituter); declares the `my` option root. |
| `user` | `my.user` — the primary user: `users.users` + matching `home-manager.users` entry, wheel/doas, SSH authorized key from `.keys/me.pub`, shell taken from the home config, home persistence under tmproot. |
| `build` | `my.build` — alternate build targets via `extendModules`: `my.buildAs.devVM` (QEMU dev VM), `iso`, `container`, `kexecTree`, `netbootTree`/`netbootArchive`; `my.build.isDevVM` marker; `allHardware` profile toggle. |
| `dynamic-motd` | `my.dynamic-motd` — runs a script via `pam_exec` to generate the MOTD on login/ssh. |
@@ -188,7 +187,7 @@ descriptions) see [`reference/nixos-options.md`](reference/nixos-options.md).
| `vms` | `my.vms.instances` — QEMU/KVM VMs as systemd units: TAP/bridge networking, LVM-backed disks, VFIO host-device passthrough (with udev tagging), UEFI, SPICE/TTY/QMP unix sockets under `/run/vms/`, clean shutdown via QMP `system_powerdown`. |
| `network` | Baseline networking: networkd only (`useDHCP = false`), IPv6 on, resolved domain/negative-cache settings; dev VMs get DHCP on `eth0` and an SSH port forward. |
| `pdns` | `my.pdns` — PowerDNS: authoritative server driven by BIND-style zone files (with templating and serial management) and recursor extra-settings wiring. |
| `nginx-sso` | `my.nginx-sso` — runs `nginx-sso` (instead of the stock NixOS module) and generates per-instance nginx `auth_request` include files. |
| `pocket-id` | `my.pocket-id` — Pocket ID with user groups and OIDC clients declared in Nix; `pocket-id-sync` applies them through the API with a static API key. |
| `gui` | `my.gui.enable` (default on) — desktop baseline: graphics, polkit, swaylock PAM entry, Android udev rules, screenshot tmpdir. |
| `l2mesh` | Consumes `nixos.vpns.l2` — builds the VXLAN + IPsec layer-2 meshes between edge routers; see [networking.md](networking.md). |
| `borgthin` | `my.borgthin.jobs` — borg backups of thin-LVM snapshots to local or SSH repos on a systemd timer, with pruning. |
+191 -21
View File
@@ -47,7 +47,8 @@ Generated profiles deploy in this order:
- `deploy .#<host>` — the devshell's `deploy` is a wrapper that adds `--skip-checks`. Node
names are the system names (`deploy .#git`).
- `deploy-multi <hosts...>` — loops `deploy` over several nodes (extra args via `$O`).
- `deploy --targets .#<host1> .#<host2>` — deploys several nodes in one invocation.
Pass shared options directly, e.g. `deploy --boot --targets .#river .#stream`.
- `deploy --boot .#<host>` — stages the config as the boot default **without** live-switching
(deploy-rs's `--boot` maps to the custom activation's `boot` phase, which also does the
generation cleanup). Use it when a live `switch` would cut the box off mid-change (e.g. a
@@ -56,12 +57,49 @@ Generated profiles deploy in this order:
#### `ssh-machine`
`ssh-machine <name> [cmd]` resolves `user@host` and the merged global/node `sshOpts` from
`.#deploy`, using the same `my.deploy.enable` gate and `@` → `-at-` mangling as `deploy`, then runs
`ssh`. Boxes default to `fish`, so pipe multi-statement remote scripts through `bash`, for example
`ssh-machine <name> [cmd]` connects using the deploy-rs node's SSH user and merged global and
node `sshOpts`. Box and home targets use the same `my.deploy.enable` gate and `@` → `-at-`
mangling as `deploy`. If a box sets `my.deploy.sshHostnames`, the command checks the
addresses in order for a reachable SSH port and uses the last address if the earlier checks fail.
For NixOS containers, use `ssh-machine middleman` or `ssh-machine shill.container-middleman`.
The qualified name selects the host when multiple containers share a name or a deploy node has
the same name. The command connects to the host's deploy node and uses `systemd-run` to open a
root Bash shell in the container or run the supplied command there. Stdin and the command's
exit status are available to the caller.
Connection settings and container names are cached together in `.cache/ssh-machine/`.
Normal connections read the cache without running Nix. A fingerprint of the checkout
automatically invalidates it. In a Jujutsu workspace (including secondary workspaces without a
Git checkout) it is the working-copy commit ID, so any snapshotted change counts, including new
files that are not ignored. In a Git-only checkout it is HEAD plus staged/unstaged tracked
changes; untracked files only count after `git add`. Ignored files never affect the fingerprint.
Any such edit, even an unrelated one, causes the next connection to refresh all nodes. Use `ssh-machine --refresh` to force a
refresh, or `ssh-machine --refresh <name> [cmd]` to refresh and connect. Refresh failures stop
the command; the previous cache is never used as a fallback.
Boxes default to `fish`, so pipe multi-statement remote scripts through `bash`, for example
`ssh-machine <name> bash -s < script.sh`. If a flaky agent stalls public-key authentication, use
`SSH_AUTH_SOCK= ssh-machine …`.
## Coding agents
The shared GUI home-manager module installs Codex and Claude Code from the `llm-agents` input,
retaining that input's tested nixpkgs pin. [CI proposes version updates](#llm-agents-updates).
To refresh the pin manually, run `nix flake update llm-agents`, then switch the system or home
configuration to use the updated packages.
The shared cache settings in `lib.my.c.nix.cache` and the flake's `nixConfig` include
the [Numtide binary cache](https://github.com/numtide/llm-agents.nix#binary-cache), so
both agents can be downloaded prebuilt. Keep the input's tested nixpkgs pin to preserve cache hits.
They also include the [nix-community cache](https://nix-community.org/cache/), which builds
unfree packages that `cache.nixos.org` doesn't, such as the MongoDB used by UniFi.
`programs.codex.mutableSettings` merges the declared status-line settings into the writable
`~/.codex/config.toml` during activation. Declared values take precedence on each switch;
other settings, including model selection, providers and project trust, remain imperative.
## Devshell commands
The repo ships a `numtide/devshell` ([`devshell/`](../devshell), entered via `direnv`). Run a
@@ -72,12 +110,12 @@ command with no arguments for its help. From
|---|---|
| `check-system <host> [nix args]` | Evaluates `.#nixosConfigurations."<host>".config.system.build.toplevel.drvPath` — catches module/option errors without building. Prefer this to validate a config change. |
| `build-system <host> [nix args]` | Builds the system's `toplevel` (extra args pass through to `nix build`). |
| `build-n-switch <args>` | `doas nixos-rebuild --flake .` (adds the repo as a git `safe.directory` for root first). |
| `build-n-switch <args>` | `doas nixos-rebuild --accept-flake-config --flake .` (accepts the flake's cache settings and adds the repo as a git `safe.directory` for root first). |
| `build-home <name> [nix args]` | Builds `.#homeConfigurations."<name>".activationPackage`. |
| `home-switch [args]` | `home-manager switch --flake .`. |
| `deploy [args]` | `deploy-rs --skip-checks` (wrapper package in `devshell/default.nix`). |
| `deploy-multi <nodes...>` | Deploys several nodes in sequence. |
| `ssh-machine <name> [cmd]` | SSH to a system or home by name, resolving target/options from its deploy-rs node (see above). |
| `deploy --targets .#<node1> .#<node2>` | Deploys several nodes in one invocation. |
| `ssh-machine <name> [cmd]` | Connect to a box, home-manager config or NixOS container using deploy-rs SSH settings. |
| `run-vm <host>` | Boots a system as a dev VM: installs `.keys/dev.key` into a temp `xchg/`, then `nix run`s `config.my.buildAs.devVM`. |
| `build-iso <host>` | Builds `config.my.buildAs.iso`. |
| `build-kexec <host>` | Builds `config.my.buildAs.kexecTree`. |
@@ -92,6 +130,7 @@ command with no arguments for its help. From
| `qemu-genmac` | Prints a random QEMU-suitable MAC (`52:54:00:xx:xx:xx`). |
| `ssh-get-ed25519 <host>` | Prints a host's ed25519 pubkey via `ssh-keyscan`. |
| `json2nix` | Converts JSON on stdin to formatted Nix. |
| `docs [file] [go-grip args]` | Previews Markdown in the browser with `go-grip` (default `docs/README.md`), rendered locally with live reload. |
From [`devshell/install.nix`](../devshell/install.nix) (driven by `$INSTALLER`, the address of
a running custom installer, SSHing as root with `.keys/deploy.key`):
@@ -101,8 +140,13 @@ a running custom installer, SSHing as root with `.keys/deploy.key`):
| `installer-shell [cmd]` | Runs a command (default: a shell) inside the installer. |
| `do-install [--no-bootloader] [--no-substitute] <system>` | Builds the system's `toplevel`, `nix copy`s it into the installer's target store, sets the system profile, and activates it with `switch-to-configuration boot` (with `NIXOS_INSTALL_BOOTLOADER=1` unless `--no-bootloader`). |
From [`devshell/vm-tasks.nix`](../devshell/vm-tasks.nix) (remote VM consoles; they forward the
VM's unix sockets from `/run/vms/<vm>/` on `<host>` over SSH):
### VM consoles
The [`my.vms` module](../nixos/modules/vms.nix) provides `doas vm-tty <vm>` on the VM host.
It opens the serial console in `minicom` via `/run/vms/<vm>/tty.sock`.
The [devshell commands](../devshell/vm-tasks.nix) forward the VM's Unix sockets from
`/run/vms/<vm>/` on `<host>` over SSH.
| Command | What it does |
|---|---|
@@ -110,6 +154,43 @@ VM's unix sockets from `/run/vms/<vm>/` on `<host>` over SSH):
| `vm-monitor <host> <vm>` | QEMU monitor socket in `minicom`. |
| `vm-viewer <host> <vm>` | SPICE display in `virt-viewer` (not on Darwin). |
## Version control
The shared [Home Manager module](../home-manager/modules/common.nix) enables `programs.git`
and `programs.jujutsu`, including Git LFS and `diff-so-fancy`, for graphical and non-graphical
homes. Jujutsu uses the identity declared in `programs.git.settings.user`; Home Manager writes
its `jj/config.toml`. The [devshell](../devshell/default.nix) also installs `jujutsu`, which
provides `jj`. Prefer `jj` when it is available and the checkout has a Jujutsu workspace;
use Git for Git-only checkouts and Git-specific tooling such as the installer-tag command
and CI scripts.
To use an existing Git checkout with both tools, run `jj git init --colocate` at its root.
This creates local `.jj` metadata and keeps `.git` for Nix flake source discovery and existing
Git tooling. Switch the home configuration to install the managed identity. When using only
the devshell, configure your identity with `jj config set --user user.name '<name>'` and
`jj config set --user user.email '<email>'` before creating commits.
| Task | Command |
|---|---|
| Inspect the working copy and history | `jj status`, `jj diff`, `jj log` |
| Describe the current change | `jj describe -m 'area/scope: Capitalized summary'` |
| Start the next change | `jj new` |
| Inspect a completed description | `jj log --no-graph -r <revision> -T description` |
| Fetch remote history | `jj git fetch` |
| Name a revision for publishing | `jj bookmark create <name> -r <revision>` |
| Move an existing bookmark | `jj bookmark set <name> -r <revision>` |
| Publish a bookmark | `jj git push --bookmark <name>` |
`@` is the working-copy revision; after `jj new`, the completed change is normally `@-`.
Working-copy edits are snapshotted automatically, without a staging step. Inspect existing
changes before editing, keep unrelated work separate, and check the target revision before
rewriting history or moving a bookmark. Follow the commit-message conventions in
[`AGENTS.md`](../AGENTS.md#conventions).
See the upstream [Jujutsu CLI reference](https://docs.jj-vcs.dev/latest/cli-reference/)
for command options and [Git compatibility](https://docs.jj-vcs.dev/latest/git-compatibility/)
for colocation details.
## Nix implementation
Every context uses **Determinate Nix** as its `nix.package`, for its performance features
@@ -131,8 +212,8 @@ are unchanged, and the Determinate NixOS module is deliberately not imported.
Determinate without further change.
- **`accept-flake-config`.** Set true only in the devshell `nix.conf`, `.envrc` (as
`--accept-flake-config`, for direnv) and CI — the contexts that build this flake — so its
`nixConfig` (the Harmonia cache) is trusted without an interactive prompt. It is deliberately not
set system-wide: boxes already trust that cache via `nix.settings`, so a global setting would only
`nixConfig` (the Harmonia and Numtide caches) is trusted without an interactive prompt. It is
deliberately not set system-wide: boxes already trust those caches via `nix.settings`, so a global setting would only
blanket-trust every flake's `nixConfig` for no gain.
## Secrets
@@ -151,7 +232,9 @@ be available.
### Recipient rules
[`secrets.nix`](../secrets.nix) is generated from every system's `my.secrets.files` and `key`.
Each recipient list also includes `.keys/dev.pub`, so the development key can open every secret.
Each recipient list also includes `.keys/dev.pub`, so the development key can open every secret,
and `.keys/slop-broker.pub`, so [`slop-broker`](slop-broker.md#secrets) can change secrets for
agents.
Run `ragenix -r` after adding a box or secret to re-key the files.
### Local keys and editing
@@ -171,6 +254,46 @@ default `/tmp/xchg/dev.key`), so dev VMs can decrypt the boxes' secrets without
keys. Dev VMs also get DHCP on `eth0`, an SSH port forward (host 2222 → guest 22), and are
automatically excluded from deploy targets.
## OpenWrt images
The OpenWrt boxes are not NixOS and are not deployed by this flake, but their firmware is built
here. [`openwrt/default.nix`](../openwrt/default.nix) declares one image per box and packages it
through [`astro/nix-openwrt-imagebuilder`](https://github.com/astro/nix-openwrt-imagebuilder),
which drives OpenWrt's official ImageBuilder — prebuilt target packages assembled into a sysupgrade
image, with no cross-toolchain involved.
| Output | Box | Release |
|---|---|---|
| `openwrt-fergal` | [fergal](sites/colony/fergal.md) | `snapshot` |
| `openwrt-fergal-release` | The same, on the release branch | pinned in `openwrt/default.nix` |
Both are in `ci`, so images are built and pushed to the Harmonia cache like everything else. Build
one with `nix build .#openwrt-fergal`; the result holds the `-squashfs-sysupgrade.bin` to flash,
plus a package manifest and an SBOM. Getting it onto the box is a guided procedure of its own —
see [`openwrt-flash.md`](openwrt-flash.md).
Packages are baked into the image rather than installed on the box. OpenWrt's package server keeps
only the current build of each feed, so a box that installs packages at runtime stops being able to
do so as soon as the feed moves on from the firmware it is running. Adding a package means editing
the image's `packages` list and reflashing.
### The feed pin
OpenWrt's download server is never at rest: snapshot is rebuilt daily, and
`releases/<version>/packages/` is a symlink to the rolling `packages-<major>` feed shared by every
point release. Building straight against it fails on hash mismatches and, worse, resolves the
package list by import-from-derivation — which would drag *evaluation* of this flake onto the
network and let an OpenWrt feed rebuild break `check-system` for unrelated boxes.
The `openwrt-feeds` input exists to stop that. It holds expanded per-package metadata and vendors
the repository indexes themselves, so every `.apk` is a plain pinned `fetchurl`, image builds read
the indexes from the flake rather than OpenWrt's mutable URLs, and no import-from-derivation is
involved. Its generated files run to hundreds of thousands of lines and are rewritten wholesale on
each refresh, which is why they live in their own repository rather than here. Regenerate and push
that repository with `nix run .#update`, then refresh this flake's pin with
`nix flake update openwrt-feeds`; adding a release or target means adding it to that repository's
`pins` first.
## CI
GitHub/Gitea Actions workflows live in [`.gitea/workflows/`](../.gitea/workflows).
@@ -179,22 +302,69 @@ GitHub/Gitea Actions workflows live in [`.gitea/workflows/`](../.gitea/workflows
On pushes to `master`, this installs Determinate Nix on the runner (via
`DeterminateSystems/determinate-nix-action`, configured with the same performance settings and
Harmonia substituter as the boxes), runs `nix flake check --no-build`, then builds every attribute
of `.#ci.x86_64-linux`: systems as `system-<name>`, homes as `home-<name>` (with `@` changed to
`-at-`), packages as `package-<name>`, and the development `shell`. Each result is pushed to the
Harmonia cache with [`ci/push-to-cache.sh`](../ci/push-to-cache.sh).
Harmonia substituter as the boxes). A newer push cancels a run still in progress. CI normally
runs `nix flake check --no-build` first and keeps import from derivation disabled. It then runs
[`ci/build-and-cache.py`](../ci/build-and-cache.py), which builds every attribute of
`.#ci.x86_64-linux`: systems as `system-<name>`, homes as `home-<name>` (with `@` changed to
`-at-`), packages as `package-<name>`, and the development `shell`.
It then builds `.#ciDrv.x86_64-linux`, a `linkFarm` of all CI attributes, and pushes it with
`UPDATE_PROFILE=1`. That updates the `nixfiles` profile on the cache box and collects old paths
according to the workflow's retention setting. The SSH store uses `/var/lib/harmonia`,
`HARMONIA_SSH_KEY`, and pinned `ci/known_hosts`; clients use `https://nix-cache.nul.ie` through
`lib.my.c.nix.cache`.
The script works in stages:
- **Collect garbage.** It deletes cache-profile generations older than their retention period,
then collects unreachable paths so a full cache cannot prevent collection from being reached.
Paths pushed by `slop build` survive collection through their own GC roots (see
[`slop-broker.md`](slop-broker.md#binary-cache)).
- **Evaluate.** [`nix-eval-jobs`](https://github.com/nix-community/nix-eval-jobs) evaluates the
attributes in a pool of workers. Each worker reuses one evaluation of the flake for several
jobs, and the worker count and per-worker memory bound (`CI_EVAL_WORKERS`,
`CI_EVAL_WORKER_MEMORY`) cap the evaluation's memory on the runner.
- **Build.** One `nix build --keep-going` builds every evaluated derivation, so a failing job
doesn't stop the others.
- **Cache.** Every output that built is pushed to the Harmonia cache with
[`ci/push-to-cache.sh`](../ci/push-to-cache.sh). Any evaluation or build failure fails the run
at this point.
- **Update the profile.** A `linkFarm` of all the outputs, built from their known store paths
rather than a second evaluation, is pushed with `UPDATE_PROFILE=1`. That updates the
`nixfiles` profile on the cache box.
When `.#ciIfdReasons.x86_64-linux` lists an active exception, CI logs a warning with the reason
and allows import from derivation for the evaluation. The evaluation workers then wait on those
builds in parallel. CI runs a build-capable flake check after caching and before updating the
profile. CI checks [the shared runtime replacement list](../lib/runtime-dependency-replacements.nix)
against the nixpkgs channels used by its systems and standalone homes. A matching entry
requires reading generated store reference graphs during evaluation.
The SSH store uses `/var/lib/harmonia`, `HARMONIA_SSH_KEY`, and pinned `ci/known_hosts`; clients
use `https://nix-cache.nul.ie` through `lib.my.c.nix.cache`.
### `installer.yaml`
Pushing the `installer` tag (refreshed by `update-installer`) builds `my.buildAs.iso` and
`my.buildAs.netbootArchive`, then attaches both to a release.
### llm-agents updates
[`update-llm-agents.yaml`](../.gitea/workflows/update-llm-agents.yaml) checks for updates every
four hours and can also be run manually on `master`. It matches packages directly installed
by the x86_64 Linux NixOS and home-manager configurations to derivations exported by
`llm-agents`. This discovers the tracked packages without building a whole system.
When an installed version changes, CI commits the updated lockfile on the dedicated
`automation/llm-agents` branch. The PR description tabulates the version changes and links
the upstream comparison, and the commit message lists them too. New versions refresh the branch
behind the existing open PR, and the updater rewrites the description to match. Upstream revisions with the same package
versions leave that branch alone.
- **Declining:** close the PR without merging. CI won't propose the same versions again, and
opens a new PR once a later version appears.
- **Obsolete PRs:** if `master` already has the latest installed versions, for example after a
manual update, CI comments on the open PR and closes it.
[`llm-agents.yaml`](../.gitea/workflows/llm-agents.yaml) builds the discovered packages for
the update commit using the flake's caches. The updater dispatches the build explicitly
because Gitea suppresses automatic workflow events from its job token. The updater needs
the repository's Actions token limits to allow writes to code, pull requests and Actions.
### `update-docs.yaml`
On pushes to `master`, excluding its own commits, this runs the assignment, option and DNS
+212
View File
@@ -0,0 +1,212 @@
# Installing a box
Procedure for bringing a new NixOS box into this flake, from bare hardware booted into the custom
installer through to a deployable system. The shared agent skill is
[`install-box`](../.agents/skills/install-box/SKILL.md).
The install is **guided, not automated**: the mechanical steps (probing hardware, partitioning,
writing the config, evaluating it) can be done straight through, but stop at the judgment points
(marked ⏸) — what the box actually is, wiping disks, and running `do-install` itself. Keep a running
summary and present it before any destructive step.
For the installer image itself — what it contains, how it is built and released — see
[`misc/installer.md`](misc/installer.md).
## Setup facts
- **Installer access:** the box boots the custom installer (ISO, kexec or netboot) and is reached
over SSH as `root` with `.keys/deploy.key`. The devshell sets
`INSTALLER_SSH_OPTS = "-i .keys/deploy.key"`; set `INSTALLER` to the address, and
`INSTALLER_SSH_PORT` if it is not 22.
- **Devshell commands** (from [`devshell/install.nix`](../devshell/install.nix)):
`installer-shell [cmd]` and `do-install [--no-bootloader] [--no-substitute] <system>`.
- **`INSTALL_ROOT`** is `/mnt` in the installer's environment — everything is mounted under it and
`do-install` reads it from the installer rather than assuming.
- **`show-hw-config`** is a shell *alias* in the installer (wrapping
`nixos-generate-config --show-hardware-config --root $INSTALL_ROOT`), so it needs an interactive
shell: `installer-shell bash -lic show-hw-config`. A plain `installer-shell show-hw-config` will
not find it.
- **Validation:** `check-system <host>` evaluates a system without building it — use it while
iterating. Only `build-system` when you need the artifact.
- Nix reads the flake through git, so **`git add` new files before evaluating** — an untracked
box directory fails with "Path … is not tracked by Git", not a Nix error.
## Phase 1 — Establish what the box is
⏸ Settle these before writing anything; they decide where every file goes and they are not
recoverable from the hardware:
1. **Name and site** — the box name doubles as the `nixos.systems.<name>` attribute, the deploy node
name and the docs page name. The site decides the directory (`nixos/boxes/<site>/`), the
constants block in [`lib/constants.nix`](../lib/constants.nix) it draws prefixes from, and the
docs directory (`docs/sites/<site>/`, `docs/remote/`, `docs/mobile/`).
2. **Role** — what it does, which decides its modules, networking and firewall config.
3. **nixpkgs channel** — `unstable` / `stable` / `mine` / `mine-stable`; match the site's other
boxes unless there is a reason not to.
4. **Networking** — whether it gets `assignments` now, or bootstraps on DHCP because it is being
staged somewhere other than its final home. A box with no assignment still needs a reachable
`my.deploy.node.hostname`, since the default (`config.networking.fqdn`) will not resolve.
## Phase 2 — Reach the installer and inventory the hardware
With the box booted into the installer and `INSTALLER` set:
1. Confirm you are talking to the right thing — `installer-shell hostname` reports `installer`, and
`/etc/os-release` carries `VARIANT_ID=installer`.
2. Collect the inventory you will need for both the config and the docs page: `lscpu`, `free -h`,
`lsblk -o NAME,SIZE,TYPE,FSTYPE,MODEL,SERIAL`, `ip -br link`, `ip -br addr`,
`lspci -nn | grep -Ei 'ethernet|network|nvme|sata|raid'`, and whether `/sys/firmware/efi` exists.
3. Record every NIC's **permanent MAC** against its PCI address — interface naming in Phase 5 pins
names to MACs, and the PCI order tells you which physical port is which.
4. Run `installer-shell bash -lic show-hw-config` now for the kernel-module lists. Filesystems are
not mounted yet, so run it again in Phase 4 for those.
## Phase 3 — Partition, format and mount
⏸ Destructive. Check the target disks are the ones you think they are and that nothing on them is
wanted, then show the exact command sequence and get confirmation before running it.
The house layout is a tmpfs root (`my.tmproot`) with three mounts: an ESP at `/boot`, `/nix`, and
`/persist` (`neededForBoot = true`). Use **`sgdisk`** for partitioning and put `/nix` and `/persist`
on **LVM** so they can be resized later:
```sh
sgdisk -Z /dev/<disk>
sgdisk \
-n 1:0:+2G -t 1:ef00 -c 1:esp \
-n 2:0:0 -t 2:8e00 -c 2:lvm \
/dev/<disk>
partprobe /dev/<disk>
pvcreate /dev/<disk>p2
vgcreate main /dev/<disk>p2
lvcreate -L 48G -n <host>-nix main
lvcreate -l 100%FREE -n <host>-persist main
mkfs.vfat -n ESP /dev/<disk>p1
mkfs.ext4 -L nix /dev/main/<host>-nix
mkfs.ext4 -L persist /dev/main/<host>-persist
```
Conventions worth keeping: volume group `main`, logical volumes `<host>-nix` / `<host>-persist`,
and ext4 filesystem labels `nix` and `persist`. Size the ESP and `/nix` to the box — 2 GiB and
48 GiB suit a small single-disk box.
Then mount everything under `$INSTALL_ROOT`, with a tmpfs standing in for the eventual tmpfs root:
```sh
mount -t tmpfs -o size=2G tmpfs "$INSTALL_ROOT"
mkdir -p "$INSTALL_ROOT"/{nix,persist,boot}
mount /dev/main/<host>-nix "$INSTALL_ROOT/nix"
mount /dev/main/<host>-persist "$INSTALL_ROOT/persist"
mount /dev/<disk>p1 "$INSTALL_ROOT/boot"
```
### Seed the SSH host key
The installer generates fresh host keys on every boot, so adopt them as the box's own rather than
letting it generate another set on first boot. Copy them onto the persist volume now:
```sh
install -d -m 0755 "$INSTALL_ROOT/persist/etc/ssh"
for t in ed25519 rsa; do
install -m 0600 "/etc/ssh/ssh_host_${t}_key" "$INSTALL_ROOT/persist/etc/ssh/ssh_host_${t}_key"
install -m 0644 "/etc/ssh/ssh_host_${t}_key.pub" "$INSTALL_ROOT/persist/etc/ssh/ssh_host_${t}_key.pub"
done
```
`my.tmproot` persists `services.openssh.hostKeys` at exactly those paths, so the installed system
picks them up. This means the box's key is known **before** it first boots, so `my.secrets.key` can
be set and its secrets encrypted as part of the same pass — no install, boot, re-encrypt, re-deploy
round trip. (For a box already up, the `ssh-get-ed25519 <host>` devshell command prints the same
value in the form `my.secrets.key` wants.)
## Phase 4 — Capture the hardware config
Re-run `installer-shell bash -lic show-hw-config` with the filesystems mounted.
Read the whole generated file and carry over **anything** in it that the flake does not already
provide — it reflects what was actually detected on this hardware, and the list below is just what
usually shows up, not a limit:
- `boot.initrd.availableKernelModules` and `boot.initrd.kernelModules` (LVM adds `dm-snapshot`)
- `boot.kernelModules` (`kvm-intel` / `kvm-amd`) and the microcode attribute
- the ESP's `by-uuid` device, and the device paths for `/nix` and `/persist`
- anything else it emits — `boot.extraModulePackages`, `hardware.*` attributes, `swapDevices`,
additional detected filesystems, `imports` such as `not-detected.nix`
The test is conflict, not familiarity: drop an option only when a nixfiles module already sets it,
and keep it otherwise. The flake's own modules cover the bootloader, `initrd.systemd`,
`initrd.services.lvm`, the kernel package and `nixpkgs.hostPlatform` (see
[`nixos/modules/common.nix`](../nixos/modules/common.nix) and
[`nixos/default.nix`](../nixos/default.nix)), so those are the ones to leave out. Don't paste the
file in wholesale either — translate it into the box's own style, and reference LVM volumes as
`/dev/main/<host>-nix` rather than the generated `/dev/mapper/main-<host>--nix`.
## Phase 5 — Write the box config
Create `nixos/boxes/<site>/<host>/default.nix` (a directory, so per-topic files can be added
alongside it later) declaring `nixos.systems.<host>`, and add its path to the `configs` list in
[`flake.nix`](../flake.nix). Then `git add` it.
The minimum is `system`, `nixpkgs`, `home-manager` and a `configuration` with the hardware from
Phase 4, the three filesystems, and networking. Beyond that:
- **Interface naming:** pin names to hardware with `.link` files matching `PermanentMACAddress`,
named for speed and index — `et1g0`, `et2g5-0`, `et10g-1`. Never rely on predictable-interface
names in the `.network` files.
- **Servers** set `my.server.enable = true`.
- **Secrets:** set `my.secrets.key` to the ed25519 public key seeded in Phase 3 (the key only, no
`root@installer` comment). Note that **every box declares at least one secret** even if its own
config declares none: [`nixos/modules/user.nix`](../nixos/modules/user.nix) adds
`user-passwd.txt` whenever `my.user.enable` is on, which is the default. So setting
`my.secrets.key` always adds the box to that file's recipients, and
`ragenix --rekey-one secrets/user-passwd.txt.age` is required — skip it and the box cannot
decrypt its user password on first boot. Confirm what the box actually declares with
`nix eval .#nixosConfigurations.<host>.config.age.secrets --apply builtins.attrNames`, and
re-encrypt each of those files the same way. Create any new secrets with `ragenix -e <path>`.
Never use `--rekey`, which rewrites every secret in `secrets/`.
- **A box staged away from its final home** gets a bootstrap `.network` taking DHCP, plus
`systemd.network.wait-online.anyInterface = true` so boot does not block on unpatched ports, and
an explicit `my.deploy.node.hostname`. Comment it as temporary and say what replaces it.
Validate with `check-system <host>` and fix eval errors before going near the target.
## Phase 6 — Install
⏸ The maintainer may want to run this step themselves; ask rather than assume.
`do-install <host>` builds the system's `toplevel`, `nix copy`s the closure into the installer's
`$INSTALL_ROOT` store, points `/nix/var/nix/profiles/system` at it, touches `/etc/NIXOS`, and runs
`switch-to-configuration boot` with `NIXOS_INSTALL_BOOTLOADER=1`. It prompts for confirmation and
prints the target it resolved.
- `--no-bootloader` skips the bootloader install (for a box that boots by other means).
- `--no-substitute` copies everything from the local store instead of letting the target substitute.
## Phase 7 — First boot and post-install
1. Reboot the box off the installer and confirm it comes up: it should get its address, and
`hostname` should be the system name. Its SSH host key is the one seeded in Phase 3, so it
presents the same fingerprint the installer did.
2. **Secrets.** If Phase 5 set `my.secrets.key`, they already decrypt. [`secrets.nix`](../secrets.nix)
computes the ragenix recipient list from that key at evaluation time, so nothing needs
regenerating — but any secret added to the box later must be re-encrypted for the new recipient
list with `ragenix --rekey-one <path>`, one file at a time. Never reach for `ragenix --rekey`:
it rewrites every secret in `secrets/` and buries the actual change in churn.
3. **Deploy.** `deploy .#<host>` should now work over the `deploy` user. If the box is staged
somewhere without its final DNS name, `deploy --hostname <address> .#<host>` overrides the node
hostname for one run.
## Phase 8 — Document it
Per [`AGENTS.md`](../AGENTS.md), a new box means:
- a box page under the right docs directory, following the standard layout (H1 + one-line intro;
`Source` / `Host` / `nixpkgs` bullets; hardware inventory; `## Role`; `## Network assignments`
linking to [`networking.md#box-assignments`](networking.md#box-assignments), or a short
explanation if it has none yet; one `##` per topic; `## Notable config files` last);
- a row in the site index `README.md` boxes table;
- affected prose in [`networking.md`](networking.md) — the assignment tables themselves are
CI-generated, so write the prose and leave the tables alone;
- the site diagram in [`README.md`](README.md) if the box changes its layout.
+4 -2
View File
@@ -34,8 +34,10 @@ The custom NixOS installer image used to bootstrap new boxes.
## Installing a box
The devshell's installer commands ([`devshell/install.nix`](../../devshell/install.nix)) drive
an install over SSH against a booted installer reachable at `$INSTALLER`:
The end-to-end procedure — hardware inventory, partitioning, writing the box config, installing and
documenting it — is in [`install-box.md`](../install-box.md). The devshell's installer commands
([`devshell/install.nix`](../../devshell/install.nix)) drive an install over SSH against a booted
installer reachable at `$INSTALLER`:
- `installer-shell` — get a shell on the installer.
- `do-install <system>` — builds the system's toplevel, `nix copy`s the closure to the
+2
View File
@@ -42,6 +42,8 @@ over Tailscale.
- NetworkManager (`wpa_supplicant` backend) with `systemd-resolved`; networkd `wait-online`
is disabled. The Wi-Fi interface is renamed to `wifi` by MAC.
- `ssh-machine tower` uses `tower.dyn.h.nul.ie` when its SSH port is reachable and
`tower.ts.nul.ie` over Tailscale otherwise.
- Steam and Wireshark enabled; `fstrim`, LVM thin provisioning.
- `nix.gc.automatic = false` — GC is run manually on the laptop.
+174 -8
View File
@@ -2,7 +2,7 @@
This page describes how addressing works across the boxes: the assignment mechanism, the
per-site domains and prefixes, the home router HA pair, and the overlays/tunnels that tie the
sites together. Switch-level home topology (jim/dave/brian, the ONT path) lives in
sites together. Switch-level home topology (`jim`/`dave`/`brian`/`shytzel`, the WAN paths) lives in
[sites/home/switches.md](sites/home/switches.md).
## Assignments
@@ -159,6 +159,7 @@ edit prose there, never the other generated cells.
| [`cellar`](sites/home/cellar.md) | `192.168.68.80/22 gw 192.168.71.254` | `2a0e:97c0:4d0:1::4:1/64` | h.nul.ie | |
| [`hass`](sites/home/sfh/containers/hass.md) | `192.168.68.103/22 gw 192.168.71.254` | `2a0e:97c0:4d0:1::5:3/64` | h.nul.ie | |
| [`palace`](sites/home/palace.md) | `192.168.68.22/22 gw 192.168.71.254` | `2a0e:97c0:4d0:1::2:1/64` | h.nul.ie | |
| [`portcullis`](sites/colony/portcullis.md) | `192.168.68.41/22 gw 192.168.71.254` | `2a0e:97c0:4d0:1::6:1/64` | h.nul.ie | |
| [`river`](sites/home/river.md) | `192.168.68.1/22` | `2a0e:97c0:4d0:1::1/64` | h.nul.ie | |
| `router-hi` | `192.168.71.254/22 gw 192.168.68.1` | `2a0e:97c0:4d0:1::ffff/64` | h.nul.ie | Floating VIP shared by [`river`](sites/home/river.md) and [`stream`](sites/home/stream.md) |
| [`sfh`](sites/home/sfh/README.md) | `192.168.68.81/22 gw 192.168.71.254` | `2a0e:97c0:4d0:1::4:2/64` | h.nul.ie | |
@@ -174,12 +175,19 @@ edit prose there, never the other generated cells.
| `router-lo` | `192.168.79.254/21 gw 192.168.72.1` | `2a0e:97c0:4d0:2::ffff/64` | h.nul.ie | Floating VIP shared by [`river`](sites/home/river.md) and [`stream`](sites/home/stream.md) |
| [`stream`](sites/home/stream.md) | `192.168.72.2/21` | `2a0e:97c0:4d0:2::2/64` | h.nul.ie | |
#### `rdma`
| Box | IPv4 | IPv6 | Domain | Notes |
|---|---|---|---|---|
| [`river`](sites/home/river.md) | `192.168.68.3/32` | — | h.nul.ie | |
#### `untrusted`
| Box | IPv4 | IPv6 | Domain | Notes |
|---|---|---|---|---|
| [`river`](sites/home/river.md) | `192.168.80.1/24` | `2a0e:97c0:4d0:3::1/64` | h.nul.ie | |
| `router-ut` | `192.168.80.254/24 gw 192.168.80.1` | `2a0e:97c0:4d0:3::ffff/64` | h.nul.ie | Floating VIP shared by [`river`](sites/home/river.md) and [`stream`](sites/home/stream.md) |
| [`slop-cannon`](sites/home/slop-cannon.md) | `192.168.80.5/24 gw 192.168.80.254` | `2a0e:97c0:4d0:3::5/64` | h.nul.ie | |
| [`stream`](sites/home/stream.md) | `192.168.80.2/24` | `2a0e:97c0:4d0:3::2/64` | h.nul.ie | |
<!-- assignments-end -->
@@ -266,6 +274,11 @@ On top of that: `p2pTunnels` (`10.100.5.0/24`) holds point-to-point tunnel /30s
public blocks and the per-customer `mail` / `darts` / `jam` prefixes carry customer-facing
services with their own public addresses (announced by BGP, routed via the host).
This layout is expected to change: [`portcullis`](sites/colony/portcullis.md) is bare-metal edge
hardware headed for Nikhef that will take over most of `estuary`'s routing. It has no colony
assignments yet (only a home `hi` one, from being staged at home) and the replacement topology is
still being designed.
## home
The home site prefixes (`lib.my.c.home.prefixes`) come from `192.168.64.0/18` and
@@ -308,6 +321,29 @@ which the other sites use as their next-hop into the home prefixes.
### Router HA
#### Switch attachments
Both routers use `lan-dave` and `lan-jim` under an RSTP bridge named `lan`. The
[failover validation](sites/home/router-failover.md) covers router, attachment and switch outages.
[`routing-common`](../nixos/boxes/home/routing-common/default.nix) owns the bridge, `mstpd` setup and
explicit port costs: `dave` is preferred at cost 10 and `jim` is redundant at cost 100. Native
`core`, the client VLANs and `river`'s Digiweb VLANs sit above this bridge. The `jim` path can reach
the ONT through the RSTP-protected connection between `jim` and `brian` without traversing `dave`.
RSTP follows the fabric topology, including failures beyond a local cable that retains carrier;
an active-backup bond using only MII monitoring would miss those failures. The guest bridge has an
explicit jumbo MTU. Root priorities and port roles across the complete fabric must agree with the
intended preference; local port costs alone do not establish a working redundant path.
On networkd configuration events, the dispatcher inspects the current bridge ports and applies
the costs through `mstpctl`, retrying until the daemon has registered each port. The daemon's
configuration hook reapplies them on restart or reload. The shared DHCPv4 service
waits for IPv4 readiness on the client interfaces and retries delayed startup without exhausting
systemd's start limit.
`river` keeps its NVMe/RDMA traffic on a separate VF, outside the bridge; see
[river](sites/home/river.md#storage). The physical fabric is documented in
[switches.md](sites/home/switches.md).
#### VRRP
[`routing-common/keepalived.nix`](../nixos/boxes/home/routing-common/keepalived.nix) defines separate
@@ -327,6 +363,25 @@ instead anchor DNS on the VIPs via the shared `lib.my.c.home.vlanDns "<vlan>"` f
`DNS` to `vips.<vlan>.{v4,v6}` and `Domains` to the advertised search list; the always-present
static v4 VIP keeps resolution working even with v6 down.
#### Untrusted clients
The routers restrict clients on the `untrusted` VLAN to Internet destinations. The filter also
blocks access to colony, where the home prefixes are trusted across the mesh.
- `forward-early` sends new connections from `lan-untrusted` to `untrusted-internal`, which rejects
everything in `lib.my.c.internalNets`: private, CGNAT (Tailscale), link-local, multicast and
reserved IPv4, IPv6 ULA / link-local / multicast, and our own global IPv6 prefixes. It runs
before `forward`, whose ICMP rules would otherwise let pings through.
- `filter-untrusted` then accepts `wan` and `as211024` (IPv6 Internet transit) and rejects the
rest.
- Rejecting rather than dropping makes clients fall back from colony's IPv6 addresses (such as
`git.nul.ie`'s) to IPv4 immediately.
- Replies to connections from `hi` and `lo` are allowed, so trusted boxes can still reach
`untrusted` hosts.
- Traffic to the routers themselves goes through the same `input` rules as `wan`.
- Clients on `untrusted` share layer 2 with each other; the routers can't filter that.
- [`slop-cannon`](sites/home/slop-cannon.md) uses a static address on the `untrusted` VLAN.
#### DNS binding
`pdns-recursor` binds the VIPs directly; see
@@ -345,15 +400,22 @@ route on `wan`, while `river`'s `pppd` hooks start and stop it. Consumers such a
`wantedBy` + `partOf` + `after`, never `requires`/`wants`, so they cannot pull the target in early
and they reload on WAN flap.
DDNS starts when this WAN gate opens, after the local authoritative server and recursor.
Its five-minute timer retries failed updates and refreshes the public records; timer and manual
starts skip the update while the WAN gate is inactive, without activating it. `river` also
updates immediately after PPPoE reconnects. `doas systemctl start ddns-update.service` retries
immediately once connectivity is available.
### WAN paths (summary)
#### `river`
The VM on `palace` runs Digiweb PPPoE directly on VLAN 10 (`vlans.pon-isp`), trunked untranslated
through the switches. The carrying interface is named `wan-pon-isp`; VLAN ID 141 with that name is
reserved for a future translation scheme. MTU 1508 preserves a 1500-byte PPP session, IPCP requests
the static address, and the `pppd` hooks own `wan-online.target`. `wan-pon-ont` (VLAN 140) reaches
the ONT management subnet at `192.168.100.0/24`, where `river` takes `.100`.
over its RSTP `lan` bridge. `dave` is the normal carrying path; `jim` provides the redundant path.
The VLAN interface is named `wan-pon-isp`; VLAN ID 141 with that name is reserved for a future
translation scheme. MTU 1508 preserves a 1500-byte PPP session, IPCP
requests the static address, and the `pppd` hooks own `wan-online.target`. `wan-pon-ont` (VLAN 140)
reaches the ONT management subnet at `192.168.100.0/24`, where `river` takes `.100`.
#### `stream`
@@ -363,8 +425,8 @@ The bare-metal backup uses DHCP from the Virgin Media modem on `wan` (VLAN 130),
The full fabric story — which switch port carries what, why VLAN 10 is trunked untranslated,
and the multi-ONT plan — is in [sites/home/switches.md](sites/home/switches.md); the
`my.homeRouter.*` options (`dns.wanSkipBroadcasts`, `firewall.untrustedRejectV4`) let each box
tell `routing-common` about subnets sharing its WAN interface.
`my.homeRouter.dns.wanSkipBroadcasts` option lets each box tell `routing-common` about subnets
sharing its WAN interface.
## The AS211024 L2 mesh
@@ -383,6 +445,72 @@ Libreswan transport mode. It authenticates without encryption by default; `secur
switches ESP from `null-sha256` to AES-GCM. The shared `l2mesh/as211024.key` PSK is expanded into
`/run/l2mesh.secrets` when `ipsec` starts.
### ESP throughput
ESP is the mesh's throughput limit rather than VXLAN — encapsulation is close to free, and on a
small box the crypto is what costs. The kernel processes a single SA on a single core, so per-peer
throughput is capped by one core however many the box has. That limit binds per peer rather than
per box, so a router spreads naturally across its peers.
Two things follow for configuration:
- The `esp4_offload` / `esp6_offload` modules provide GSO/GRO batching for ESP and are **not**
autoloaded when an SA is created. The [`l2mesh` module](../nixos/modules/l2mesh.nix) loads the
one matching each secured mesh's underlay family; without them throughput is around a third
lower, for more CPU.
- `security.encrypt = false` does not save CPU on hardware with AES-NI — it measured slower than
AES-GCM. GCM resolves to a single fused accelerated implementation, while the authenticate-only
path falls back to a generic `authenc(hmac(sha256),ecb(cipher_null))` composition.
#### NIC crypto offload
No mesh uses it, and the `esp4_offload` / `esp6_offload` modules above are unrelated to it — those
are software GSO/GRO batching. Hardware ESP offload is a separate XFRM feature that Libreswan only
requests for connections setting `nic-offload=yes`, which the
[`l2mesh` module](../nixos/modules/l2mesh.nix) does not.
[`portcullis`](sites/colony/portcullis.md)'s 82599ES ports advertise `esp-hw-offload` and the
offload does work, but not for anything the meshes could use. Measured on the box by installing
SAs directly with `ip xfrm` and watching `ixgbe`'s `tx_ipsec` counter:
| SA | Result |
|---|---|
| `et10g-0`, transport, AES-GCM-128 | offload active — `mode crypto` against the physical port |
| `et10g-0`, transport, AES-GCM-256 | rejected: *"IPsec hw offload only supports keys up to 128 bits with a 32 bit salt"* |
| `et10g-0`, **tunnel** mode | rejected: *"Unsupported mode for ipsec offload"* |
| `lan-hi` (a VLAN on `et10g-0`) | **accepted with the offload silently dropped** — software crypto |
| `et2g5-0` (I226-V) | accepted, offload silently dropped — `igc` has none |
Two traps are worth knowing. Binding an SA to a device that cannot offload is **not** an error:
`xfrm_dev_state_add` returns success having cleared the device, so the SA looks fine and quietly
runs in software. And a VLAN interface never offloads — it carries no `xfrmdev_ops`, and
`esp-hw-offload` reads `off [fixed]` on it even when its parent supports the feature.
The second trap is the decisive one here. Even with the offload genuinely active against
`et10g-0`, driving traffic through the SA left `tx_ipsec` at zero, because the packets egress
`lan-hi` and the kernel only offloads when the SA's device matches the egress device. Every address
`portcullis` holds is on a VLAN, so an SA would have to be bound to an untagged physical port to
see the hardware at all.
So adopting it would mean dropping to a 128-bit key to suit one NIC family, keeping the underlay
off VLANs, and forgoing `udpEncapsulation` — `xfrm_dev_offload_ok` refuses any SA carrying
`encap`. That is not a trade worth making for a mesh that has to run across boxes with no offload
at all.
#### pcrypt
`pcrypt` parallelises an SA's crypto across cores via padata and does lift the per-SA ceiling. It
is not enabled on any box here, and is recorded as an option rather than a recommendation:
- It cannot be named in the SA — `ip xfrm` and the kernel both validate AEAD names against a fixed
list. It is engaged instead by registering a `pcrypt(...)`-wrapped instance under the standard
algorithm name at a higher priority, over `NETLINK_CRYPTO` (`CONFIG_CRYPTO_USER`). `crconf` is
the usual tool for that and is not packaged in nixpkgs.
- The registration is global: it redirects every user of that algorithm on the box, not just the
mesh, and would have to run before `ipsec` starts.
- A single-threaded submit path remains, so it does not scale with core count, and it trades
latency and packet ordering for throughput.
### Overlay addressing
The overlay uses `10.100.50.0/24` / `2a0e:97c0:4df::/64`. Each router holds `10.100.50.<n>`:
@@ -402,10 +530,48 @@ firewalls.
Both edge routers run `bird2` as AS211024.
### RIPE routing policy and peering records
Maintain the routing policy in the RIPE `aut-num` object for AS211024, keeping peers grouped
under the existing upstream, direct-peering and IXP remarks. Keep plain `import` / `export`
attributes for IPv4 unicast and add `mp-import` / `mp-export` with `afi ipv6.unicast` for IPv6.
For example, when the same policy applies to both families:
```rpsl
import: from AS56393 accept AS-FRYS-IX-CONNECTED
export: to AS56393 announce AS211024:AS-DEVPLAYER0
mp-import: afi ipv6.unicast from AS56393 accept AS-FRYS-IX-CONNECTED
mp-export: afi ipv6.unicast to AS56393 announce AS211024:AS-DEVPLAYER0
```
`mp-*` means multiprotocol and can describe one or several address families. Keeping the IPv4
policy in the original attributes preserves compatibility with older or custom readers that
ignore `mp-*`, without overlapping the two policies. Use only the IPv6 pair for IPv6-only
peering. Address families describe the routes exchanged, independently of the BGP session's
transport address. See [RFC 4012](https://www.rfc-editor.org/rfc/rfc4012.html#section-2).
To update the policy, find `AS211024` in the [RIPE Database](https://apps.db.ripe.net/db-web-ui/query),
select **Update**, authenticate through `devplayer0-mnt`, add the entries under the appropriate
remarks and submit. Check the success response and query the object again to confirm the result.
These registry entries document policy; they do not configure BIRD.
For a new peering, also check the prefix authorisations and connection records:
- **IRR:** `AS211024:AS-DEVPLAYER0` lists the originating ASNs; `route` / `route6` objects associate
announced prefixes with their origin ASN. Prefix-filter generators can expand the AS-set and
route objects independently of the `aut-num` import/export policy.
- **RPKI:** ROAs authorise AS211024 to originate the announced prefixes and lengths. Existing
correct ROAs and route objects need no change just because a new IXP is added; the route-server
ASN does not become the origin. The assigned peering-LAN address is an interface address, not
a prefix to originate or create a ROA for.
- **PeeringDB:** record the exchange connection and assigned peering addresses.
- **BGP:** verify that both route servers accept and propagate the intended exports, as well as
establishing sessions.
### `estuary`
The colony edge takes a full table from ColoClue, IPv6 transit from iFog and Hurricane Electric,
and peers through the Frys-IX, NL-ix and FogIXP route servers. It also has direct and monitoring
and peers through the Clue-IX, Frys-IX, NL-ix and FogIXP route servers. It also has direct and monitoring
sessions; the complete peer table and originated routes live in [estuary.md](sites/colony/estuary.md#bgp).
### `britway`
+137 -33
View File
@@ -2,20 +2,36 @@
Procedure for the periodic upgrade of all four nixpkgs channels (`unstable`, `stable`, `mine`,
`mine-stable`) and home-manager. Written to be followed by a person or any coding agent; a
Claude Code entry point exists at `.claude/skills/upgrade-nixpkgs/` but the steps below are the
canonical source.
shared agent-skill entry point exists at `.agents/skills/upgrade-nixpkgs/`, but the steps below are
the canonical source.
The upgrade is **guided, not automated**: do the mechanical and investigative steps, but stop at
the judgment points (marked ⏸) — pushing the fork, resolving rebase conflicts, editing the
`flake.nix` stable pins, and deleting version guards. Report findings and let the maintainer
decide. Keep a running summary and present it before any push or commit.
stable-channel configuration, choosing a new release codename, deleting version guards, and
choosing how to handle a service or package that no longer works on its current channel. Report
findings and let the maintainer decide.
Work the phases in order; skip one only if explicitly scoped to a subset.
## Progress document
Maintain `docs/nixpkgs-upgrade-progress.md` in the upgrade workspace. It is a working record, not
part of the upgrade's history: keep it in the topmost working-copy change, out of the commits that
make up the upgrade series, and delete it at [wrap-up](#wrap-up). At the start, record the baseline
revision, target channels, and scope. On resume, read it first and verify its revisions and
completed steps against the working copy, lockfile, and remote refs.
Update the document as each phase finishes and before a push, commit, or handoff. Include the
reviewed revision or version ranges, links to changelogs or commits, the practical effect on this
repo, and any unreviewed items. Record the decisions made and pending, including alternatives,
the rationale for a fix or workaround, and the condition for removing a temporary pin or
mitigation. Mark inherited choices separately from maintainer approvals. Record validation results
against the candidate revisions and leave a concrete next step for any outstanding work.
## Setup facts
- **Fork checkout:** `~/documents/projects/nixpkgs` — remotes `origin` (`devplayer0/nixpkgs`) and
`upstream` (`NixOS/nixpkgs`). Confirm the path exists; if not, ask.
- **Fork checkout** defaults to `../nixpkgs` relative to this flake's root. Verify `origin` points
to the `devplayer0/nixpkgs` fork and `upstream` to `NixOS/nixpkgs`. Ask for the location if needed.
- **Fork branches:** `devplayer0` (tracks `nixos-unstable`) and `devplayer0-stable` (tracks the
current NixOS stable). Each is a small stack of local patches rebased onto upstream.
- **Flake pins** in `flake.nix` (`inputs`):
@@ -27,15 +43,16 @@ Work the phases in order; skip one only if explicitly scoped to a subset.
- `home-manager-stable.url = "home-manager/release-<STABLE>"`
- **Devshell commands:** `update-nixpkgs` = `nix flake update nixpkgs-{unstable,stable,mine,mine-stable}`;
`update-home-manager` = `nix flake update home-manager-{unstable,stable}`.
- **Validation:** prefer `check-system <host>` and `nix flake check --no-build` over full builds.
- **Validation:** prefer `check-system <host>` while iterating and reserve the flake check for final validation.
## Phase 1 — Determine the current NixOS stable
Do this first: everything downstream (the fork's `devplayer0-stable` rebase target, the `flake.nix`
stable pins) has to agree on one NixOS stable release, so establish it up front.
1. Find the latest NixOS stable release branch — check `git branch -r` on `upstream` for the newest
`release-YY.NN`, or the NixOS release schedule.
1. Check the [NixOS stable release notes](https://nixos.org/manual/nixos/stable/release-notes.html)
and the release schedule. A `release-YY.NN` branch can exist during stabilization before that
release becomes the published stable channel.
2. Compare it to `<STABLE>` in the `flake.nix` `nixpkgs-stable` / `home-manager-stable` URLs.
3. **If they already match** (no new stable): note "stable is current" and carry `<STABLE>` into the
later phases.
@@ -43,6 +60,7 @@ stable pins) has to agree on one NixOS stable release, so establish it up front.
the pieces must all move to the same release together:
- Rebase `devplayer0-stable` onto the new `upstream/release-YY.NN` (Phase 2 uses this target).
- Edit `flake.nix`: `nixpkgs-stable.url` and `home-manager-stable.url` → the new release.
- Choose a new `lib/default.nix` `versionOverlay` codename (Phase 4 updates it).
- Bump each system's `stateVersion` / `home.stateVersion` only if the maintainer explicitly
wants to — that is a separate, deliberate decision; never auto-bump.
Don't edit `flake.nix` here without confirmation.
@@ -52,10 +70,22 @@ stable pins) has to agree on one NixOS stable release, so establish it up front.
For **both** branches — `devplayer0` onto `upstream/nixos-unstable`, and `devplayer0-stable` onto
`upstream/release-<STABLE>` (the release established in Phase 1):
1. In `~/documents/projects/nixpkgs`, confirm a clean working tree (`git status`). If dirty, stop
1. In the fork checkout, confirm a clean working tree (`git status`). If dirty, stop
and report — don't stash silently.
2. `git fetch upstream --prune` and `git fetch origin --prune`. If the checkout has been idle a
long time this fetch can be large and slow; let it finish.
2. Fetch the branches explicitly. Some fork checkouts fetch only `master` from `upstream` by default.
Set `stable` to the release established in Phase 1.
```sh
git fetch upstream \
+refs/heads/master:refs/remotes/upstream/master \
+refs/heads/nixos-unstable:refs/remotes/upstream/nixos-unstable \
"+refs/heads/release-${stable}:refs/remotes/upstream/release-${stable}" \
"+refs/heads/nixos-${stable}:refs/remotes/upstream/nixos-${stable}"
git fetch origin --prune
```
The `release-${stable}` branch is the stable fork's rebase base. The published `nixos-${stable}`
branch is the source for the stock stable flake input and can lag behind it.
3. Enumerate the patch stack before rebasing:
`git log --oneline upstream/nixos-unstable..origin/devplayer0` (and the stable equivalent
against `upstream/release-<STABLE>`). For each commit, check whether it has landed upstream or
@@ -66,12 +96,23 @@ For **both** branches — `devplayer0` onto `upstream/nixos-unstable`, and `devp
- ⏸ **Conflicts:** stop. Report which patch conflicts and against what upstream change; let the
maintainer resolve, or drop the patch if it has been upstreamed.
- Clean rebase: continue.
5. Summarize: which patches still apply, which are now redundant (candidate to drop), which
conflicted.
6. ⏸ **Push:** only after confirmation. `git push --force-with-lease origin devplayer0
5. If the upgrade includes requested upstream fixes, verify them on each new base. Cherry-pick
only where the fix is missing and use `git cherry-pick -x` to record the source commit. Check the
resulting package versions or patches on both fork branches and on the published channels.
6. Run `git range-diff <old-base>..<old-tip> <new-base>..<new-tip>` for both branches. Use the
fork's previous upstream bases for the old ranges. Present the comparison before asking to push,
identifying unchanged, modified, dropped, and added patches. For dropped or modified patches,
give the reason and cite the superseding upstream commit when applicable.
7. ⏸ **Push:** only after confirmation. `git push --force-with-lease origin devplayer0
devplayer0-stable` (force needed — rebase rewrites history).
8. Wait for the GitHub mirror used by the flake inputs to catch up with the primary fork remote.
Compare the local branch tips with
`git ls-remote https://github.com/devplayer0/nixpkgs.git refs/heads/devplayer0
refs/heads/devplayer0-stable` and do not continue until both match. Updating sooner can leave
`nixpkgs-mine` and `nixpkgs-mine-stable` pinned to the pre-rebase commits even though the push
succeeded.
## Phase 3 — Update the pinned inputs
## Phase 3 — Update nixpkgs and home-manager pins and review compatibility
Run together (they move as a set):
@@ -83,7 +124,39 @@ update-home-manager
Then show the `flake.lock` diff for the nixpkgs/home-manager entries so the old→new revisions are
visible.
## Phase 4 — Sweep version-gated behavior
Review the NixOS and home-manager modules and packages used by this repo against the previous and
candidate pins for their assigned channels. Use release notes and version and option changes to
identify removals, end-of-life versions, major upgrades, and changed defaults. Include packages
selected by service modules and local overrides. Prioritize stateful services and check upstream
migration notes for data formats, supported upgrade paths, extensions, and client compatibility.
Record the affected boxes, versions, and any action needed before switching. Surface changes that
could break a running app even if its configuration evaluates and builds.
⏸ Discuss channel moves or migrations with the maintainer before editing the affected service.
Use the compatibility decision in Phase 7 for any blockers found here.
## Phase 4 — Refresh kernels and release metadata
Update the repository values that deliberately move with nixpkgs upgrades:
1. In `lib/constants.nix`, inspect the kernel attributes available from the refreshed nixpkgs pins
and update both explicit selections:
- `kernel.lts` → the newest upstream long-term-support kernel carried by nixpkgs.
- `kernel.latest` → the newest kernel series carried by nixpkgs.
Keep explicit `pkgs.linuxKernel.packages.linux_X_Y` attributes rather than replacing them with
moving aliases. Confirm both attributes exist in the unstable and stable package sets used by
the boxes; if the newest choice is unavailable on stable, report that instead of breaking the
shared constant.
2. In `lib/default.nix`, update the `versionOverlay` values:
- Set the leading `YY.MM` in `trivial.release` to the current year and month. Preserve the
`:u-${prev.trivial.release}` suffix.
- If Phase 1 found a new NixOS stable release, ⏸ ask the maintainer to choose or approve a new
`trivial.codeName`, then update it as part of the coordinated stable bump. Otherwise retain the
existing codename.
Show these edits alongside the input changes in the upgrade summary.
## Phase 5 — Sweep version-gated behavior
The repo carries branch-conditional logic and TODOs keyed to specific nixpkgs versions; some become
removable after an upgrade, especially after a stable bump. Surface them:
@@ -97,29 +170,60 @@ Known example: `nixos/modules/common.nix` carries a `# TODO: Remove if-else when
guard. For each hit, evaluate whether the now-current versions make the guard removable and list
candidates. ⏸ Don't delete guards without confirmation — some protect the still-supported stable.
## Phase 5 — Review remaining flake inputs
## Phase 6 — Review remaining flake inputs
Don't blanket-update. Walk the other inputs deliberately:
1. List inputs and locked revisions from `flake.lock` (or `nix flake metadata`).
2. For each meaningful input (`libnetRepo`, `devshell`, `determinate-nix`, `ragenix`, `deploy-rs`,
`impermanence`, and the packaged apps like `boardie`, `harmonia`, `copyparty`, `sharry`, …),
compare the locked revision to upstream and summarize notable changes (breaking changes,
relevant fixes). Many inputs `follows` `nixpkgs-unstable` and already moved in Phase 3.
3. Propose a per-input update list with reasons; update the approved ones with targeted
`nix flake update <input>`, not a global update.
1. List all direct inputs with their locked revisions and configured refs. Include fixed release
tags, fork branches, and non-GitHub inputs. Identify which inputs already follow one of the
refreshed nixpkgs pins and which carry independent pins.
2. Compare each locked revision with the candidate revision on the configured branch or release
track. Review the intervening changelog, release notes, advisories, and changes to the interfaces
this repo uses. Summarize relevant fixes, breaking changes, and required configuration or build
changes. Report any comparison you could not complete.
3. Refresh the moving inputs and applicable release pins in the main upgrade with targeted
`nix flake update <input>` commands. Verify the resulting lock revisions against the reviewed
candidates, especially if the fetcher used cached refs. ⏸ Ask before switching release tracks,
changing an intentional compatibility pin, or deferring an update that needs a migration.
## Phase 6 — Validate
## Phase 7 — Validate
1. `nix flake check --no-build` (broad eval; reproduces CI's cheap checks).
1. `nix flake check --no-build` for broad validation. If `.#ciIfdReasons.x86_64-linux` lists
an active exception, use `nix flake check` so evaluation can build the required inputs.
2. `check-system <host>` on a representative box, and one exercising the stable channel if the
boxes mix channels.
3. Report eval/build results honestly. On failure, surface the error and stop rather than papering
over it.
boxes mix channels. This must exercise the refreshed kernel constants on both channels.
3. Build the actual devshell with
`nix build --no-link --print-out-paths .#devShells.x86_64-linux.default`. Evaluation does not
build its dependencies, so it cannot catch packaging conflicts introduced by inputs such as
Determinate Nix.
4. After the evaluations pass, run `build-system <host>` for one representative NixOS box. Prefer
the local box when it is managed by this flake: its full closure is likely to exercise the most
relevant packages, home-manager configuration and upgraded kernel. Build only; do not switch.
5. Fix mechanical compatibility errors that preserve service behavior. ⏸ If a package was removed,
reached end of life, or needs a major upgrade, explain the choices before editing the affected
service. Include the current configured version, the deployed version if verified, and the
available paths, such as a temporary channel move, a migration during this upgrade, or a
separate service change. Describe effects on persisted data, dependent services, cutover, and
rollback where relevant. Ask for a decision for each affected service and continue independent
validation while waiting. If the maintainer chooses a temporary pin, add a TODO beside it naming
the deferred migration and the condition for removing the pin.
6. Report eval/build results and any blockers. A build confirms that the configuration compiles.
Confirm the migration prerequisites separately before deployment.
## Wrap-up
Present a final summary: fork rebase outcome (patches kept/dropped/conflicted), whether a stable
bump is pending or was applied, the lock diff, version-gate cleanup candidates, inputs updated, and
validation results. Leave committing to the maintainer unless asked; if committing, follow the
repo's `area/scope: Capitalized summary` convention.
bump is pending or was applied, kernel and release-metadata changes, the lock diff, version-gate
cleanup candidates, inputs updated, and validation results. Leave committing to the maintainer
unless asked; if committing, follow the repo's `area/scope: Capitalized summary` convention.
Split the series into the procedure or skill changes, the pin and input refresh, and a separate
change for each service migration done during the upgrade. The refresh's description lists the
notable upgrades: kernels, stateful services that migrate data, other major version moves and
significant flake input releases, with old and new versions. This keeps the version history
readable in `jj log` after the progress document is gone.
Once the upgrade is deployed, move anything still open in the progress document to its durable
home: a TODO beside the pin or workaround it concerns, the affected box page, or a commit
message for a decision worth keeping. Then delete the progress document. The next upgrade starts
from those TODOs and pages rather than from an old progress document.
+105
View File
@@ -0,0 +1,105 @@
# Flashing an OpenWrt box
The shared agent skill is [`flash-openwrt`](../.agents/skills/flash-openwrt/SKILL.md).
Guided procedure for putting a flake-built OpenWrt image onto a box. The images themselves are
declared in [`openwrt/default.nix`](../openwrt/default.nix) and described in
[`deployment.md`](deployment.md#openwrt-images); the boxes are listed on their site pages (today
that is [fergal](sites/colony/fergal.md)).
Packages are baked into the image, so this runs whenever the package list changes — not only for
version upgrades. Work through the phases in order; ⏸ marks the point to stop and confirm.
## Phase 1 — Build
```sh
nix build .#openwrt-<box>
```
The result holds the `-squashfs-sysupgrade.bin` to flash, plus a `.manifest` listing every package
in the image and an SBOM. Check the manifest for the packages the change was meant to add — an
unknown package name is not an error at build time, it just silently isn't there.
## Phase 2 — Pre-flight
Confirm on the box:
```sh
grep -E 'RELEASE|REVISION' /etc/openwrt_release # what is running now
mount | grep -E ' / | /overlay | /rom ' # flash or RAM? (see below)
uci get network.lan.ipaddr # will it come back reachable?
cat /lib/upgrade/keep.d/* # what survives the flash
df -h /tmp # room for the image
```
**Flash or RAM matters.** A box booted normally shows a squashfs `/rom` plus a jffs2 `/overlay`;
one booted from an initramfs has `/` on tmpfs. The initramfs case has its own hazards — see
[Flashing from an initramfs](sites/colony/fergal.md#flashing-notes).
**Check the address is in UCI**, not just present on the interface. An address added by hand with
`ip` disappears on reboot and the box comes back unreachable.
`keep.d` normally lists `/etc/config/`, `/etc/dropbear/authorized_keys` and the dropbear host keys,
so an ordinary flash preserves both access and identity. Verify rather than assume — losing
`authorized_keys` on a box reachable only over SSH means a serial console recovery.
## Phase 3 — Back up
```sh
sysupgrade -b /tmp/<box>-config-backup.tar.gz
```
Fetch it with `ssh <box> 'cat /tmp/…' > local.tar.gz`. **`scp` does not work** — these boxes have no
`/usr/libexec/sftp-server`, so it fails with `Connection closed`. (`scp -O` forces the legacy
protocol if you prefer it.)
For a box being flashed off its **vendor** firmware for the first time, back up the whole flash
first — the vendor partitions hold per-unit MAC addresses and licence data that cannot be
regenerated. See [fergal's flash layout](sites/colony/fergal.md#flash-layout).
## Phase 4 — Stage and validate
```sh
ssh <box> 'cat > /tmp/sysupgrade.bin' < <image>.bin
ssh <box> 'sha256sum /tmp/sysupgrade.bin; sysupgrade -T /tmp/sysupgrade.bin'
```
Compare the sha256 against the local file, and require `sysupgrade -T` to exit 0. `-T` validates the
image and its device-compatibility metadata without writing anything, which is the last cheap chance
to catch a wrong-profile image.
## Phase 5 — Flash ⏸
Confirm before this point. It reboots the box and is not interruptible.
```sh
ssh <box> 'setsid sh -c "sleep 2; sysupgrade -v /tmp/sysupgrade.bin" \
</dev/null >/tmp/upgrade.log 2>&1 & echo detached'
```
**Detaching matters.** `sysupgrade` kills the SSH session partway through; without `setsid` the
upgrade dies with it, potentially after the flash has been erased. `nohup` is not available on these
boxes' busybox — use `setsid`.
Plain `sysupgrade` keeps the config in `keep.d`. Do not reach for `-c` out of caution: it needs
`/overlay/upper/etc` and aborts *after* erasing the firmware if that is missing.
## Phase 6 — Wait and verify
Poll SSH, not ping. A successful ping returns in milliseconds, so a naive "wait for it to go down"
loop finishes before the box has even started rebooting. Sleep between probes and wait on something
that only succeeds once userspace is up:
```sh
for i in $(seq 1 40); do
sleep 15
ssh -o ConnectTimeout=5 -o BatchMode=yes <box> 'grep REVISION /etc/openwrt_release' && break
done
```
Expect roughly three minutes. Then confirm the revision changed, the management address returned,
the package count matches the manifest, and the new packages are actually present and running.
Connecting without host-key overrides also confirms the host keys survived.
If the box does not return, it needs the serial console — have that confirmed as reachable *before*
Phase 5, not after.
+8
View File
@@ -224,6 +224,8 @@ These zones are served by [`river`](../sites/home/river.md) and
| `palace` | `AAAA` | `2a0e:97c0:4d0:1::2:1` |
| `palace-core` | `A` | `192.168.64.20` |
| `palace-kvm` | `A` | `192.168.72.21` |
| `portcullis` | `A` | `192.168.68.41` |
| `portcullis` | `AAAA` | `2a0e:97c0:4d0:1::6:1` |
| `reolink-living-room` | `A` | `192.168.72.45` |
| `river` | `A (LUA)` | `generated at query time` |
| `river` | `AAAA` | `2a0e:97c0:4df:0:1::1` |
@@ -243,6 +245,8 @@ These zones are served by [`river`](../sites/home/river.md) and
| `sfh` | `A` | `192.168.68.81` |
| `sfh` | `AAAA` | `2a0e:97c0:4d0:1::4:2` |
| `shytzel` | `A` | `192.168.64.12` |
| `slop-cannon` | `A` | `192.168.80.5` |
| `slop-cannon` | `AAAA` | `2a0e:97c0:4d0:3::5` |
| `stream` | `A (LUA)` | `generated at query time` |
| `stream` | `AAAA` | `2a0e:97c0:4df:0:1::2` |
| `stream-core` | `A` | `192.168.64.2` |
@@ -280,6 +284,7 @@ These zones are served by [`river`](../sites/home/river.md) and
| `192.168.68.2` | `stream-hi.h.nul.ie.` |
| `192.168.68.22` | `palace.h.nul.ie.` |
| `192.168.68.40` | `castle.h.nul.ie.` |
| `192.168.68.41` | `portcullis.h.nul.ie.` |
| `192.168.68.80` | `cellar.h.nul.ie.` |
| `192.168.68.81` | `sfh.h.nul.ie.` |
| `192.168.68.100` | `unifi-ctr.h.nul.ie.` |
@@ -291,6 +296,7 @@ These zones are served by [`river`](../sites/home/river.md) and
| `192.168.79.254` | `router-lo.h.nul.ie.` |
| `192.168.80.1` | `river-ut.h.nul.ie.` |
| `192.168.80.2` | `stream-ut.h.nul.ie.` |
| `192.168.80.5` | `slop-cannon.h.nul.ie.` |
| `192.168.80.254` | `router-ut.h.nul.ie.` |
<!-- dns-end -->
@@ -309,11 +315,13 @@ These zones are served by [`river`](../sites/home/river.md) and
| `2a0e:97c0:4d0:1::4:2` | `sfh.h.nul.ie.` |
| `2a0e:97c0:4d0:1::5:1` | `unifi-ctr.h.nul.ie.` |
| `2a0e:97c0:4d0:1::5:3` | `hass-ctr.h.nul.ie.` |
| `2a0e:97c0:4d0:1::6:1` | `portcullis.h.nul.ie.` |
| `2a0e:97c0:4d0:2::1` | `river-lo.h.nul.ie.` |
| `2a0e:97c0:4d0:2::2` | `stream-lo.h.nul.ie.` |
| `2a0e:97c0:4d0:2::ffff` | `router-lo.h.nul.ie.` |
| `2a0e:97c0:4d0:2::5:3` | `hass-ctr-lo.h.nul.ie.` |
| `2a0e:97c0:4d0:3::1` | `river-ut.h.nul.ie.` |
| `2a0e:97c0:4d0:3::2` | `stream-ut.h.nul.ie.` |
| `2a0e:97c0:4d0:3::5` | `slop-cannon.h.nul.ie.` |
| `2a0e:97c0:4d0:3::ffff` | `router-ut.h.nul.ie.` |
<!-- dns-end -->
+16 -5
View File
@@ -24,7 +24,7 @@
| `my.borgthin.jobs.<name>.repo` | string | `null` | borg repository URL |
| `my.borgthin.jobs.<name>.timer.at` | string or list of string | `"5:00"` | systemd calendar time(s) to run backup at |
| `my.borgthin.jobs.<name>.timer.persistent` | boolean | `false` | Persistent systemd timer |
| `my.borgthin.lvmPackage` | package | `<derivation lvm2-2.03.39>` | Packge containing LVM tools |
| `my.borgthin.lvmPackage` | package | `<derivation lvm2-2.03.41>` | Packge containing LVM tools |
| `my.borgthin.package` | package | `inputs.borgthin.packages.${system}.borgthin` | borgthin package |
| `my.borgthin.thinToolsPackage` | package | `<derivation thin-provisioning-tools-1.3.2>` | Package containing thin-provisioning-tools |
@@ -95,6 +95,7 @@
| `my.deploy.node.sudo` | null or string | `null` | Command to elevate privileges with (used if the deployment user != profile user). |
| `my.deploy.node.tempPath` | null or string | `null` | Path that deploy-rs will use for temporary files. |
| `my.deploy.node.user` | null or string | `null` | Username deploy-rs will deploy with. |
| `my.deploy.sshHostnames` | list of string | `[ ]` | Addresses for ssh-machine in order of preference. Defaults to the deploy-rs hostname. |
## `dynamic-motd` — [`nixos/modules/dynamic-motd.nix`](../../nixos/modules/dynamic-motd.nix)
@@ -167,7 +168,7 @@
| `my.nginx-sso.includes.instances.<name>.auth.redirect` | string | `"$scheme://$http_host$request_uri"` | URL to redirect to upon successful login. |
| `my.nginx-sso.includes.instances.<name>.logout.path` | string | `"/sso-logout"` | HTTP path for SSO logout. |
| `my.nginx-sso.includes.instances.<name>.logout.redirect` | string | `"$scheme://$http_host/"` | URL to redirect to upon successful logout. |
| `my.nginx-sso.package` | package | `<derivation nginx-sso-0.27.7>` | nginx-sso package to use. |
| `my.nginx-sso.package` | package | `<derivation nginx-sso-0.27.9>` | nginx-sso package to use. |
## `nvme` — [`nixos/modules/nvme`](../../nixos/modules/nvme)
@@ -177,6 +178,16 @@
| `my.nvme.boot.nqn` | null or string | `null` | NQN to connect to on boot |
| `my.nvme.uuid` | null or string | `null` | NVMe host ID |
## `paseo-relay` — [`nixos/modules/paseo-relay.nix`](../../nixos/modules/paseo-relay.nix)
| Option | Type | Default | Description |
|---|---|---|---|
| `my.paseo-relay.enable` | boolean | `false` | Whether to enable the Paseo relay. |
| `my.paseo-relay.environment` | attribute set of (string or signed integer or boolean) | `{ }` | Extra `PASEO_RELAY_*` environment variables (see the relay's README). |
| `my.paseo-relay.host` | string | `"127.0.0.1"` | Address to listen on. |
| `my.paseo-relay.package` | package | `<derivation paseo-relay-0.1.0-unstable-2026-10-28>` | Paseo relay package. |
| `my.paseo-relay.port` | 16 bit unsigned integer; between 0 and 65535 (both inclusive) | `4000` | Port to listen on (plain HTTP / WebSocket). |
## `pdns` — [`nixos/modules/pdns.nix`](../../nixos/modules/pdns.nix)
| Option | Type | Default | Description |
@@ -217,7 +228,7 @@
| `my.spdk.config.subsystems` | attribute set of list of (submodule) | `{ }` | Subsystem config / RPCs. |
| `my.spdk.config.subsystems.<name>.*.method` | string | `null` | RPC method name. |
| `my.spdk.config.subsystems.<name>.*.params` | attribute set of unspecified value | `{ }` | RPC params |
| `my.spdk.debugCommands` | strings concatenated with "\n" | `""` | Commands to run with the spdk-debug script. |
| `my.spdk.debug.ublkDisks` | list of string | `[ ]` | Bdevs `spdk-debug` exposes as `/dev/ublkb<n>`, numbered from 1, instead of serving the config. |
| `my.spdk.enable` | boolean | `false` | Whether to enable SPDK target. |
| `my.spdk.extraArgs` | string | `""` | Extra arguments to pass to spdk_tgt. |
@@ -276,11 +287,11 @@
| `my.vms.instances.<name>.networks.<name>.model` | string | `"virtio-net"` | Device type for network interface. |
| `my.vms.instances.<name>.networks.<name>.tapFD` | null or (unsigned integer, meaning >=0) | `null` | FD to use to pass existing TAP device. |
| `my.vms.instances.<name>.networks.<name>.waitOnline` | boolean or string | `true` | Whether to wait for networkd to consider the bridge / existing TAP device online. Pass a string to set the OPERSTATE will wait for. |
| `my.vms.instances.<name>.qemuBin` | absolute path | `"/nix/store/w4yhckm5wyvml3pqw8ai5fl174j14nrb-qemu-host-cpu-only-11.0.0/bin/qemu-kvm"` | Path to QEMU executable. |
| `my.vms.instances.<name>.qemuBin` | absolute path | `"/nix/store/ziacjpynpg4536dll8ja4qs1la0fvn7l-qemu-host-cpu-only-11.1.2/bin/qemu-kvm"` | Path to QEMU executable. |
| `my.vms.instances.<name>.qemuFlags` | list of string | `[ ]` | Additional flags to pass to QEMU. |
| `my.vms.instances.<name>.smp.cpus` | unsigned integer, meaning >=0 | `1` | Number of CPU cores. |
| `my.vms.instances.<name>.smp.threads` | unsigned integer, meaning >=0 | `1` | Number of threads per core. |
| `my.vms.instances.<name>.spice.enable` | boolean | `true` | Whether to enable SPICE. |
| `my.vms.instances.<name>.uuid` | string | `null` | QEMU machine UUID. |
| `my.vms.instances.<name>.vga` | string | `"virtio"` | VGA card type. |
| `my.vms.ovmfPackage` | package | `<derivation OVMF-202602>` | OVMF package. |
| `my.vms.ovmfPackage` | package | `<derivation OVMF-202608>` | OVMF package. |
+11
View File
@@ -53,6 +53,17 @@ the host.
- Sets `system.nixos.distroName = "KelderOS"`, a custom Plymouth theme and an `amogus-beep`
boot jingle ([`boot.nix`](../../../nixos/boxes/kelder/boot.nix)).
## Returning to service
kelder is out of service and missed the November 2026 upgrade's live checks. Before its first
deploy after it returns:
- Back up the `kelder-acquisition` state. The deploy moves Jellyfin to 12, Radarr to 7 and
Sonarr to 5, and each migrates its database on start. Check playback, a search, download and
import, and the Samba share afterwards.
- Plan the `kelder-spoder` Nextcloud migration from its
[page](containers/kelder-spoder.md) and the TODO beside its `mine-stable` pin.
## Notable config files
- [`nixos/boxes/kelder/default.nix`](../../../nixos/boxes/kelder/default.nix) — system, assignments, tunnel, NAT, containers.
@@ -5,13 +5,15 @@ the site's services.
- **Source:** [`nixos/boxes/kelder/containers/spoder/`](../../../../nixos/boxes/kelder/containers/spoder)
- **Host:** NixOS container on [`kelder`](../README.md)
- **nixpkgs:** `mine`
- **nixpkgs:** `mine-stable` until the Nextcloud migration.
## Role
- **Nextcloud** (`nextcloud32`) at `cloud.hentai.engineer` (trusted alias
`cloud-local.hentai.engineer`), SQLite backend, data in `/mnt/storage/nextcloud`
(`/mnt/storage` is bind-mounted from the host).
The package is temporarily allowlisted at `32.0.15`. Check the live version before planning
the migration because Nextcloud upgrades must proceed one major version at a time.
- **nginx reverse proxy** (`openresty`) terminating TLS for the site's public vhosts, with a
wildcard ACME cert for `hentai.engineer` via Cloudflare DNS. The kelder host forwards
`http`/`https` to this container; uploads are unlimited (`clientMaxBodySize = 0`) for
+7
View File
@@ -24,9 +24,16 @@ prefixes and routing overview are in the [`colony` section of networking.md](../
| [`git`](git.md) | Gitea + Gitea Actions runner |
| [`mail`](mail.md) | Debian VM running mailcow (not NixOS) |
| [`darts`](darts.md) | Third-party/customer VM (not NixOS) |
| [`portcullis`](portcullis.md) | Bare-metal edge box for Nikhef; being staged, not yet in service |
The applications running on `shill` are listed on its own page — see
[shill/README.md](shill/README.md#containers).
`mail` and `darts` are host-defined VMs whose guest operating systems are managed out of band; their
pages document only what this repository controls.
`portcullis` is new hardware headed for Nikhef that will take over most of `estuary`'s edge routing.
It is not deployed yet and the resulting topology is still being worked out. It travels with
[`fergal`](fergal.md), an OpenWrt SFP+ switch whose firmware this flake builds; both are staged at
home for now, borrowing the home fabric through
[jim](../home/switches.md#fergal-portculliss-switch).
+45
View File
@@ -86,6 +86,51 @@ See the consolidated [network assignments](../../networking.md#box-assignments)
public IP (so the port forwards also work from inside), and forwards the
customer prefixes through with minimal filtering ("trust for now").
## BMC
The board's AMI-based BMC provides the web UI, remote console and IPMI over LAN.
- The dedicated management port is LAN channel 1, with the static address `198.18.10.38/24`
and gateway `198.18.10.254` in Coloclue's management network. Channel 8 holds the unused
shared-NIC configuration.
- The host reaches the BMC in-band through `ipmi_si` (`/dev/ipmi0`), which Netdata's FreeIPMI
plugin also uses. `ipmitool` is installed for this.
### In-band recovery
While `colony` is running, root can change the BMC's LAN settings, users and passwords, or
restart it, without network access or BMC credentials:
```sh
ssh-machine colony doas ipmitool lan print 1
```
- Pass multi-command scripts on stdin with `ssh-machine colony bash -s`. `ssh-machine`
flattens a quoted `sh -c` argument.
- "Received a response with unexpected ID" warnings are harmless.
- `ipmitool mc reset cold` restarts only the BMC, not the host.
- In-band recovery needs the host to be up. Change and verify the BMC's network settings from
outside before rebooting `colony`, not together with a reboot.
### Changing the LAN settings
Save the current settings with `lan print 1`, then apply the new ones. Set the gateway last so
that it falls inside the new subnet:
```sh
ssh-machine colony bash -s <<'EOF'
doas ipmitool lan set 1 ipsrc static
doas ipmitool lan set 1 ipaddr 198.18.10.38
doas ipmitool lan set 1 netmask 255.255.255.0
doas ipmitool lan set 1 defgw ipaddr 198.18.10.254
doas ipmitool lan print 1
EOF
```
- From outside, check `ipmitool -I lanplus -H <address> -U admin chassis status` and the
remote console in the web UI.
- To roll back, run the same commands with the previous values.
## VMs
Declared in `my.vms.instances` (`cpus`/`threads` are QEMU `smp` values):
+27 -9
View File
@@ -27,16 +27,17 @@ See the consolidated [network assignments](../../networking.md#box-assignments)
- `wan` — the passed-through `igb` NIC (9000 MTU, enlarged rings). It carries
the plain upstream uplink (static v4/v6 with gateways from the `internal`
assignment) plus the tagged `ifog` VLAN.
assignment) plus the tagged `ifog` and `clue-ix` VLANs.
- `ifog` (VLAN 409) is an iFog QinQ transport that carries the IXP VLANs as
nested tags:
nested tags. `clue-ix` sits directly on `wan`:
| Interface | VLAN | IPv4 | IPv6 | Purpose |
|---|---|---|---|---|
| `frys-ix` | 701 | `185.1.160.196/23` | `2001:7f8:10f::3:3850:196/64` | Frys-IX peering LAN |
| `nl-ix` | 1845 | `193.239.116.145/22` | `2001:7f8:13::a521:1024:1/64` | NL-ix peering LAN |
| `fogixp` | 1147 | `185.1.147.159/24` | `2001:7f8:ca:1::159/64` | FogIXP peering LAN |
| `ifog-transit` | 702 | — | `2a0c:9a40:100f:370::2/64` | iFog IPv6 transit |
| Interface | Parent | VLAN | IPv4 | IPv6 | Purpose |
|---|---|---|---|---|---|
| `clue-ix` | `wan` | 121 | — | `2001:7f8:154::21:1024:1/64` | Clue-IX peering LAN |
| `frys-ix` | `ifog` | 701 | `185.1.160.196/23` | `2001:7f8:10f::3:3850:196/64` | Frys-IX peering LAN |
| `nl-ix` | `ifog` | 1845 | `193.239.116.145/22` | `2001:7f8:13::a521:1024:1/64` | NL-ix peering LAN |
| `fogixp` | `ifog` | 1147 | `185.1.147.159/24` | `2001:7f8:ca:1::159/64` | FogIXP peering LAN |
| `ifog-transit` | `ifog` | 702 | — | `2a0c:9a40:100f:370::2/64` | iFog IPv6 transit |
The IXP interfaces run at 1500 MTU with DHCP/RA/LLDP off; an nftables `ixp`
chain rejects non-IP/ARP ethertypes in both directions.
@@ -112,10 +113,11 @@ BIRD2 ([`bgp.nix`](../../../nixos/boxes/colony/vms/estuary/bgp.nix)) speaking **
| ColoClue | AS8283 | Upstream | `euNetworks` 2/3, v4+v6 |
| iFog | AS34927 | Upstream | IPv6 transit |
| Hurricane Electric | AS6939 | Upstream | IPv6 over Frys-IX |
| Clue-IX | AS218511 | IXP route server | rs1/rs2, IPv6 only; `rs_client` role and GTSM |
| Frys-IX | AS56393 | IXP route server | |
| NL-ix | AS34307 | IXP route server | lower preference |
| FogIXP | AS47498 | IXP route server | |
| LUJE.net | AS212855 | Direct peer | ColoClue/Frys-IX/FogIXP + multihop labs |
| LUJE.net | AS212855 | Direct peer | Clue-IX (IPv6), Frys-IX/FogIXP/NL-ix (v4+v6); NL-ix lower preference; multihop labs |
| jurrian | AS212635 | Direct peer | |
| Meta | AS32934 | Direct peer | Frys-IX/NL-ix |
| Cloudflare | AS13335 | Direct peer | Frys-IX |
@@ -127,9 +129,25 @@ Statics originate the site prefixes: the `vip*` ranges via `base`, the
ams1/internal v6 prefixes via `base`/`as211024`, and the home /48 towards the
home routers' `as211024` VIP.
NL-ix direct peers use `nlix_peer_bgp4` / `nlix_peer_bgp6`, which inherit the
normal peer policy with preference `PREFPEER-1`. Meta uses the same lower
NL-ix preference as the other direct peers.
Currently disabled (commented out): efero transit over FogIXP ("not working so
well lately") and the NL-ix Cloudflare sessions.
Clue-IX uses IPv6-only RIPE policy entries under the existing IXP remarks:
```rpsl
remarks: \/\/ Clue-IX route servers \/\/
mp-import: afi ipv6.unicast from AS218511 accept AS218511:AS-CLUE-IX
mp-export: afi ipv6.unicast to AS218511 announce AS211024:AS-DEVPLAYER0
```
One pair covers both route servers. See [RIPE routing policy and peering
records](../../networking.md#ripe-routing-policy-and-peering-records) for the shared attribute
convention and update procedure.
## VPNs
### `as211024` L2 mesh
+105
View File
@@ -0,0 +1,105 @@
# fergal
An 8-port SFP+ switch running OpenWrt, bought to sit in front of
[`portcullis`](portcullis.md) at Nikhef. It is physically at home for now, on the bench alongside
`portcullis` while that box is staged.
- **Source:** firmware built by this flake — [`openwrt/default.nix`](../../../openwrt/default.nix)
- **Host:** bare metal
- **OS:** OpenWrt (snapshot), configured through UCI rather than RouterOS or a UniFi controller
## Hardware
| Component | Inventory |
|---|---|
| Platform | XikeStor SKS8300-8X; the board itself is branded ONTi ONT-S508CL-8S |
| SoC | Realtek RTL9303 (MIPS 34Kc) |
| Memory | 512 MB |
| Storage | 32 MiB SPI NOR (`spi0.0`) |
| Network | 8×SFP+ (`lan1`…`lan8`) |
| Console | Front-panel RJ-45 RS-232 at 9600 baud, 8N1, for stock U-Boot and OpenWrt. [OpenWrt board support](https://lists.infradead.org/pipermail/lede-commits/2025-January/024155.html) |
## Role
`portcullis`'s 10G switch. Nothing else depends on it, and it is not part of the home fabric — it
is expected to travel to Nikhef with `portcullis` rather than stay behind.
While staged at home it hangs off jim's spare SFP+ port, so `portcullis` can reach the home `hi`
VLAN over 10G: `lan1` uplinks to jim's `sfp-spare`, `lan2` goes to `portcullis`, and the other six
cages are empty. See [the home switches](../home/switches.md) for the fabric it borrows.
## Network assignments
fergal has no assignments — it is not managed by the flake. Its management address is
`192.168.64.30` on the home `core` VLAN, set in UCI as `network.lan`, with no DNS record; reach it
as `ssh root@192.168.64.30`.
## VLAN configuration
One bridge (`switch`), with VLAN 1 as the untagged PVID on every port — that's the native VLAN on
jim's `sfp-spare`, and `switch.1` is where fergal's own management address lives. `hi` (100) and
`lo` (110) are **tagged** members of every port, so a box on any cage can pick them up:
```
uci show network | grep bridge-vlan
```
Tagging all eight rather than just `lan1`/`lan2` keeps a spare cage usable without a reconfigure;
there is nothing sensitive behind it while fergal is on the bench.
**Jumbo frames pass, despite what `ip link` says.** Every DSA port and the `switch` bridge read
`mtu 1500`, but the RTL9303 forwards between ports in hardware and isn't bound by those — a
`ping -M do -s 8972` from `portcullis` to the `hi` VIP crosses fergal intact, which is what makes
the 9000-MTU `hi` VLAN usable over this path. The 1500 does apply to traffic punted to the CPU,
i.e. fergal's own management on `switch.1`.
## Firmware
The image is built by this flake — see [OpenWrt images](../../deployment.md#openwrt-images) for the
outputs and the feed pin. Packages are baked into the image, so adding tooling means editing
[`openwrt/default.nix`](../../../openwrt/default.nix) and reflashing rather than installing on the
box.
### Flash layout
A single 32 MiB SPI NOR chip (`spi0.0`, 64 KiB erase blocks). `kernel` and `rootfs` are
sub-partitions of `firmware`, and OpenWrt adds `rootfs_data` as the JFFS2 overlay after a real
flash.
| Partition | Device | Offset | Size |
|---|---|---|---|
| `u-boot` | `mtd0` | `0x000000` | 1 MiB |
| `board-info` | `mtd1` | `0x100000` | 192 KiB |
| `syslog` | `mtd2` | `0x130000` | 832 KiB |
| `firmware` | `mtd3` | `0x200000` | 30 MiB |
**`board-info` is irreplaceable.** It holds the unit's MAC addresses (`[vlanmac]` / `[cpumac]`), its
`[license]` hash, the stock boot pointers and an SSH host key — only about 1.3 KiB of it is
non-blank, and none of it can be regenerated. A full dump of all four partitions, taken before
OpenWrt was flashed, is kept outside this repo — 33 MB of images, with per-partition checksums and
restore notes. Never write `u-boot` or `board-info` without a confirmed serial/TFTP recovery path.
### Flashing notes
The procedure itself is in [`openwrt-flash.md`](../../openwrt-flash.md); what follows is specific to
this board.
Stock u-boot boots `flash:/nos.img` from a JFFS2 filesystem, so OpenWrt's sysupgrade image is
itself a JFFS2 image containing `nos.img` rather than a raw kernel + squashfs. Two things bite when
flashing from an initramfs, as during the initial install:
- **`sysupgrade -c` does not work.** It needs `/overlay/upper/etc`, which doesn't exist when running
from RAM, and it aborts *after* `mtd erase firmware` has already run — leaving the box with no
bootable firmware until the job is finished. Pass the config as an explicit tarball instead
(`tar czf`, then `sysupgrade -f <tarball> …`).
- **The working management address may not be in UCI.** If it was set by hand with `ip` while UCI
still held the stock address, the box comes back unreachable. Write it into `network.lan` and
commit before flashing.
Neither applies to an ordinary flash-to-flash upgrade, where `sysupgrade` keeps `/etc/config` and
the files listed in `/lib/upgrade/keep.d/` by default. Dropbear host keys are regenerated by a flash
that doesn't preserve them, so clear the old `known_hosts` entry afterwards.
## Notable config files
- [`openwrt/default.nix`](../../../openwrt/default.nix) — image definition and baked-in package list.
+11
View File
@@ -20,6 +20,15 @@ The Git forge at `git.nul.ie` (self-registration disabled), configured in
`gitea`, on [`object`](shill/containers/object.md)) — the secret is spliced into `app.ini` at
startup.
- Mail goes out via `mail.nul.ie`, including the issue-reply incoming-mail poller.
- **Sign-in with Pocket ID:** `preStart` adds or updates the `id.nul.ie` OpenID Connect login
source. The client `gitea` and its secret `gitea/oidc-secret.txt` are declared on
[`middleman`](shill/containers/middleman.md#pocket-id).
- Registration stays disabled, so a Pocket ID sign-in can't create an account. The first one
links to an existing account after signing in with its password.
- It runs before the server, which only reads login sources at startup. If it fails, Gitea
starts without the source and logs a warning.
- The CLI only takes the secret as an argument, so it is briefly visible in the process list
while `preStart` runs.
### Gitea Actions runner
@@ -29,6 +38,8 @@ One Docker-mode instance (`main-docker`) on podman (privileged, `podman` network
- Labels for `node:24-trixie` and the self-built `git.nul.ie/dev/actions-ubuntu:26.04` images.
- Runs as a fixed `gitea-runner` user (not `DynamicUser`) so it can read its token; jobs have a
configured timeout.
- Gitea's `actions.ENDLESS_TASK_TIMEOUT` matches the runner's job timeout. Otherwise the server's
shorter default marks long builds as failed while the runner keeps working on them.
- The action cache lives on a dedicated disk (`/var/cache/gitea-runner`).
- Executes the repo's own `.gitea/workflows/ci.yaml`.
+12
View File
@@ -33,6 +33,18 @@ The VM attaches to a dedicated, unbridged TAP (`vm-mail`). `colony` puts the poi
estuary's reverse zone). `estuary` accepts traffic to the customer prefixes
without per-port filtering; `colony` forwards it on ("trust for now").
## Sign-in with Pocket ID
mailcow's Generic-OIDC identity provider signs mailboxes in to the mailcow UI and SOGo with
Pocket ID on [`middleman`](shill/containers/middleman.md#pocket-id).
- The `mailcow` client is declared in `middleman`'s `auth.nix`; its secret
`mailcow/oidc-secret.txt` is only deployed there. On the mailcow side the provider is set up
by hand under System → Configuration → Access → Identity Provider, with that secret pasted in.
- Only mailboxes whose auth source is the identity provider use it. IMAP, SMTP and the DAV and
ActiveSync clients can't follow a redirect, so those mailboxes use mailcow app passwords there.
- Admin and domain-admin logins are unaffected.
## Notes
- ACME certificates are issued on `middleman` and pushed to the VM over SSH
+120
View File
@@ -0,0 +1,120 @@
# portcullis
A bare-metal box destined for Nikhef, intended to take over most of the colony edge
routing currently done by the [`estuary`](estuary.md) VM.
- **Source:** [`nixos/boxes/colony/portcullis/`](../../../nixos/boxes/colony/portcullis)
- **Host:** bare metal
- **nixpkgs:** `mine-stable`
## Hardware
| Component | Inventory |
|---|---|
| Platform | Mini PC (no vendor DMI strings) |
| CPU | Intel N150 (4 cores / 4 threads) |
| Memory | 8 GiB |
| Storage | One 128 GB NVMe SSD (`nvme0n1`), partitioned as a 2 GiB ESP plus an LVM PV holding the `nix` and `persist` volumes |
| Network | Four Intel I226-V 2.5 GbE ports (`et2g5-0`…`et2g5-3`) and one dual-port Intel 82599ES 10 GbE SFP+ card (`et10g-0`, `et10g-1`) |
| Management | JetKVM (HDMI/USB KVM with virtual media) |
The PCIe layout constrains what the cards can reach. The 82599ES sits behind a gen2 x4 link giving
16 Gb/s for **both** its ports together, so one port runs at line rate but the pair is
oversubscribed. The NVMe is on a x1 root port, capped near 7.9 Gb/s regardless of the drive. Each
I226-V has its own x1 link and is not constrained.
## Role
Not yet in service. The eventual job is to be the physical edge for the colony site at Nikhef,
taking over most of what `estuary` does today — WAN termination, firewalling and NAT, BGP for
AS211024 and DNS. Some of that functionality stays on `estuary`, and the surrounding network
topology will change with the move, so the split is not settled yet. Until it is, the config in
this repository covers only what is needed to boot and reach the box.
## Network assignments
`portcullis` has no colony assignments yet — those land alongside the routing config once the
topology is decided. While it is staged at home it holds a single home `hi` assignment, listed in
[`networking.md#box-assignments`](../../networking.md#box-assignments).
## Networking
- The four I226-V ports are named `et2g5-0`…`et2g5-3` and the 82599ES SFP+ ports `et10g-0` /
`et10g-1`, pinned by permanent MAC address in `.link` files.
- Bootstrap: a single `.network` matches every `et2g5-*` port and takes DHCP on the home `lo` VLAN,
so whichever port happens to be patched in brings the box up. `wait-online.anyInterface` keeps
boot from blocking on the unpatched ports.
- kea registers the DHCP hostname, so while staged the box also answers to `portcullis.dyn.h.nul.ie`.
- `my.deploy.node.hostname` is the `hi` address, taken from the assignment rather than written out,
since there is no colony FQDN for the box yet.
### 10G to the home `hi` VLAN
`et10g-0` runs over fibre to [`fergal`](fergal.md), which uplinks to jim's `sfp-spare` port. That
uplink is untagged VLAN 1, so `hi` is carried tagged on a `lan-hi` VLAN interface rather than on the
port itself; the physical link takes the `hi` jumbo MTU so the whole path is consistent with the
rest of the VLAN. `lan-hi` carries the static assignment, resolves through the router VIPs like
every other `hi` client, and its gateway route outranks the DHCP default, so the 10G path is
preferred while the 2.5G one stays as a fallback.
Both jim and `fergal` tag `hi` and `lo` along that path. It exists only while the box is staged at
home — `fergal` goes to Nikhef with it.
The other SFP+ port, `et10g-1`, is unused.
### Interface tuning
Every port takes router-sized 4096-entry rings rather than the driver defaults, matching the other
routers here, and enables `GenericReceiveOffloadUDPForwarding` so GRO batching survives forwarding
once the box carries UDP-encapsulated traffic. Both are `.link` settings, so they apply on the next
device event rather than at switch time — a reboot is the reliable way to land a change to them.
Interrupt coalescing is deliberately left alone. `igc` reports `rx-usecs` 3 and `ixgbe` reports 1,
which are the drivers' markers for dynamic ITR rather than literal microseconds; writing a
plausible-looking value there replaces adaptive moderation with a fixed one.
### I226-V erratum
The I226-V link-drop erratum is driven by PCIe ASPM, Energy Efficient Ethernet and stale NIC
firmware. ASPM, the dominant cause, is off across the whole box for the reason in
[Power](#power) below. EEE is held off by a udev rule invoking `ethtool`, as `systemd.link` has no
knob for it. `igc` already leaves EEE off on these ports, so the rule pins a driver default rather
than correcting one, and keeps it from drifting on a kernel bump. Firmware is the remaining item:
the ports report NVM `2.13` (EEPROM version word `0x2013`, which `igc` prints as the `2013` in
`ethtool -i`), behind the `2.29`/`2.32` images that circulate. Intel does not publish the I226-V
NVM image, so updating means third-party firmware and is best attempted while the box is at home
and the JetKVM is attached.
## Power
The SoC side is already at its floor and needs no tuning: the package draws around 0.75 W idle with
cores in C10 essentially all the time, under `intel_pstate` on the `powersave` governor.
Platform idle is capped instead, and deliberately left that way. The ACPI FADT declares that the
system does not support PCIe ASPM, so the OS defers to firmware, every root port advertises ASPM as
unsupported and every endpoint sits with it disabled. Deep package C-states need every PCIe link in
L1, so the package never leaves C3. `pcie_aspm=force` is the usual answer and is **not** used here:
the 82599ES advertises only L0s with an unlimited exit latency, so no amount of forcing reaches the
deep states while that card is fitted, and the only links it would actually change are the four
I226-V ones — the exact configuration behind the erratum above. Recovering that power is a firmware
question for the mini PC, and only worthwhile once the 82599ES is gone.
`iommu=pt` puts host devices in passthrough so the forwarding path does not pay DMA translation,
while leaving the IOMMU available.
## Storage
A single NVMe SSD, following the usual tmpfs-root layout: a 2 GiB ESP at `/boot`, then one LVM PV
in volume group `main` carrying `portcullis-nix` (48 GiB, `/nix`) and `portcullis-persist` (the
remainder, `/persist`).
## Secrets
`my.secrets.key` is the SSH host key adopted from the installer session at install time (seeded onto
the persist volume before first boot), so secrets could be encrypted for the box without waiting for
it to come up. The box declares nothing of its own yet — only the default `user-passwd.txt` that
`my.user` brings in.
## Notable config files
- [`nixos/boxes/colony/portcullis/default.nix`](../../../nixos/boxes/colony/portcullis/default.nix) — hardware, filesystems and bootstrap networking.
+2 -2
View File
@@ -48,12 +48,12 @@ their current addresses. Each container has its own page:
| Container | Role |
|---|---|
| [`middleman`](containers/middleman.md) | Reverse proxy, ACME, nginx-sso, librespeed |
| [`middleman`](containers/middleman.md) | Reverse proxy, ACME, Pocket ID and SSO, librespeed, Paseo relay |
| [`vaultwarden`](containers/vaultwarden.md) | Password manager |
| [`colony-psql`](containers/colony-psql.md) | Shared PostgreSQL (14) |
| [`chatterbox`](containers/chatterbox.md) | Matrix Synapse + bridges |
| [`jackflix`](containers/jackflix.md) | Media stack |
| [`object`](containers/object.md) | MinIO, Harmonia Nix cache, Sharry, HedgeDoc, wastebin |
| [`object`](containers/object.md) | MinIO, Harmonia Nix cache, HedgeDoc, wastebin |
| [`toot`](containers/toot.md) | Bluesky PDS (Mastodon disabled) |
| [`waffletail`](containers/waffletail.md) | Tailscale subnet router / exit node |
| [`qclk`](containers/qclk.md) | WireGuard management appliance |
@@ -9,13 +9,13 @@ database, the containers (and the `git` VM) connect here over the `ctrs` network
## Role
- **PostgreSQL 14** with TCP/IP enabled, reachable from the whole colony address space using `md5`
- **PostgreSQL 18** with TCP/IP enabled, reachable from the whole colony address space using `md5`
authentication. The firewall allows `5432`.
- Local `peer` auth maps `postgres`, `root`, `netdata` and `dev` to the `postgres` superuser via
the ident map.
- **netdata** with the Python PostgreSQL collector.
- Consumers wait for the database to accept connections with the `lib.my.systemdAwaitPostgres`
helper (e.g. `sharry`, `atticd`, `mastodon-init-db`, and `middleman`'s nginx as a DNS
helper (e.g. `atticd`, `mastodon-init-db`, and `middleman`'s nginx as a DNS
bootstrap hack).
## Network assignments
@@ -27,7 +27,7 @@ use as the database hostname.
## Consumers
- [object](object.md) — `sharry` and `hedgedoc` (and `atticd` when enabled) over
- [object](object.md) — `hedgedoc` (and `atticd` when enabled) over
`colony-psql:5432`
- [toot](toot.md) — Mastodon's database (Mastodon currently disabled)
- [chatterbox](chatterbox.md) — the mautrix bridges (WhatsApp, Messenger, Instagram) via
+72 -14
View File
@@ -2,11 +2,11 @@
The front-end reverse proxy for the colony's public web services — the single ingress that
`estuary` DNATs HTTP/HTTPS (and Matrix federation on `:8448`) to. Terminates TLS with wildcard
certificates it issues itself, provides nginx-sso for gated vhosts, and runs a librespeed
backend.
certificates it issues itself, runs the Pocket ID identity provider with oauth2-proxy in front of
gated vhosts, and runs a librespeed backend and a Paseo relay.
- **Source:** [`shill/containers/middleman/`](../../../../../nixos/boxes/colony/vms/shill/containers/middleman)
(`default.nix`, `vhosts.nix`)
(`default.nix`, `auth.nix`, `vhosts.nix`)
- **Host:** NixOS container on [`shill`](../README.md) (`my.containers` ephemeral nspawn on the
`ctrs` bridge; bind-mounts `/mnt/media` read-only for the static file vhosts)
- **nixpkgs:** `mine`
@@ -27,21 +27,76 @@ also waits for `colony-psql` through `systemdAwaitPostgres`, avoiding an early-b
- `ams1.int.nul.ie` and its wildcard use a lego `exec` challenge that SSHes to
`pdns-file-records@estuary-vm`. This is the default `useACMEHost` certificate internally.
- `nul.ie`, `*.nul.ie` and `*.s3.nul.ie` use Cloudflare DNS. A `postRun` hook copies renewed
material to the `mail` VM and runs `mailcow-ssl-reload` there.
- `nul.ie`, `*.nul.ie`, `*.s3.nul.ie` and `*.slop.nul.ie` (for `slop-broker` previews) use
Cloudflare DNS. A `postRun` hook copies renewed material to the `mail` VM and runs
`mailcow-ssl-reload` there.
- Renewal reloads nginx; the `acme` group owns the secret files and includes the nginx user.
### nginx-sso
### Pocket ID
The `generic` SSO instance at `sso.nul.ie` uses Google OAuth by default and also offers a simple
username/password provider. Its cookie domain is `.nul.ie`; gated vhosts include the generated
`server-generic.conf` / `location-generic.conf` snippets from `/etc/nginx/includes/sso/`.
[Pocket ID](https://pocket-id.org) (`services.pocket-id`) is a passkey-only OpenID Connect
provider at `id.nul.ie`. Apps with OIDC support sign in with it directly (such as the
[`slop-broker` approvals web app](../../../../slop-broker.md#approvals-web-app)); the rest go
through [oauth2-proxy](#sso).
- Listens on `127.0.0.1:1411` behind nginx and keeps its SQLite database in `/var/lib/pocket-id`
(persisted by `my.tmproot`). The `middleman/pocket-id-encryption-key` secret encrypts it.
- The first admin is created at `/setup`; nginx only allows that page and its API from
internal networks (`lib.my.c.internalNets`). Further users are added from the admin UI.
**Declared groups and clients.** `my.pocket-id` (in
[`auth.nix`](../../../../../nixos/boxes/colony/vms/shill/containers/middleman/auth.nix)) declares
user groups and OIDC clients; `pocket-id-sync` creates and updates them through the API on every
switch.
- It authenticates with the static API key `middleman/pocket-id-api-key`. nginx strips
`X-API-Key` from outside requests, so API keys only work from inside the container.
- Clients and groups that aren't declared are left alone, as is group membership: add users to
groups in the admin UI.
- A client's secret is an age file shared with the box that runs the app (or a key of an env
file). Generate it with `slop secret generate`; after rotating one, restart `pocket-id-sync`.
### SSO
[oauth2-proxy](https://oauth2-proxy.github.io/oauth2-proxy/) signs users in with Pocket ID (client
`sso`) for vhosts with no sign-in of their own.
- `ssoServer [ <groups> ]` in `vhosts.nix` gates a vhost with nginx `auth_request`, allowing
members of any of the given Pocket ID groups. The gated vhosts currently allow `admins`.
- Each gated vhost serves oauth2-proxy's `/oauth2/` endpoints itself. Its session cookie is
host-only, so other `.nul.ie` sites (including `*.slop.nul.ie` previews) never receive it.
Pocket ID's own session turns signing in to another gated vhost into a redirect.
- The `sso` client's callback URLs are derived from the gated vhosts.
- Sessions last a week. Every hour, oauth2-proxy uses a refresh token to check back with Pocket
ID without a passkey, and picks up the user's current groups. A disabled user is signed out at
the next check; someone removed from a group loses access once their access token expires (an
hour at most, Pocket ID's default).
- A location in a gated vhost with its own `add_header` would drop the refreshed session cookie
that `ssoServer` passes on.
- Its client secret and cookie secret are in the env file `middleman/oauth2-proxy.env`.
- `id.nul.ie` resolves to the container itself, so oauth2-proxy reaches Pocket ID through the
local nginx.
### librespeed
The frontend and backend are published as `speed.nul.ie` and `librespeed.ams1.int.nul.ie`, both
proxied to `localhost:8989`.
### Paseo relay
[`paseo-relay`](https://github.com/getpaseo/paseo-relay) (the `my.paseo-relay` module, package
`pkgs/paseo-relay.nix`) relays end-to-end encrypted traffic between Paseo daemons and the Paseo
app, in place of Paseo's hosted relay.
- Single node with no Erlang distribution, listening on `127.0.0.1:4000` and published as
`paseo-relay.nul.ie`. It keeps no state, so a restart only drops connections.
- The relay can't read or forge messages, so the vhost is open to the world. Its Prometheus
`/metrics` is not exposed; `/health` and `/ready` are.
- `slop.nul.ie` serves Paseo's web app as static files, taken from the same patched Paseo package
(our Jujutsu fork) as the daemon, so deploy it together with
[`slop-cannon`](../../../home/slop-cannon.md). Pairing links from our daemon point there, and the app connects through the relay,
so nothing from `paseo.sh` is needed in the browser.
## Network assignments
See the consolidated [network assignments](../../../../networking.md#box-assignments) table (this box: `middleman`).
@@ -52,13 +107,13 @@ rewrites outbound IPv6 to the container's own address on `host0`.
## Published vhosts
Everything is under `*.nul.ie` with the public wildcard cert unless noted; defaults applied to
all vhosts are `onlySSL`, kTLS and HTTP/2. "SSO" = gated behind nginx-sso (`generic` instance).
all vhosts are `onlySSL`, kTLS and HTTP/2. "SSO" = gated behind [oauth2-proxy](#sso).
| Host | Upstream | Notes |
| --- | --- | --- |
| `nul.ie` (`_`, default) | static | landing page (`index.html`, CV PDF, SSH pubkey); serves Matrix `.well-known`s and redirects `webfinger`/`nodeinfo`/`host-meta` → `toot.nul.ie`, `atproto-did` → `pds.nul.ie`; `forceSSL` (plain HTTP redirects to HTTPS) |
| `localhost` | — | loopback-only VTS status page at `/status` (scraped by netdata); plain HTTP |
| `sso.nul.ie` | `localhost:8082` | nginx-sso endpoint |
| `id.nul.ie` | `localhost:1411` | Pocket ID; `/setup` only from internal networks; `X-API-Key` stripped |
| `netdata-colony.nul.ie` | `<host>.ams1.int.nul.ie:19999` | netdata fan-out over `vm`, `fw`, `ctr`, `oci`, `http`, `jackflix-ctr`, `chatterbox-ctr`, `colony-psql-ctr`; **SSO** |
| `pass.nul.ie` | `vaultwarden-ctr:8080` | [vaultwarden](vaultwarden.md); `/notifications/hub` proxied with websockets |
| `matrix.nul.ie` | `chatterbox-ctr:8008` | [chatterbox](chatterbox.md) Synapse client + federation; also listens on `:8448` as federation `default_server`; `= /` redirects to Element; serves Matrix `.well-known`s |
@@ -71,7 +126,6 @@ all vhosts are `onlySSL`, kTLS and HTTP/2. "SSO" = gated behind nginx-sso (`gene
| `jackflix.nul.ie` | `jackflix-ctr:8096` | Jellyfin; `/socket` websockets; `/` redirects to `/web/` |
| `toot.nul.ie` | `toot-ctr:80` | Mastodon — **upstream currently disabled**, see [toot](toot.md) |
| `pds.nul.ie` | `toot-ctr:3000` | Bluesky PDS ([toot](toot.md)); websockets |
| `share.nul.ie` | `object-ctr:9090` | Sharry ([object](object.md)); websockets |
| `stuff.nul.ie` | `jackflix-ctr:3923` | copyparty |
| `public.nul.ie` (+ alias `p.nul.ie`) | static `/mnt/media/public` | fancyindex file listing; `addSSL` so plain HTTP also works |
| `mc-map.nul.ie` | `simpcraft-oci:8100` | Minecraft map (OCI container on [`whale2`](../../whale2.md#game-servers)) |
@@ -79,6 +133,9 @@ all vhosts are `onlySSL`, kTLS and HTTP/2. "SSO" = gated behind nginx-sso (`gene
| `mc-map-kink.nul.ie` | `kinkcraft-oci:8100` | Minecraft map ([`whale2`](../../whale2.md#game-servers)) |
| `speed.nul.ie` | `localhost:8989` | librespeed |
| `librespeed.ams1.int.nul.ie` | `localhost:8989` | librespeed on the internal domain (internal wildcard cert) |
| `paseo-relay.nul.ie` | `localhost:4000` | Paseo relay; websockets with long timeouts; `/metrics` blocked |
| `slop.nul.ie` | static Paseo web app | falls back to `index.html`; precompressed files served as-is |
| `approve.slop.nul.ie` | `palace.h.nul.ie:8095` | [`slop-broker`](../../../../slop-broker.md#approvals-web-app)'s approvals web app, which handles sign-in itself (Pocket ID) |
| `md.nul.ie` | `object-ctr:3000` | HedgeDoc; websockets |
| `pb.nul.ie` | `object-ctr:8088` | wastebin |
| `photos.nul.ie` | `jackflix-ctr:2342` | PhotoPrism; websockets |
@@ -91,6 +148,7 @@ all vhosts are `onlySSL`, kTLS and HTTP/2. "SSO" = gated behind nginx-sso (`gene
## Notable config files
- [`nixos/boxes/colony/vms/shill/containers/middleman/default.nix`](../../../../../nixos/boxes/colony/vms/shill/containers/middleman/default.nix) — container definition: nginx, ACME, nginx-sso, librespeed, secrets
- [`nixos/boxes/colony/vms/shill/containers/middleman/vhosts.nix`](../../../../../nixos/boxes/colony/vms/shill/containers/middleman/vhosts.nix) — all virtual hosts, the SSO include helpers, and the `.well-known` tree
- [`nixos/boxes/colony/vms/shill/containers/middleman/default.nix`](../../../../../nixos/boxes/colony/vms/shill/containers/middleman/default.nix) — container definition: nginx, ACME, librespeed, Paseo relay, secrets
- [`nixos/boxes/colony/vms/shill/containers/middleman/auth.nix`](../../../../../nixos/boxes/colony/vms/shill/containers/middleman/auth.nix) — Pocket ID, its declared groups and clients, oauth2-proxy
- [`nixos/boxes/colony/vms/shill/containers/middleman/vhosts.nix`](../../../../../nixos/boxes/colony/vms/shill/containers/middleman/vhosts.nix) — all virtual hosts, the `ssoServer` helper, and the `.well-known` tree
- [`nixos/boxes/colony/vms/shill/containers/middleman/default.html`](../../../../../nixos/boxes/colony/vms/shill/containers/middleman/default.html) — default vhost landing page
+5 -7
View File
@@ -1,20 +1,18 @@
# object
Object storage and the Nix binary cache, plus a few small self-hosted web apps (Sharry,
HedgeDoc, wastebin).
Object storage and the Nix binary cache, plus HedgeDoc and wastebin.
- **Source:** [`shill/containers/object.nix`](../../../../../nixos/boxes/colony/vms/shill/containers/object.nix)
- **Host:** NixOS container on [`shill`](../README.md) (bind-mounts `/mnt/minio` and
`/mnt/nix-cache` read-write)
- **nixpkgs:** `mine`
- **nixpkgs:** `mine`. The MinIO server, CLI, and service module come from `mine-stable`.
## Role
| Service | Port | Purpose |
| --- | --- | --- |
| MinIO | `9000` (S3) / `9001` (console) | S3-compatible object storage, `s3.nul.ie` + `*.s3.nul.ie` (virtual-host style via `MINIO_DOMAIN`), console at `minio.nul.ie`; region `eu-central-1`; data on the `/mnt/minio` XFS volume |
| Harmonia | `5000` | Nix binary cache at `nix-cache.nul.ie` — `harmonia-dev` cache serves `shill`'s `/nix/store` out of a dedicated store view rooted at `/var/lib/harmonia` (bind-mounted from `/mnt/nix-cache`), signed with the `nix-cache.key` secret; a `harmonia` user with authorized keys exists for cache pushes |
| Sharry | `9090` | file sharing at `share.nul.ie`; Postgres on [colony-psql](colony-psql.md), files stored in the `share` MinIO bucket; fixed `dev` account + invite signup; mail via `mail.nul.ie`; configured share-size limit |
| Harmonia | `5000` | Nix binary cache at `nix-cache.nul.ie` — `harmonia-dev` cache serves `shill`'s `/nix/store` out of a dedicated store view rooted at `/var/lib/harmonia` (bind-mounted from `/mnt/nix-cache`), signed with the `nix-cache.key` secret; a `harmonia` user with authorized keys exists for cache pushes, including `slop-broker`'s on `palace`, which is restricted to the store protocol and GC roots (`services.slop-broker-cache`, see [`slop-broker.md`](../../../../slop-broker.md#binary-cache)) |
| HedgeDoc | `3000` | collaborative markdown notes at `md.nul.ie`; Postgres on [colony-psql](colony-psql.md); anonymous edits but no anonymous notes, email login, no open email registration |
| wastebin | `8088` | pastebin at `pb.nul.ie` |
| atticd | `8069` | **currently disabled** (`services.atticd.enable = false`) — an alternative Nix cache that would store locally and sit behind `nix-cache.nul.ie`; config (including the `object/atticd.env` secret) is kept around |
@@ -29,10 +27,10 @@ See the consolidated [network assignments](../../../../networking.md#box-assignm
## Backing services
- [colony-psql](colony-psql.md) — Sharry and HedgeDoc databases (atticd too, when enabled).
- [colony-psql](colony-psql.md) — HedgeDoc's database (atticd too, when enabled).
- MinIO buckets back other boxes' services: Gitea LFS/packages (with the `middleman` MIME hack
for Docker manifests), Mastodon's `mastodon` bucket and the Bluesky PDS `pds` bucket on
[toot](toot.md), and Sharry's `share` bucket.
[toot](toot.md).
## Notable config files
+2 -1
View File
@@ -48,7 +48,8 @@ forwarded by `estuary`.
| `graeme` | `25569` tcp+udp | running |
- **valheim** ([`valheim.nix`](../../../nixos/boxes/colony/vms/whale2/valheim.nix)) —
`lloesche/valheim-server`, public server "amogus sus", world `simpland2`,
`community-valheim-tools/valheim-server`, public server "amogus sus", world `simpland3`
(previous world `simpland2` retained in the `valheim_data` volume),
allow-listed Steam IDs, password from agenix.
- **simpcraft** ([`minecraft/`](../../../nixos/boxes/colony/vms/whale2/minecraft)) —
`itzg/minecraft-server` (self-built `git.nul.ie/dev/craftblock` image),
+7 -4
View File
@@ -17,6 +17,7 @@ pair, and everything clients touch (gateway, DNS) is a floating VIP that follows
| [`stream`](stream.md) | Secondary router (VRRP pair with `river`) | physical |
| [`cellar`](cellar.md) | NVMe-oF / SPDK storage target | VM on `palace` |
| [`sfh`](sfh/README.md) | NixOS container host (containers on its page) | VM on `palace` |
| [`slop-cannon`](slop-cannon.md) | Coding agents, driven remotely through Paseo; on `untrusted` | VM on `palace` |
| [`castle`](castle.md) | Workstation / gaming desktop | physical |
## Router VIPs
@@ -33,10 +34,12 @@ clients and the two WAN paths. VLAN IDs, prefixes, MTUs and router addressing li
## Switch fabric
The boxes hang off three hand-configured switches — `jim` and `dave` (MikroTik, RouterOS) and
`brian` (Ubiquiti, UniFi) — which are **not** managed by this flake. The physical topology, VLAN
map, the Digiweb WAN path (trunked VLAN 10 + PVID 140 at the ONT edge), and the multi-ONT plan are
documented in [switches.md](switches.md).
The boxes hang off four hand-configured switches: `jim` and `dave` (MikroTik, RouterOS), `brian`
(Ubiquiti, UniFi), and the L2-managed Zyxel switch `shytzel`. They are **not** managed by this
flake. The physical topology, VLAN map, the Digiweb WAN path (trunked VLAN 10 + PVID 140 at the ONT
edge), and the multi-ONT plan are documented in [switches.md](switches.md). Router attachments
are described in [Router HA](../../networking.md#router-ha); tested failure scenarios and checks
for maintenance are documented in [router-failover.md](router-failover.md).
## Wireless APs
+6 -1
View File
@@ -13,7 +13,8 @@ Only the DNS records live in the flake
| | vibe | wave |
|---|---|---|
| Model | MikroTik **cAP ax** (`cAPGi-5HaxD2HaxD`) | Cudy **AX3000** (OpenWrt id `cudy,ap3000-v1`) |
| OS | RouterOS 7.x | OpenWrt 25.12.x (MT7981B / Filogic 820) |
| OS | RouterOS 7.25.1 | OpenWrt 25.12.x (MT7981B / Filogic 820) |
| RouterBOOT | 7.25.1 | — |
| Radio | 2×2 both bands | 2×2 both bands (2 spatial streams) |
| Uplink | trunk (multi-port; `ether2` is a wired LAN port) | single **2.5 GbE** trunk |
| Management | core/hi/lo `.15` | core/lo `.14` (**not** `hi`; see below) |
@@ -58,6 +59,10 @@ with `ssh admin@vibe '/interface wifi export show-sensitive'` (`.passphrase=` pr
RouterOS, one hardware-offloaded bridge `main` with `vlan-filtering=yes`. Access: `ssh admin@vibe`
— key auth for `admin` is installed (`~/.ssh/id_rsa`), with `admin`/`admin` as a fallback.
`wifi-qcom` matches the RouterOS version. Follow the shared
[upgrade procedure](switches.md#upgrades) for backups and version checks. A DFS channel
availability check can delay the 5 GHz radio after reboot while 2.4 GHz is already running.
- **Uplink `ether1`** — trunk, tagged VLANs 100/110/120; native/untagged is the default VLAN 1
(PVID, no IP). `ether2` is a wired **access port** on VLAN 110 (`lo`). `l2mtu 9214`.
- **Radios** — `wifi1` (5 GHz, 20/40/80) + `wifi2` (2.4 GHz, 20/40) both broadcast `wlan0`
+68 -1
View File
@@ -2,7 +2,7 @@
The home storage target. A VM on `palace` that drives three passed-through NVMe disks with SPDK
and exports them over NVMe-oF/RDMA — `river`, `sfh` and `castle` all run their root storage off
it.
it, and `slop-cannon`'s disk lives on it.
- **Source:** [`nixos/boxes/home/palace/vms/cellar/`](../../../nixos/boxes/home/palace/vms/cellar)
(`default.nix`, `spdk.nix`)
@@ -22,8 +22,11 @@ it.
| `NVMeRaidp1` | `nqn.2016-06.io.spdk:river` | [`river`](river.md) |
| `NVMeRaidp2` | `nqn.2016-06.io.spdk:castle` | [`castle`](castle.md) |
| `NVMeRaidp3` | `nqn.2016-06.io.spdk:sfh` | [`sfh`](sfh/README.md) |
| `NVMeRaidp4` | `nqn.2016-06.io.spdk:slop-cannon` | [`palace`](palace.md#slop-cannons-disk), for [`slop-cannon`](slop-cannon.md) |
Each subsystem is pinned to its consumer's `hostnqn` (the `my.nvme.uuid` on the client side).
- `spdk-tgt` doesn't restart on deploy (`restartIfChanged = false`): restarting it takes every
consumer's disk away, so restart it by hand when they can do without.
- `spdk-tgt` is ordered after `lan-hi` is online; the RDMA listener binds the `hi` assignment on
port 4420. The VM itself is pinned to NUMA node 1 on `palace` and gets SR-IOV VF 0.
- `netdata` (port 19999 allowed in the firewall) and `fstrim`.
@@ -32,6 +35,70 @@ it.
See the consolidated [network assignments](../../networking.md#box-assignments) table (this box: `cellar`).
## Adding an export
Partitions on `NVMeRaid` are ordinary GPT partitions. SPDK's `gpt` module finds them when it
examines the RAID (`bdev_examine` in `spdk.nix`; auto-examine is off) and exposes those whose type
GUID is SPDK's, as `NVMeRaidp<n>`. `p1`–`p4` use the current type GUID,
`6527994e-2c5a-4eec-9613-8f5944074e8b`. Use it for new partitions and leave existing partition
types as they are. SPDK still supports its deprecated type, `7c5222bd-8f5d-4087-9c00-bf9843c7b58c`,
and exposes one fewer block for that type to preserve compatibility with existing on-disk metadata.
[SPDK deprecation notice](https://github.com/spdk/spdk/blob/master/deprecation.md#gpt)
SPDK has no RPC to edit a partition table, so a new partition is written from Linux through ublk,
using `spdk-debug`.
Once examined, the `gpt` module holds an exclusive write claim on `NVMeRaid`, so this can't be done
while the exports are live: every consumer has to be down. Start from a box that stays online
when the exports are offline.
1. Shut down every consumer. Power off `castle` and run
`doas systemctl stop vm@sfh vm@river slop-cannon-disk` on `palace`. `stream` takes over the
router VIPs. Stopping `slop-cannon-disk` shuts down `vm@slop-cannon` before disconnecting its
disk. On `cellar`, verify that `doas spdk-rpc nvmf_subsystem_get_controllers <nqn>` returns `[]`
for each exported subsystem in the table above.
2. On `cellar`, stop the target and start `spdk-debug` in its place. It runs `spdk_tgt` on a
config generated from the real one: the same controllers and RAID, but nothing examined (so
the `gpt` module never claims the RAID), nothing exported, and the RAID exposed through ublk
(`my.spdk.debug.ublkDisks`):
```sh
doas systemctl stop spdk-tgt
doas systemd-run --unit=spdk-debug --setenv=PATH=/run/wrappers/bin:/run/current-system/sw/bin "$(command -v spdk-debug)"
doas spdk-rpc ublk_get_disks # NVMeRaid as ublk 1
lsblk /dev/ublkb1
```
Run plain `doas spdk-debug` instead to keep it in the foreground (`Ctrl-C` stops it).
3. Check the existing table, then add the partition. `sgdisk` isn't installed on `cellar`; a start
of `0` selects the start of the largest free region. Substitute the new partition number for
`<n>` and the desired capacity for `<size>`. Verify that all existing entries match the
expected layout before writing, and check that they remain intact afterward.
```sh
nix shell pkgs#gptfdisk -c doas sgdisk -p /dev/ublkb1
nix shell pkgs#gptfdisk -c doas sgdisk \
-n <n>:0:+<size> -t <n>:6527994e-2c5a-4eec-9613-8f5944074e8b /dev/ublkb1
nix shell pkgs#gptfdisk -c doas sgdisk -p /dev/ublkb1
```
4. `doas systemctl stop spdk-debug`, and check `/dev/ublkb1` is gone.
5. If `spdk-debug` fails to start, `journalctl -u spdk-debug` shows why. The same steps can be
done by hand: `spdk_tgt --wait-for-rpc` under `systemd-run`, then `spdk-rpc bdev_set_options
--no-auto-examine`, `framework_start_init`, the three `bdev_nvme_attach_controller` calls and
`bdev_raid_create` exactly as in `spdk.nix`, `ublk_create_target` and
`ublk_start_disk NVMeRaid 1`.
6. Add an `nvmfBdev` entry for `NVMeRaidp<n>` in `spdk.nix` (its consumer's host NQN and the next
serial), deploy `cellar` (the unit doesn't restart) and `doas systemctl start spdk-tgt`. Check
`doas spdk-rpc bdev_get_bdevs` lists the new partition and `doas spdk-rpc nvmf_get_subsystems`
the new subsystem.
7. Start the consumers again. Starting `vm@slop-cannon` also starts `slop-cannon-disk`.
If `spdk-tgt` won't start in step 6, the usual cause is a config naming a bdev that doesn't exist.
Switch `cellar` back to its previous generation
(`doas /nix/var/nix/profiles/system-<n>-link/bin/switch-to-configuration switch`), start
`spdk-tgt` and check the existing exports before trying again.
`ublk_drv` is loaded on `cellar`.
## Notes
- The `ublk_*` calls in `my.spdk.debugCommands` are only a debugging aid — they create a local
+21
View File
@@ -0,0 +1,21 @@
# Home network diagrams
`switch-ports.json` holds the socket inventory, NIC capacities and cable endpoints. Regenerate
`switch-panels.svg` and the cable table in `../switches.md` from the repository root:
```sh
python3 docs/sites/home/diagrams/render-switch-panels.py
```
The renderer uses only the Python standard library. Socket geometry and schematic cable routing
live in the renderer. Keep the inventory and routing together when adding a connection.
`home-fabric.mmd` is the Mermaid source for the logical fabric diagram. Render it with Mermaid
CLI (the checked-in SVG was rendered with Mermaid 11.12.0):
```sh
mmdc -i docs/sites/home/diagrams/home-fabric.mmd -o docs/sites/home/diagrams/home-fabric.svg
```
Check rendered SVGs visually after editing. Both diagrams are checked in so Markdown viewers
can show them without Mermaid support.
+14
View File
@@ -0,0 +1,14 @@
flowchart LR
virgin["Virgin Media modem"] --- shytzel["shytzel"]
ont["Digiweb ONT"] --- brian["brian"]
shytzel ---|"VLAN 130 trunk"| jim["jim"]
brian ---|"2 × 10G LAG"| dave["dave · RSTP root"]
brian -. "1G backup" .- jim
jim ---|"10G fabric trunk"| dave
dave ---|"100G"| palace["palace · river / cellar / sfh"]
jim ---|"1G host + separate 1G river trunk"| palace
dave ---|"100G"| castle["castle · NVMe-oF root"]
jim -. "1G · normally down" .- castle
dave ---|"10G LAN"| stream["stream"]
jim -. "1G LAN backup" .- stream
jim ---|"Separate VLAN 130 WAN handoff"| stream
+1
View File
@@ -0,0 +1 @@
<svg id="mermaid-1794758188270" width="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="flowchart" style="max-width: 1357.40625px;" viewBox="0 0 1357.40625 379" role="graphics-document document" aria-roledescription="flowchart-v2"><style>#mermaid-1794758188270{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-1794758188270 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-1794758188270 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-1794758188270 .error-icon{fill:#552222;}#mermaid-1794758188270 .error-text{fill:#552222;stroke:#552222;}#mermaid-1794758188270 .edge-thickness-normal{stroke-width:1px;}#mermaid-1794758188270 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-1794758188270 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-1794758188270 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-1794758188270 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-1794758188270 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-1794758188270 .marker{fill:#333333;stroke:#333333;}#mermaid-1794758188270 .marker.cross{stroke:#333333;}#mermaid-1794758188270 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-1794758188270 p{margin:0;}#mermaid-1794758188270 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-1794758188270 .cluster-label text{fill:#333;}#mermaid-1794758188270 .cluster-label span{color:#333;}#mermaid-1794758188270 .cluster-label span p{background-color:transparent;}#mermaid-1794758188270 .label text,#mermaid-1794758188270 span{fill:#333;color:#333;}#mermaid-1794758188270 .node rect,#mermaid-1794758188270 .node circle,#mermaid-1794758188270 .node ellipse,#mermaid-1794758188270 .node polygon,#mermaid-1794758188270 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-1794758188270 .rough-node .label text,#mermaid-1794758188270 .node .label text,#mermaid-1794758188270 .image-shape .label,#mermaid-1794758188270 .icon-shape .label{text-anchor:middle;}#mermaid-1794758188270 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-1794758188270 .rough-node .label,#mermaid-1794758188270 .node .label,#mermaid-1794758188270 .image-shape .label,#mermaid-1794758188270 .icon-shape .label{text-align:center;}#mermaid-1794758188270 .node.clickable{cursor:pointer;}#mermaid-1794758188270 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-1794758188270 .arrowheadPath{fill:#333333;}#mermaid-1794758188270 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-1794758188270 .flowchart-link{stroke:#333333;fill:none;}#mermaid-1794758188270 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-1794758188270 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-1794758188270 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-1794758188270 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-1794758188270 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-1794758188270 .cluster text{fill:#333;}#mermaid-1794758188270 .cluster span{color:#333;}#mermaid-1794758188270 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-1794758188270 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-1794758188270 rect.text{fill:none;stroke-width:0;}#mermaid-1794758188270 .icon-shape,#mermaid-1794758188270 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-1794758188270 .icon-shape p,#mermaid-1794758188270 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-1794758188270 .icon-shape rect,#mermaid-1794758188270 .image-shape rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-1794758188270 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-1794758188270 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-1794758188270 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}</style><g><marker id="mermaid-1794758188270_flowchart-v2-pointEnd" class="marker flowchart-v2" viewBox="0 0 10 10" refX="5" refY="5" markerUnits="userSpaceOnUse" markerWidth="8" markerHeight="8" orient="auto"><path d="M 0 0 L 10 5 L 0 10 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></path></marker><marker id="mermaid-1794758188270_flowchLine truncated

After

Width:  |  Height:  |  Size: 24 KiB

@@ -0,0 +1,207 @@
#!/usr/bin/env python3
"""Render the rack panel map and cable table from switch-ports.json."""
import html
import json
from pathlib import Path
import re
import textwrap
ROOT = Path(__file__).resolve().parent
DATA = json.loads((ROOT / "switch-ports.json").read_text())
COLORS = ["#2563eb", "#7c3aed", "#d97706", "#0891b2", "#64748b", "#16a34a", "#db2777", "#dc2626", "#92400e", "#0f766e", "#4f46e5"]
TAGS = {}
POSITIONS = {}
foreground = []
for link, color in zip(DATA["links"], COLORS):
for end in ("from", "to"):
TAGS[tuple(link[end])] = (link["id"], color)
svg = ['<svg xmlns="http://www.w3.org/2000/svg" width="1440" height="1580" viewBox="0 0 1440 1580" role="img" aria-labelledby="title desc">',
'<title id="title">Home rack switch front panels and cable endpoints</title>',
'<desc id="desc">Stream is drawn above Brian but physically sits to its left. Brian above Jim above Dave, with palace several rack units below. Socket order follows the hardware; matching letter badges identify cable ends.</desc>',
'<style>text{font-family:system-ui,sans-serif;fill:#172033}.heading{font-weight:650;font-size:22px}.sub{fill:#526075;font-size:14px}.port{font-size:12px;font-weight:600}.small{font-size:11px}.mono{font-family:monospace}</style>']
def rect(x, y, w, h, fill, stroke="none", radius=5):
svg.append(f'<rect x="{x}" y="{y}" width="{w}" height="{h}" rx="{radius}" fill="{fill}" stroke="{stroke}"/>')
def text(x, y, value, cls="", anchor="start", color=None):
style = f' style="fill:{color}"' if color else ""
svg.append(f'<text x="{x}" y="{y}" class="{cls}" text-anchor="{anchor}"{style}>{html.escape(value)}</text>')
def badge(x, y, tag, color):
rect(x - 10, y - 12, 20, 20, color, radius=4)
text(x, y + 2, tag, "port", "middle", "white")
def chassis(y, name, height, note):
rect(115, y, 1210, height, "#eef1f5", "#a8b2c1", 8)
text(140, y + 28, name, "heading")
text(1300, y + 27, note, "sub", "end")
def port(host, socket, x, y, width=46, height=27, label=True):
start = len(svg)
POSITIONS[(host, socket)] = (x, y, width, height)
p = next(p for p in DATA[host]["ports"] if p["socket"] == socket)
svg.append('<g><title>' + html.escape(f'{host} {socket}: {p["interface"]} — {p["role"]}') + '</title>')
tag, color = TAGS.get((host, socket), (None, "#64748b"))
rect(x - width / 2, y, width, height, "#fff", color, 3)
rect(x - width / 2 + 6, y + 5, width - 12, height - 10, "#28364a", radius=1)
text(x, y - 9, socket, "port mono", "middle")
if tag:
badge(x + width / 2 - 2, y - 9, tag, color)
if label:
for row, line in enumerate(textwrap.wrap(p["label"], width=8 if host == "jim" else 11)[:2]):
text(x, y + height + 15 + row * 12, line, "small", "middle")
svg.append('</g>')
foreground.extend(svg[start:])
del svg[start:]
rect(0, 0, 1440, 1580, "white", radius=0)
text(95, 38, "Home rack · physical socket map", "heading")
text(95, 64, "Front views, top to bottom. Socket positions follow the hardware; spacing and chassis widths are schematic.", "sub")
svg.append('<g transform="translate(0,330)">')
rect(330, -235, 780, 305, "#eef1f5", "#a8b2c1", 8)
text(350, -205, "stream · BROUNION R86S", "heading")
text(350, -180, "Physically left of brian; drawn above for cable routing", "sub")
text(350, -150, "DC / USB", "small")
for n, x in enumerate((600, 780, 960)):
port("stream", f"ETH{n}", x, -135, width=60)
text(x, -65, "Intel I225-V · 2.5G", "small", "middle")
text(x, -48, "1G connection" if n < 2 else "Unused", "small", "middle")
for socket, x in (("SFP+ L", 650), ("SFP+ R", 890)):
port("stream", socket, x, -12, width=70)
text(x, 53, "ConnectX-3 · 10G SFP+", "small", "middle")
# SFP captions sit below the narrow chassis to preserve the two-row socket layout.
for x in (93, 1347):
rect(x, 90, 9, 1080, "#dce2eb", radius=2)
for y in range(106, 1170, 24):
rect(x + 2, y, 5, 8, "white", radius=1)
chassis(100, "brian · USW-Pro-XG-8-PoE", 155, "8 × RJ45, then 2 × SFP+")
rect(205, 180, 10, 10, "#60a5fa", radius=5)
text(210, 218, "LED", "small", "middle")
for n in range(1, 9):
port("brian", str(n), 320 + (n - 1) * 75, 174, width=48)
for n in (9, 10):
port("brian", str(n), 1060 + (n - 9) * 120, 174, width=65)
chassis(340, "jim · CRS326-24G-2S+RM", 205, "3 banks of 8 RJ45 · even above odd · SFP+ at right")
rect(175, 425, 54, 29, "#28364a", "#94a3b8")
text(202, 410, "CONSOLE", "small", "middle")
for n in range(1, 25):
col = (n - 1) // 2
x = 285 + col * 59 + (col // 4) * 17
port("jim", str(n), x, 476 if n % 2 else 402, width=43, height=24)
port("jim", "S1", 1134, 445, width=54)
port("jim", "S2", 1235, 445, width=54)
chassis(630, "dave · CRS504-4XQ-IN", 165, "4 QSFP28 cages · console above management at right")
for x, label in ((175, "PSU 1"), (290, "PSU 2")):
rect(x, 680, 90, 78, "#d1d8e2", "#94a3b8")
text(x + 45, 725, label, "sub", "middle")
for n in range(1, 5):
x = 490 + (n - 1) * 140
if n == 3:
rect(x - 46, 695, 92, 29, "#fff", "#0891b2")
rect(x - 38, 701, 76, 17, "#28364a", radius=1)
text(x, 686, "Q3", "port mono", "middle")
text(x, 743, "4 × 10G breakout", "small", "middle")
svg.append(f'<path d="M{x} 757 V820" stroke="#0891b2" stroke-width="2" fill="none"/>')
else:
port("dave", f"Q{n}", x, 695, width=92)
rect(1095, 690, 54, 27, "#28364a", "#94a3b8")
text(1122, 681, "CONSOLE", "small", "middle")
port("dave", "MGMT", 1122, 741, width=54, height=24, label=False)
text(1235, 725, "DC / reset", "sub", "middle")
rect(430, 820, 820, 84, "#f4f8fc", "#b9cadb")
text(445, 841, "Q3 breakout lanes (one physical cage)", "sub")
for n in range(1, 5):
start = len(svg)
p = next(p for p in DATA["dave"]["ports"] if p["socket"] == f"Q3.{n}")
x = 485 + (n - 1) * 200
tag, color = TAGS.get(("dave", p["socket"]), (None, "#64748b"))
text(x, 870, p["socket"], "port mono")
if tag:
badge(x + 61, 866, tag, color)
text(x, 889, p["label"], "small")
rect(x + 83, 854, 34, 20, "white", color, radius=3)
rect(x + 89, 860, 22, 8, color, radius=1)
POSITIONS[("dave", p["socket"])] = (x + 100, 854, 34, 20)
foreground.extend(svg[start:])
del svg[start:]
text(720, 963, "⋮ several rack units ⋮", "sub", "middle")
chassis(1030, "palace", 160, "NIC endpoints only; rear-panel positions are not depicted")
for x, name in ((350, "uplink-dave"), (730, "host-jim"), (1110, "river-jim-phy")):
start = len(svg)
tag, color = TAGS[("palace", name)]
rect(x - 145, 1090, 290, 76, "white", color)
text(x - 118, 1120, name, "port mono")
badge(x + 119, 1114, tag, color)
spec = next(p for p in DATA["palace"]["ports"] if p["socket"] == name)
text(x, 1146, spec["nic"] + " · " + spec["capacity"], "small", "middle")
POSITIONS[("palace", name)] = (x, 1090, 290, 76)
foreground.extend(svg[start:])
del svg[start:]
def anchor(host, socket, side="bottom"):
x, y, w, h = POSITIONS[(host, socket)]
return {"top": (x, y), "bottom": (x, y + h),
"left": (x - w / 2, y + h / 2), "right": (x + w / 2, y + h / 2)}[side]
def cable(tag, points):
color = COLORS[ord(tag) - ord("A")]
points = " ".join(f"{x},{y}" for x, y in points)
svg.append(f'<polyline points="{points}" fill="none" stroke="white" stroke-width="7" stroke-linejoin="round" stroke-linecap="round"/>')
svg.append(f'<polyline points="{points}" fill="none" stroke="{color}" stroke-width="2.5" stroke-linejoin="round" stroke-linecap="round"/>')
cable("A", [anchor("brian", "9"), (1060, 280), (38, 280), (38, 925),
(785, 925), anchor("dave", "Q3.2")])
cable("B", [anchor("brian", "10"), (1180, 300), (58, 300), (58, 950),
(1185, 950), anchor("dave", "Q3.4")])
cable("C", [anchor("brian", "5"), (620, 315), (492, 315), (492, 458),
(462, 458), anchor("jim", "7", "top")])
cable("D", [anchor("jim", "S1"), (1134, 575), (1394, 575), (1394, 975),
(585, 975), anchor("dave", "Q3.1")])
cable("E", [anchor("jim", "24", "right"), (1010, 414), (1010, 600),
(1380, 600), (1380, 753), anchor("dave", "MGMT", "right")])
cable("F", [anchor("jim", "5"), (403, 568), (1368, 568), (1368, 1010),
(730, 1010), anchor("palace", "host-jim", "top")])
cable("G", [anchor("jim", "22", "right"), (940, 414), (940, 590),
(1416, 590), (1416, 1025), (1110, 1025), anchor("palace", "river-jim-phy", "top")])
cable("H", [anchor("dave", "Q1"), (490, 790), (410, 790), (410, 1000),
(350, 1000), anchor("palace", "uplink-dave", "top")])
cable("I", [anchor("stream", "ETH0", "top"), (600, -160), (18, -160),
(18, 555), (898, 555), anchor("jim", "21")])
cable("J", [anchor("stream", "ETH1", "top"), (780, -170), (70, -170),
(70, 322), (403, 322), anchor("jim", "6", "top")])
cable("K", [anchor("stream", "SFP+ R"), (890, 80), (1428, 80),
(1428, 920), (985, 920), anchor("dave", "Q3.3")])
svg.extend(foreground)
text(95, 1220, "Matching letter badges identify cable ends. Port labels describe configured use; they do not indicate current link state.", "sub")
svg.append('</g></svg>')
(ROOT / "switch-panels.svg").write_text('\n'.join(svg) + '\n')
rows = ["| Cable | Endpoint | Endpoint | Connection |", "|---|---|---|---|"]
for link in DATA["links"]:
ends = [f'`{link[end][0]}` `{link[end][1]}`' for end in ("from", "to")]
rows.append(f'| **{link["id"]}** | {ends[0]} | {ends[1]} | {link["description"]} |')
page = ROOT.parent / "switches.md"
content = page.read_text()
start, end = "<!-- switch-cables -->", "<!-- /switch-cables -->"
if start in content:
content = re.sub(re.escape(start) + r'.*?' + re.escape(end),
start + '\n' + '\n'.join(rows) + '\n' + end, content, flags=re.S)
page.write_text(content)
+517
View File
@@ -0,0 +1,517 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1440" height="1580" viewBox="0 0 1440 1580" role="img" aria-labelledby="title desc">
<title id="title">Home rack switch front panels and cable endpoints</title>
<desc id="desc">Stream is drawn above Brian but physically sits to its left. Brian above Jim above Dave, with palace several rack units below. Socket order follows the hardware; matching letter badges identify cable ends.</desc>
<style>text{font-family:system-ui,sans-serif;fill:#172033}.heading{font-weight:650;font-size:22px}.sub{fill:#526075;font-size:14px}.port{font-size:12px;font-weight:600}.small{font-size:11px}.mono{font-family:monospace}</style>
<rect x="0" y="0" width="1440" height="1580" rx="0" fill="white" stroke="none"/>
<text x="95" y="38" class="heading" text-anchor="start">Home rack · physical socket map</text>
<text x="95" y="64" class="sub" text-anchor="start">Front views, top to bottom. Socket positions follow the hardware; spacing and chassis widths are schematic.</text>
<g transform="translate(0,330)">
<rect x="330" y="-235" width="780" height="305" rx="8" fill="#eef1f5" stroke="#a8b2c1"/>
<text x="350" y="-205" class="heading" text-anchor="start">stream · BROUNION R86S</text>
<text x="350" y="-180" class="sub" text-anchor="start">Physically left of brian; drawn above for cable routing</text>
<text x="350" y="-150" class="small" text-anchor="start">DC / USB</text>
<text x="600" y="-65" class="small" text-anchor="middle">Intel I225-V · 2.5G</text>
<text x="600" y="-48" class="small" text-anchor="middle">1G connection</text>
<text x="780" y="-65" class="small" text-anchor="middle">Intel I225-V · 2.5G</text>
<text x="780" y="-48" class="small" text-anchor="middle">1G connection</text>
<text x="960" y="-65" class="small" text-anchor="middle">Intel I225-V · 2.5G</text>
<text x="960" y="-48" class="small" text-anchor="middle">Unused</text>
<text x="650" y="53" class="small" text-anchor="middle">ConnectX-3 · 10G SFP+</text>
<text x="890" y="53" class="small" text-anchor="middle">ConnectX-3 · 10G SFP+</text>
<rect x="93" y="90" width="9" height="1080" rx="2" fill="#dce2eb" stroke="none"/>
<rect x="95" y="106" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="130" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="154" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="178" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="202" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="226" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="250" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="274" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="298" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="322" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="346" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="370" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="394" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="418" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="442" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="466" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="490" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="514" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="538" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="562" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="586" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="610" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="634" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="658" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="682" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="706" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="730" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="754" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="778" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="802" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="826" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="850" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="874" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="898" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="922" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="946" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="970" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="994" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="1018" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="1042" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="1066" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="1090" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="1114" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="1138" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="95" y="1162" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1347" y="90" width="9" height="1080" rx="2" fill="#dce2eb" stroke="none"/>
<rect x="1349" y="106" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="130" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="154" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="178" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="202" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="226" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="250" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="274" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="298" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="322" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="346" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="370" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="394" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="418" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="442" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="466" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="490" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="514" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="538" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="562" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="586" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="610" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="634" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="658" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="682" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="706" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="730" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="754" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="778" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="802" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="826" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="850" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="874" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="898" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="922" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="946" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="970" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="994" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="1018" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="1042" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="1066" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="1090" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="1114" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="1138" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="1349" y="1162" width="5" height="8" rx="1" fill="white" stroke="none"/>
<rect x="115" y="100" width="1210" height="155" rx="8" fill="#eef1f5" stroke="#a8b2c1"/>
<text x="140" y="128" class="heading" text-anchor="start">brian · USW-Pro-XG-8-PoE</text>
<text x="1300" y="127" class="sub" text-anchor="end">8 × RJ45, then 2 × SFP+</text>
<rect x="205" y="180" width="10" height="10" rx="5" fill="#60a5fa" stroke="none"/>
<text x="210" y="218" class="small" text-anchor="middle">LED</text>
<rect x="115" y="340" width="1210" height="205" rx="8" fill="#eef1f5" stroke="#a8b2c1"/>
<text x="140" y="368" class="heading" text-anchor="start">jim · CRS326-24G-2S+RM</text>
<text x="1300" y="367" class="sub" text-anchor="end">3 banks of 8 RJ45 · even above odd · SFP+ at right</text>
<rect x="175" y="425" width="54" height="29" rx="5" fill="#28364a" stroke="#94a3b8"/>
<text x="202" y="410" class="small" text-anchor="middle">CONSOLE</text>
<rect x="115" y="630" width="1210" height="165" rx="8" fill="#eef1f5" stroke="#a8b2c1"/>
<text x="140" y="658" class="heading" text-anchor="start">dave · CRS504-4XQ-IN</text>
<text x="1300" y="657" class="sub" text-anchor="end">4 QSFP28 cages · console above management at right</text>
<rect x="175" y="680" width="90" height="78" rx="5" fill="#d1d8e2" stroke="#94a3b8"/>
<text x="220" y="725" class="sub" text-anchor="middle">PSU 1</text>
<rect x="290" y="680" width="90" height="78" rx="5" fill="#d1d8e2" stroke="#94a3b8"/>
<text x="335" y="725" class="sub" text-anchor="middle">PSU 2</text>
<rect x="724" y="695" width="92" height="29" rx="5" fill="#fff" stroke="#0891b2"/>
<rect x="732" y="701" width="76" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="770" y="686" class="port mono" text-anchor="middle">Q3</text>
<text x="770" y="743" class="small" text-anchor="middle">4 × 10G breakout</text>
<path d="M770 757 V820" stroke="#0891b2" stroke-width="2" fill="none"/>
<rect x="1095" y="690" width="54" height="27" rx="5" fill="#28364a" stroke="#94a3b8"/>
<text x="1122" y="681" class="small" text-anchor="middle">CONSOLE</text>
<text x="1235" y="725" class="sub" text-anchor="middle">DC / reset</text>
<rect x="430" y="820" width="820" height="84" rx="5" fill="#f4f8fc" stroke="#b9cadb"/>
<text x="445" y="841" class="sub" text-anchor="start">Q3 breakout lanes (one physical cage)</text>
<text x="720" y="963" class="sub" text-anchor="middle">⋮ several rack units ⋮</text>
<rect x="115" y="1030" width="1210" height="160" rx="8" fill="#eef1f5" stroke="#a8b2c1"/>
<text x="140" y="1058" class="heading" text-anchor="start">palace</text>
<text x="1300" y="1057" class="sub" text-anchor="end">NIC endpoints only; rear-panel positions are not depicted</text>
<polyline points="1060,201 1060,280 38,280 38,925 785,925 785,874" fill="none" stroke="white" stroke-width="7" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="1060,201 1060,280 38,280 38,925 785,925 785,874" fill="none" stroke="#2563eb" stroke-width="2.5" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="1180,201 1180,300 58,300 58,950 1185,950 1185,874" fill="none" stroke="white" stroke-width="7" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="1180,201 1180,300 58,300 58,950 1185,950 1185,874" fill="none" stroke="#7c3aed" stroke-width="2.5" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="620,201 620,315 492,315 492,458 462,458 462,476" fill="none" stroke="white" stroke-width="7" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="620,201 620,315 492,315 492,458 462,458 462,476" fill="none" stroke="#d97706" stroke-width="2.5" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="1134,472 1134,575 1394,575 1394,975 585,975 585,874" fill="none" stroke="white" stroke-width="7" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="1134,472 1134,575 1394,575 1394,975 585,975 585,874" fill="none" stroke="#0891b2" stroke-width="2.5" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="989.5,414.0 1010,414 1010,600 1380,600 1380,753 1149.0,753.0" fill="none" stroke="white" stroke-width="7" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="989.5,414.0 1010,414 1010,600 1380,600 1380,753 1149.0,753.0" fill="none" stroke="#64748b" stroke-width="2.5" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="403,500 403,568 1368,568 1368,1010 730,1010 730,1090" fill="none" stroke="white" stroke-width="7" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="403,500 403,568 1368,568 1368,1010 730,1010 730,1090" fill="none" stroke="#16a34a" stroke-width="2.5" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="930.5,414.0 940,414 940,590 1416,590 1416,1025 1110,1025 1110,1090" fill="none" stroke="white" stroke-width="7" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="930.5,414.0 940,414 940,590 1416,590 1416,1025 1110,1025 1110,1090" fill="none" stroke="#db2777" stroke-width="2.5" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="490,722 490,790 410,790 410,1000 350,1000 350,1090" fill="none" stroke="white" stroke-width="7" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="490,722 490,790 410,790 410,1000 350,1000 350,1090" fill="none" stroke="#dc2626" stroke-width="2.5" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="600,-135 600,-160 18,-160 18,555 898,555 909,500" fill="none" stroke="white" stroke-width="7" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="600,-135 600,-160 18,-160 18,555 898,555 909,500" fill="none" stroke="#92400e" stroke-width="2.5" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="780,-135 780,-170 70,-170 70,322 403,322 403,402" fill="none" stroke="white" stroke-width="7" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="780,-135 780,-170 70,-170 70,322 403,322 403,402" fill="none" stroke="#0f766e" stroke-width="2.5" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="890,15 890,80 1428,80 1428,920 985,920 985,874" fill="none" stroke="white" stroke-width="7" stroke-linejoin="round" stroke-linecap="round"/>
<polyline points="890,15 890,80 1428,80 1428,920 985,920 985,874" fill="none" stroke="#4f46e5" stroke-width="2.5" stroke-linejoin="round" stroke-linecap="round"/>
<g><title>stream ETH0: wan — 1G connection to jim 21</title>
<rect x="570.0" y="-135" width="60" height="27" rx="3" fill="#fff" stroke="#92400e"/>
<rect x="576.0" y="-130" width="48" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="600" y="-144" class="port mono" text-anchor="middle">ETH0</text>
<rect x="618.0" y="-156" width="20" height="20" rx="4" fill="#92400e" stroke="none"/>
<text x="628.0" y="-142" class="port" text-anchor="middle" style="fill:white">I</text>
<text x="600" y="-93" class="small" text-anchor="middle">wan</text>
</g>
<g><title>stream ETH1: lan-jim — 1G connection to jim 6</title>
<rect x="750.0" y="-135" width="60" height="27" rx="3" fill="#fff" stroke="#0f766e"/>
<rect x="756.0" y="-130" width="48" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="780" y="-144" class="port mono" text-anchor="middle">ETH1</text>
<rect x="798.0" y="-156" width="20" height="20" rx="4" fill="#0f766e" stroke="none"/>
<text x="808.0" y="-142" class="port" text-anchor="middle" style="fill:white">J</text>
<text x="780" y="-93" class="small" text-anchor="middle">lan-jim</text>
</g>
<g><title>stream ETH2: et2 — Unused</title>
<rect x="930.0" y="-135" width="60" height="27" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="936.0" y="-130" width="48" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="960" y="-144" class="port mono" text-anchor="middle">ETH2</text>
<text x="960" y="-93" class="small" text-anchor="middle">et2</text>
</g>
<g><title>stream SFP+ L: et5 — Unused</title>
<rect x="615.0" y="-12" width="70" height="27" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="621.0" y="-7" width="58" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="650" y="-21" class="port mono" text-anchor="middle">SFP+ L</text>
<text x="650" y="30" class="small" text-anchor="middle">et5</text>
</g>
<g><title>stream SFP+ R: lan-dave — 10G connection to dave Q3.3</title>
<rect x="855.0" y="-12" width="70" height="27" rx="3" fill="#fff" stroke="#4f46e5"/>
<rect x="861.0" y="-7" width="58" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="890" y="-21" class="port mono" text-anchor="middle">SFP+ R</text>
<rect x="913.0" y="-33" width="20" height="20" rx="4" fill="#4f46e5" stroke="none"/>
<text x="923.0" y="-19" class="port" text-anchor="middle" style="fill:white">K</text>
<text x="890" y="30" class="small" text-anchor="middle">lan-dave</text>
</g>
<g><title>brian 1: Port 1 — Configured port label</title>
<rect x="296.0" y="174" width="48" height="27" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="302.0" y="179" width="36" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="320" y="165" class="port mono" text-anchor="middle">1</text>
<text x="320" y="216" class="small" text-anchor="middle">fort</text>
</g>
<g><title>brian 2: Port 2 — Configured port label</title>
<rect x="371.0" y="174" width="48" height="27" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="377.0" y="179" width="36" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="395" y="165" class="port mono" text-anchor="middle">2</text>
<text x="395" y="216" class="small" text-anchor="middle">castle</text>
</g>
<g><title>brian 3: Port 3 — portcullis test connection</title>
<rect x="446.0" y="174" width="48" height="27" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="452.0" y="179" width="36" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="470" y="165" class="port mono" text-anchor="middle">3</text>
<text x="470" y="216" class="small" text-anchor="middle">portcullis</text>
<text x="470" y="228" class="small" text-anchor="middle">test</text>
</g>
<g><title>brian 4: Port 4 — Second JetKVM</title>
<rect x="521.0" y="174" width="48" height="27" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="527.0" y="179" width="36" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="545" y="165" class="port mono" text-anchor="middle">4</text>
<text x="545" y="216" class="small" text-anchor="middle">portcullis</text>
<text x="545" y="228" class="small" text-anchor="middle">KVM</text>
</g>
<g><title>brian 5: Port 5 — Backup fabric trunk</title>
<rect x="596.0" y="174" width="48" height="27" rx="3" fill="#fff" stroke="#d97706"/>
<rect x="602.0" y="179" width="36" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="620" y="165" class="port mono" text-anchor="middle">5</text>
<rect x="632.0" y="153" width="20" height="20" rx="4" fill="#d97706" stroke="none"/>
<text x="642.0" y="167" class="port" text-anchor="middle" style="fill:white">C</text>
<text x="620" y="216" class="small" text-anchor="middle">jim P7</text>
</g>
<g><title>brian 6: Port 6 — Native VLAN 140; tagged VLAN 10</title>
<rect x="671.0" y="174" width="48" height="27" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="677.0" y="179" width="36" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="695" y="165" class="port mono" text-anchor="middle">6</text>
<text x="695" y="216" class="small" text-anchor="middle">Digiweb ONT</text>
</g>
<g><title>brian 7: Port 7 — AP trunk</title>
<rect x="746.0" y="174" width="48" height="27" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="752.0" y="179" width="36" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="770" y="165" class="port mono" text-anchor="middle">7</text>
<text x="770" y="216" class="small" text-anchor="middle">wave</text>
</g>
<g><title>brian 8: Port 8 — AP trunk</title>
<rect x="821.0" y="174" width="48" height="27" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="827.0" y="179" width="36" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="845" y="165" class="port mono" text-anchor="middle">8</text>
<text x="845" y="216" class="small" text-anchor="middle">vibe</text>
</g>
<g><title>brian 9: SFP+ 1 — LAG member 1</title>
<rect x="1027.5" y="174" width="65" height="27" rx="3" fill="#fff" stroke="#2563eb"/>
<rect x="1033.5" y="179" width="53" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="1060" y="165" class="port mono" text-anchor="middle">9</text>
<rect x="1080.5" y="153" width="20" height="20" rx="4" fill="#2563eb" stroke="none"/>
<text x="1090.5" y="167" class="port" text-anchor="middle" style="fill:white">A</text>
<text x="1060" y="216" class="small" text-anchor="middle">dave Q3.2</text>
</g>
<g><title>brian 10: SFP+ 2 — LAG member 2</title>
<rect x="1147.5" y="174" width="65" height="27" rx="3" fill="#fff" stroke="#7c3aed"/>
<rect x="1153.5" y="179" width="53" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="1180" y="165" class="port mono" text-anchor="middle">10</text>
<rect x="1200.5" y="153" width="20" height="20" rx="4" fill="#7c3aed" stroke="none"/>
<text x="1210.5" y="167" class="port" text-anchor="middle" style="fill:white">B</text>
<text x="1180" y="216" class="small" text-anchor="middle">dave Q3.4</text>
</g>
<g><title>jim 1: ether1 — Configured member of shytzel-downlink</title>
<rect x="263.5" y="476" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="269.5" y="481" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="285" y="467" class="port mono" text-anchor="middle">1</text>
<text x="285" y="515" class="small" text-anchor="middle">shytzel</text>
<text x="285" y="527" class="small" text-anchor="middle">LAG</text>
</g>
<g><title>jim 2: ether2 — Configured member of shytzel-downlink</title>
<rect x="263.5" y="402" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="269.5" y="407" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="285" y="393" class="port mono" text-anchor="middle">2</text>
<text x="285" y="441" class="small" text-anchor="middle">shytzel</text>
<text x="285" y="453" class="small" text-anchor="middle">LAG</text>
</g>
<g><title>jim 3: ether3 — Configured member of shytzel-downlink</title>
<rect x="322.5" y="476" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="328.5" y="481" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="344" y="467" class="port mono" text-anchor="middle">3</text>
<text x="344" y="515" class="small" text-anchor="middle">shytzel</text>
<text x="344" y="527" class="small" text-anchor="middle">LAG</text>
</g>
<g><title>jim 4: ether4 — Configured member of shytzel-downlink</title>
<rect x="322.5" y="402" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="328.5" y="407" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="344" y="393" class="port mono" text-anchor="middle">4</text>
<text x="344" y="441" class="small" text-anchor="middle">shytzel</text>
<text x="344" y="453" class="small" text-anchor="middle">LAG</text>
</g>
<g><title>jim 5: palace — Core / netboot trunk</title>
<rect x="381.5" y="476" width="43" height="24" rx="3" fill="#fff" stroke="#16a34a"/>
<rect x="387.5" y="481" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="403" y="467" class="port mono" text-anchor="middle">5</text>
<rect x="412.5" y="455" width="20" height="20" rx="4" fill="#16a34a" stroke="none"/>
<text x="422.5" y="469" class="port" text-anchor="middle" style="fill:white">F</text>
<text x="403" y="515" class="small" text-anchor="middle">palace</text>
<text x="403" y="527" class="small" text-anchor="middle">host</text>
</g>
<g><title>jim 6: stream — Backup RSTP trunk</title>
<rect x="381.5" y="402" width="43" height="24" rx="3" fill="#fff" stroke="#0f766e"/>
<rect x="387.5" y="407" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="403" y="393" class="port mono" text-anchor="middle">6</text>
<rect x="412.5" y="381" width="20" height="20" rx="4" fill="#0f766e" stroke="none"/>
<text x="422.5" y="395" class="port" text-anchor="middle" style="fill:white">J</text>
<text x="403" y="441" class="small" text-anchor="middle">stream</text>
<text x="403" y="453" class="small" text-anchor="middle">LAN</text>
</g>
<g><title>jim 7: brian-downlink — Backup fabric trunk</title>
<rect x="440.5" y="476" width="43" height="24" rx="3" fill="#fff" stroke="#d97706"/>
<rect x="446.5" y="481" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="462" y="467" class="port mono" text-anchor="middle">7</text>
<rect x="471.5" y="455" width="20" height="20" rx="4" fill="#d97706" stroke="none"/>
<text x="481.5" y="469" class="port" text-anchor="middle" style="fill:white">C</text>
<text x="462" y="515" class="small" text-anchor="middle">brian P5</text>
</g>
<g><title>jim 8: palace-kvm — lo access</title>
<rect x="440.5" y="402" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="446.5" y="407" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="462" y="393" class="port mono" text-anchor="middle">8</text>
<text x="462" y="441" class="small" text-anchor="middle">JetKVM</text>
</g>
<g><title>jim 9: ether9 — Unbridged spare</title>
<rect x="516.5" y="476" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="522.5" y="481" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="538" y="467" class="port mono" text-anchor="middle">9</text>
<text x="538" y="515" class="small" text-anchor="middle">spare</text>
</g>
<g><title>jim 10: castle — Backup attachment, normally down</title>
<rect x="516.5" y="402" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="522.5" y="407" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="538" y="393" class="port mono" text-anchor="middle">10</text>
<text x="538" y="441" class="small" text-anchor="middle">castle</text>
</g>
<g><title>jim 11: fort — lo access (configured label)</title>
<rect x="575.5" y="476" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="581.5" y="481" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="597" y="467" class="port mono" text-anchor="middle">11</text>
<text x="597" y="515" class="small" text-anchor="middle">fort</text>
</g>
<g><title>jim 12: laptop-dock — lo access (configured label)</title>
<rect x="575.5" y="402" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="581.5" y="407" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="597" y="393" class="port mono" text-anchor="middle">12</text>
<text x="597" y="441" class="small" text-anchor="middle">dock</text>
</g>
<g><title>jim 13: pronter — lo access (configured label)</title>
<rect x="634.5" y="476" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="640.5" y="481" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="656" y="467" class="port mono" text-anchor="middle">13</text>
<text x="656" y="515" class="small" text-anchor="middle">pronter</text>
</g>
<g><title>jim 14: untrusted-sta1 — Untrusted access</title>
<rect x="634.5" y="402" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="640.5" y="407" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="656" y="393" class="port mono" text-anchor="middle">14</text>
<text x="656" y="441" class="small" text-anchor="middle">guest</text>
</g>
<g><title>jim 15: ether15 — lo access; peer unconfirmed</title>
<rect x="693.5" y="476" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="699.5" y="481" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="715" y="467" class="port mono" text-anchor="middle">15</text>
<text x="715" y="515" class="small" text-anchor="middle">unmapped</text>
</g>
<g><title>jim 16: ether16 — lo access; peer unconfirmed</title>
<rect x="693.5" y="402" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="699.5" y="407" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="715" y="393" class="port mono" text-anchor="middle">16</text>
<text x="715" y="441" class="small" text-anchor="middle">unmapped</text>
</g>
<g><title>jim 17: ether17 — lo access; peer unconfirmed</title>
<rect x="769.5" y="476" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="775.5" y="481" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="791" y="467" class="port mono" text-anchor="middle">17</text>
<text x="791" y="515" class="small" text-anchor="middle">unmapped</text>
</g>
<g><title>jim 18: ether18 — lo access; peer unconfirmed</title>
<rect x="769.5" y="402" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="775.5" y="407" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="791" y="393" class="port mono" text-anchor="middle">18</text>
<text x="791" y="441" class="small" text-anchor="middle">unmapped</text>
</g>
<g><title>jim 19: ether19 — lo access; peer unconfirmed</title>
<rect x="828.5" y="476" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="834.5" y="481" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="850" y="467" class="port mono" text-anchor="middle">19</text>
<text x="850" y="515" class="small" text-anchor="middle">unmapped</text>
</g>
<g><title>jim 20: ether20 — lo access; peer unconfirmed</title>
<rect x="828.5" y="402" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="834.5" y="407" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="850" y="393" class="port mono" text-anchor="middle">20</text>
<text x="850" y="441" class="small" text-anchor="middle">unmapped</text>
</g>
<g><title>jim 21: stream-wan — Untagged VLAN 130 handoff</title>
<rect x="887.5" y="476" width="43" height="24" rx="3" fill="#fff" stroke="#92400e"/>
<rect x="893.5" y="481" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="909" y="467" class="port mono" text-anchor="middle">21</text>
<rect x="918.5" y="455" width="20" height="20" rx="4" fill="#92400e" stroke="none"/>
<text x="928.5" y="469" class="port" text-anchor="middle" style="fill:white">I</text>
<text x="909" y="515" class="small" text-anchor="middle">stream</text>
<text x="909" y="527" class="small" text-anchor="middle">WAN</text>
</g>
<g><title>jim 22: river — Dedicated router trunk</title>
<rect x="887.5" y="402" width="43" height="24" rx="3" fill="#fff" stroke="#db2777"/>
<rect x="893.5" y="407" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="909" y="393" class="port mono" text-anchor="middle">22</text>
<rect x="918.5" y="381" width="20" height="20" rx="4" fill="#db2777" stroke="none"/>
<text x="928.5" y="395" class="port" text-anchor="middle" style="fill:white">G</text>
<text x="909" y="441" class="small" text-anchor="middle">river</text>
<text x="909" y="453" class="small" text-anchor="middle">backup</text>
</g>
<g><title>jim 23: ups — lo access</title>
<rect x="946.5" y="476" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="952.5" y="481" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="968" y="467" class="port mono" text-anchor="middle">23</text>
<text x="968" y="515" class="small" text-anchor="middle">UPS</text>
</g>
<g><title>jim 24: dave-management — Core management</title>
<rect x="946.5" y="402" width="43" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="952.5" y="407" width="31" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="968" y="393" class="port mono" text-anchor="middle">24</text>
<rect x="977.5" y="381" width="20" height="20" rx="4" fill="#64748b" stroke="none"/>
<text x="987.5" y="395" class="port" text-anchor="middle" style="fill:white">E</text>
<text x="968" y="441" class="small" text-anchor="middle">dave</text>
<text x="968" y="453" class="small" text-anchor="middle">mgmt</text>
</g>
<g><title>jim S1: dave-uplink — 10G fabric trunk</title>
<rect x="1107.0" y="445" width="54" height="27" rx="3" fill="#fff" stroke="#0891b2"/>
<rect x="1113.0" y="450" width="42" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="1134" y="436" class="port mono" text-anchor="middle">S1</text>
<rect x="1149.0" y="424" width="20" height="20" rx="4" fill="#0891b2" stroke="none"/>
<text x="1159.0" y="438" class="port" text-anchor="middle" style="fill:white">D</text>
<text x="1134" y="487" class="small" text-anchor="middle">dave</text>
<text x="1134" y="499" class="small" text-anchor="middle">Q3.1</text>
</g>
<g><title>jim S2: sfp-spare — 10G trunk; colony staging</title>
<rect x="1208.0" y="445" width="54" height="27" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="1214.0" y="450" width="42" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="1235" y="436" class="port mono" text-anchor="middle">S2</text>
<text x="1235" y="487" class="small" text-anchor="middle">fergal</text>
</g>
<g><title>dave Q1: palace — 100G; whole cage</title>
<rect x="444.0" y="695" width="92" height="27" rx="3" fill="#fff" stroke="#dc2626"/>
<rect x="450.0" y="700" width="80" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="490" y="686" class="port mono" text-anchor="middle">Q1</text>
<rect x="524.0" y="674" width="20" height="20" rx="4" fill="#dc2626" stroke="none"/>
<text x="534.0" y="688" class="port" text-anchor="middle" style="fill:white">H</text>
<text x="490" y="737" class="small" text-anchor="middle">palace</text>
</g>
<g><title>dave Q2: castle — 100G; whole cage</title>
<rect x="584.0" y="695" width="92" height="27" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="590.0" y="700" width="80" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="630" y="686" class="port mono" text-anchor="middle">Q2</text>
<text x="630" y="737" class="small" text-anchor="middle">castle</text>
</g>
<g><title>dave Q4: qsfp28-4-1 — No identified peer</title>
<rect x="864.0" y="695" width="92" height="27" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="870.0" y="700" width="80" height="17" rx="1" fill="#28364a" stroke="none"/>
<text x="910" y="686" class="port mono" text-anchor="middle">Q4</text>
<text x="910" y="737" class="small" text-anchor="middle">unmapped</text>
</g>
<g><title>dave MGMT: management — 100M management RJ45</title>
<rect x="1095.0" y="741" width="54" height="24" rx="3" fill="#fff" stroke="#64748b"/>
<rect x="1101.0" y="746" width="42" height="14" rx="1" fill="#28364a" stroke="none"/>
<text x="1122" y="732" class="port mono" text-anchor="middle">MGMT</text>
<rect x="1137.0" y="720" width="20" height="20" rx="4" fill="#64748b" stroke="none"/>
<text x="1147.0" y="734" class="port" text-anchor="middle" style="fill:white">E</text>
</g>
<text x="485" y="870" class="port mono" text-anchor="start">Q3.1</text>
<rect x="536" y="854" width="20" height="20" rx="4" fill="#0891b2" stroke="none"/>
<text x="546" y="868" class="port" text-anchor="middle" style="fill:white">D</text>
<text x="485" y="889" class="small" text-anchor="start">jim SFP+1</text>
<rect x="568" y="854" width="34" height="20" rx="3" fill="white" stroke="#0891b2"/>
<rect x="574" y="860" width="22" height="8" rx="1" fill="#0891b2" stroke="none"/>
<text x="685" y="870" class="port mono" text-anchor="start">Q3.2</text>
<rect x="736" y="854" width="20" height="20" rx="4" fill="#2563eb" stroke="none"/>
<text x="746" y="868" class="port" text-anchor="middle" style="fill:white">A</text>
<text x="685" y="889" class="small" text-anchor="start">brian SFP+1</text>
<rect x="768" y="854" width="34" height="20" rx="3" fill="white" stroke="#2563eb"/>
<rect x="774" y="860" width="22" height="8" rx="1" fill="#2563eb" stroke="none"/>
<text x="885" y="870" class="port mono" text-anchor="start">Q3.3</text>
<rect x="936" y="854" width="20" height="20" rx="4" fill="#4f46e5" stroke="none"/>
<text x="946" y="868" class="port" text-anchor="middle" style="fill:white">K</text>
<text x="885" y="889" class="small" text-anchor="start">stream LAN</text>
<rect x="968" y="854" width="34" height="20" rx="3" fill="white" stroke="#4f46e5"/>
<rect x="974" y="860" width="22" height="8" rx="1" fill="#4f46e5" stroke="none"/>
<text x="1085" y="870" class="port mono" text-anchor="start">Q3.4</text>
<rect x="1136" y="854" width="20" height="20" rx="4" fill="#7c3aed" stroke="none"/>
<text x="1146" y="868" class="port" text-anchor="middle" style="fill:white">B</text>
<text x="1085" y="889" class="small" text-anchor="start">brian SFP+2</text>
<rect x="1168" y="854" width="34" height="20" rx="3" fill="white" stroke="#7c3aed"/>
<rect x="1174" y="860" width="22" height="8" rx="1" fill="#7c3aed" stroke="none"/>
<rect x="205" y="1090" width="290" height="76" rx="5" fill="white" stroke="#dc2626"/>
<text x="232" y="1120" class="port mono" text-anchor="start">uplink-dave</text>
<rect x="459" y="1102" width="20" height="20" rx="4" fill="#dc2626" stroke="none"/>
<text x="469" y="1116" class="port" text-anchor="middle" style="fill:white">H</text>
<text x="350" y="1146" class="small" text-anchor="middle">Mellanox ConnectX-4 · 100G QSFP28</text>
<rect x="585" y="1090" width="290" height="76" rx="5" fill="white" stroke="#16a34a"/>
<text x="612" y="1120" class="port mono" text-anchor="start">host-jim</text>
<rect x="839" y="1102" width="20" height="20" rx="4" fill="#16a34a" stroke="none"/>
<text x="849" y="1116" class="port" text-anchor="middle" style="fill:white">F</text>
<text x="730" y="1146" class="small" text-anchor="middle">Intel I211 · 1G RJ45</text>
<rect x="965" y="1090" width="290" height="76" rx="5" fill="white" stroke="#db2777"/>
<text x="992" y="1120" class="port mono" text-anchor="start">river-jim-phy</text>
<rect x="1219" y="1102" width="20" height="20" rx="4" fill="#db2777" stroke="none"/>
<text x="1229" y="1116" class="port" text-anchor="middle" style="fill:white">G</text>
<text x="1110" y="1146" class="small" text-anchor="middle">Intel I211 · 1G RJ45</text>
<text x="95" y="1220" class="sub" text-anchor="start">Matching letter badges identify cable ends. Port labels describe configured use; they do not indicate current link state.</text>
</g></svg>

After

Width:  |  Height:  |  Size: 39 KiB

+608
View File
@@ -0,0 +1,608 @@
{
"view": "Front view; rack order is brian, jim, dave, then palace several U below. Socket order is physical; spacing and chassis widths are schematic. Stream sits physically left of brian and is drawn above it.",
"sources": {
"brian": "https://dl.ui.com/qig/usw-pro-xg-8-poe/",
"jim": "https://mikrotik.com/product/CRS326-24G-2SplusRM",
"dave": "https://mikrotik.com/product/crs504_4xq_in",
"stream": "https://www.gowinfanless.com/news/blogs/the-r86s-revolution-low-power-2-5gbe-and-10gbe-networking"
},
"brian": {
"model": "USW-Pro-XG-8-PoE",
"ports": [
{
"socket": "1",
"interface": "Port 1",
"label": "fort",
"role": "Configured port label",
"peer": "fort",
"peer_port": null
},
{
"socket": "2",
"interface": "Port 2",
"label": "castle",
"role": "Configured port label",
"peer": "castle",
"peer_port": null
},
{
"socket": "3",
"interface": "Port 3",
"label": "portcullis test",
"role": "portcullis test connection",
"peer": "portcullis",
"peer_port": null
},
{
"socket": "4",
"interface": "Port 4",
"label": "portcullis KVM",
"role": "Second JetKVM",
"peer": "portcullis-kvm",
"peer_port": null
},
{
"socket": "5",
"interface": "Port 5",
"label": "jim P7",
"role": "Backup fabric trunk",
"peer": "jim",
"peer_port": "7"
},
{
"socket": "6",
"interface": "Port 6",
"label": "Digiweb ONT",
"role": "Native VLAN 140; tagged VLAN 10",
"peer": "Digiweb ONT",
"peer_port": null
},
{
"socket": "7",
"interface": "Port 7",
"label": "wave",
"role": "AP trunk",
"peer": "wave",
"peer_port": "eth0"
},
{
"socket": "8",
"interface": "Port 8",
"label": "vibe",
"role": "AP trunk",
"peer": "vibe",
"peer_port": "ether1"
},
{
"socket": "9",
"interface": "SFP+ 1",
"label": "dave Q3.2",
"role": "LAG member 1",
"peer": "dave",
"peer_port": "Q3.2"
},
{
"socket": "10",
"interface": "SFP+ 2",
"label": "dave Q3.4",
"role": "LAG member 2",
"peer": "dave",
"peer_port": "Q3.4"
}
]
},
"jim": {
"model": "CRS326-24G-2S+RM",
"ports": [
{
"socket": "1",
"interface": "ether1",
"default_name": "ether1",
"label": "shytzel LAG",
"role": "Configured member of shytzel-downlink",
"peer": "shytzel",
"peer_port": null
},
{
"socket": "2",
"interface": "ether2",
"default_name": "ether2",
"label": "shytzel LAG",
"role": "Configured member of shytzel-downlink",
"peer": "shytzel",
"peer_port": null
},
{
"socket": "3",
"interface": "ether3",
"default_name": "ether3",
"label": "shytzel LAG",
"role": "Configured member of shytzel-downlink",
"peer": "shytzel",
"peer_port": null
},
{
"socket": "4",
"interface": "ether4",
"default_name": "ether4",
"label": "shytzel LAG",
"role": "Configured member of shytzel-downlink",
"peer": "shytzel",
"peer_port": null
},
{
"socket": "5",
"interface": "palace",
"default_name": "ether5",
"label": "palace host",
"role": "Core / netboot trunk",
"peer": "palace",
"peer_port": "host-jim"
},
{
"socket": "6",
"interface": "stream",
"default_name": "ether6",
"label": "stream LAN",
"role": "Backup RSTP trunk",
"peer": "stream",
"peer_port": "lan-jim"
},
{
"socket": "7",
"interface": "brian-downlink",
"default_name": "ether7",
"label": "brian P5",
"role": "Backup fabric trunk",
"peer": "brian",
"peer_port": "RJ45 5"
},
{
"socket": "8",
"interface": "palace-kvm",
"default_name": "ether8",
"label": "JetKVM",
"role": "lo access",
"peer": "palace-kvm",
"peer_port": null
},
{
"socket": "9",
"interface": "ether9",
"default_name": "ether9",
"label": "spare",
"role": "Unbridged spare",
"peer": null,
"peer_port": null
},
{
"socket": "10",
"interface": "castle",
"default_name": "ether10",
"label": "castle",
"role": "Backup attachment, normally down",
"peer": "castle",
"peer_port": "et2.5g"
},
{
"socket": "11",
"interface": "fort",
"default_name": "ether11",
"label": "fort",
"role": "lo access (configured label)",
"peer": "fort",
"peer_port": null
},
{
"socket": "12",
"interface": "laptop-dock",
"default_name": "ether12",
"label": "dock",
"role": "lo access (configured label)",
"peer": "laptop-dock",
"peer_port": null
},
{
"socket": "13",
"interface": "pronter",
"default_name": "ether13",
"label": "pronter",
"role": "lo access (configured label)",
"peer": "pronter",
"peer_port": null
},
{
"socket": "14",
"interface": "untrusted-sta1",
"default_name": "ether14",
"label": "guest",
"role": "Untrusted access",
"peer": "untrusted-sta1",
"peer_port": null
},
{
"socket": "15",
"interface": "ether15",
"default_name": "ether15",
"label": "unmapped",
"role": "lo access; peer unconfirmed",
"peer": null,
"peer_port": null
},
{
"socket": "16",
"interface": "ether16",
"default_name": "ether16",
"label": "unmapped",
"role": "lo access; peer unconfirmed",
"peer": null,
"peer_port": null
},
{
"socket": "17",
"interface": "ether17",
"default_name": "ether17",
"label": "unmapped",
"role": "lo access; peer unconfirmed",
"peer": null,
"peer_port": null
},
{
"socket": "18",
"interface": "ether18",
"default_name": "ether18",
"label": "unmapped",
"role": "lo access; peer unconfirmed",
"peer": null,
"peer_port": null
},
{
"socket": "19",
"interface": "ether19",
"default_name": "ether19",
"label": "unmapped",
"role": "lo access; peer unconfirmed",
"peer": null,
"peer_port": null
},
{
"socket": "20",
"interface": "ether20",
"default_name": "ether20",
"label": "unmapped",
"role": "lo access; peer unconfirmed",
"peer": null,
"peer_port": null
},
{
"socket": "21",
"interface": "stream-wan",
"default_name": "ether21",
"label": "stream WAN",
"role": "Untagged VLAN 130 handoff",
"peer": "stream",
"peer_port": "wan"
},
{
"socket": "22",
"interface": "river",
"default_name": "ether22",
"label": "river backup",
"role": "Dedicated router trunk",
"peer": "palace",
"peer_port": "river-jim-phy"
},
{
"socket": "23",
"interface": "ups",
"default_name": "ether23",
"label": "UPS",
"role": "lo access",
"peer": "ups",
"peer_port": null
},
{
"socket": "24",
"interface": "dave-management",
"default_name": "ether24",
"label": "dave mgmt",
"role": "Core management",
"peer": "dave",
"peer_port": "MGMT"
},
{
"socket": "S1",
"interface": "dave-uplink",
"default_name": "sfp-sfpplus1",
"label": "dave Q3.1",
"role": "10G fabric trunk",
"peer": "dave",
"peer_port": "Q3.1"
},
{
"socket": "S2",
"interface": "sfp-spare",
"default_name": "sfp-sfpplus2",
"label": "fergal",
"role": "10G trunk; colony staging",
"peer": "fergal",
"peer_port": "lan1"
}
]
},
"dave": {
"model": "CRS504-4XQ-IN",
"ports": [
{
"socket": "Q1",
"interface": "palace",
"default_name": "qsfp28-1-1",
"label": "palace",
"role": "100G; whole cage",
"peer": "palace",
"peer_port": "uplink-dave"
},
{
"socket": "Q2",
"interface": "castle",
"default_name": "qsfp28-2-1",
"label": "castle",
"role": "100G; whole cage",
"peer": "castle",
"peer_port": "et100g"
},
{
"socket": "Q3.1",
"interface": "jim-downlink",
"default_name": "qsfp28-3-1",
"label": "jim SFP+1",
"role": "10G breakout lane 1",
"peer": "jim",
"peer_port": "S1"
},
{
"socket": "Q3.2",
"interface": "brian1",
"default_name": "qsfp28-3-2",
"label": "brian SFP+1",
"role": "10G breakout lane 2; LAG",
"peer": "brian",
"peer_port": "9"
},
{
"socket": "Q3.3",
"interface": "stream",
"default_name": "qsfp28-3-3",
"label": "stream LAN",
"role": "10G breakout lane 3",
"peer": "stream",
"peer_port": "lan-dave"
},
{
"socket": "Q3.4",
"interface": "brian2",
"default_name": "qsfp28-3-4",
"label": "brian SFP+2",
"role": "10G breakout lane 4; LAG",
"peer": "brian",
"peer_port": "10"
},
{
"socket": "Q4",
"interface": "qsfp28-4-1",
"default_name": "qsfp28-4-1",
"label": "unmapped",
"role": "No identified peer",
"peer": null,
"peer_port": null
},
{
"socket": "MGMT",
"interface": "management",
"default_name": "ether1",
"label": "jim P24",
"role": "100M management RJ45",
"peer": "jim",
"peer_port": "24"
}
]
},
"links": [
{
"id": "A",
"from": [
"brian",
"9"
],
"to": [
"dave",
"Q3.2"
],
"description": "10G; first LAG member"
},
{
"id": "B",
"from": [
"brian",
"10"
],
"to": [
"dave",
"Q3.4"
],
"description": "10G; second LAG member"
},
{
"id": "C",
"from": [
"brian",
"5"
],
"to": [
"jim",
"7"
],
"description": "1G; redundant fabric trunk"
},
{
"id": "D",
"from": [
"jim",
"S1"
],
"to": [
"dave",
"Q3.1"
],
"description": "10G; direct fabric trunk"
},
{
"id": "E",
"from": [
"jim",
"24"
],
"to": [
"dave",
"MGMT"
],
"description": "100M; dave management"
},
{
"id": "F",
"from": [
"jim",
"5"
],
"to": [
"palace",
"host-jim"
],
"description": "1G; host core / netboot"
},
{
"id": "G",
"from": [
"jim",
"22"
],
"to": [
"palace",
"river-jim-phy"
],
"description": "1G; river backup trunk"
},
{
"id": "H",
"from": [
"dave",
"Q1"
],
"to": [
"palace",
"uplink-dave"
],
"description": "100G; host PF and guest VFs"
},
{
"id": "I",
"from": [
"stream",
"ETH0"
],
"to": [
"jim",
"21"
],
"description": "1G WAN; 2.5G socket on stream"
},
{
"id": "J",
"from": [
"stream",
"ETH1"
],
"to": [
"jim",
"6"
],
"description": "1G backup LAN; 2.5G socket on stream"
},
{
"id": "K",
"from": [
"stream",
"SFP+ R"
],
"to": [
"dave",
"Q3.3"
],
"description": "10G preferred LAN"
}
],
"stream": {
"model": "BROUNION R86S",
"ports": [
{
"socket": "ETH0",
"interface": "wan",
"label": "wan",
"role": "1G connection to jim 21",
"nic": "Intel I225-V",
"capacity": "2.5G"
},
{
"socket": "ETH1",
"interface": "lan-jim",
"label": "lan-jim",
"role": "1G connection to jim 6",
"nic": "Intel I225-V",
"capacity": "2.5G"
},
{
"socket": "ETH2",
"interface": "et2",
"label": "et2",
"role": "Unused",
"nic": "Intel I225-V",
"capacity": "2.5G"
},
{
"socket": "SFP+ R",
"interface": "lan-dave",
"label": "lan-dave",
"role": "10G connection to dave Q3.3",
"nic": "Mellanox ConnectX-3",
"capacity": "10G"
},
{
"socket": "SFP+ L",
"interface": "et5",
"label": "et5",
"role": "Unused",
"nic": "Mellanox ConnectX-3",
"capacity": "10G"
}
]
},
"palace": {
"ports": [
{
"socket": "uplink-dave",
"nic": "Mellanox ConnectX-4",
"capacity": "100G QSFP28"
},
{
"socket": "host-jim",
"nic": "Intel I211",
"capacity": "1G RJ45"
},
{
"socket": "river-jim-phy",
"nic": "Intel I211",
"capacity": "1G RJ45"
}
]
}
}
+191 -22
View File
@@ -1,7 +1,7 @@
# palace
The physical VM host for the home site. Runs the `river`, `cellar` and `sfh` VMs and feeds them
SR-IOV VFs, PCI NVMe drives and LVM disks.
The physical VM host for the home site. Runs the `river`, `cellar`, `sfh` and `slop-cannon` VMs and
feeds them SR-IOV VFs, PCI NVMe drives, LVM disks and an NVMe-oF disk.
- **Source:** [`nixos/boxes/home/palace/default.nix`](../../../nixos/boxes/home/palace/default.nix)
(VM definitions in [`palace/vms/default.nix`](../../../nixos/boxes/home/palace/vms/default.nix))
@@ -18,7 +18,7 @@ SR-IOV VFs, PCI NVMe drives and LVM disks.
| Host storage | 500 GB Samsung SSD 860 EVO containing the EFI partition and the `main` LVM thin pool |
| Bulk storage | Three 8 TB Seagate IronWolf disks in the `hdds` VG, providing the RAID-backed `hdd-storage` and `frigate` LVs |
| NVMe storage | Three 2 TB Samsung NVMe devices passed through to `cellar`; SPDK combines them as the `NVMeRaid` RAID 0 device |
| Network / graphics | Mellanox ConnectX-4 100G adapter with four SR-IOV VFs, two Intel I211 Gigabit Ethernet controllers, and an AMD Radeon RX 550/560-family GPU |
| Network / graphics | Mellanox ConnectX-4 100G adapter using SR-IOV, two Intel I211 Gigabit Ethernet controllers (the only BASE-T NICs), and an AMD Radeon RX 550/560-family GPU |
## Role
@@ -27,6 +27,8 @@ SR-IOV VFs, PCI NVMe drives and LVM disks.
the `main` thin pool (`services.lvm.boot.thin.enable`).
- AMD box (`kvm-amd`, `amd_iommu=on`, microcode updates); the kernel is built with
`ACPI_APEI_PCIEAER`/`PCIEAER` for the PCIe passthrough work below.
- Runs [`slop-broker`](../../slop-broker.md) for `slop-cannon`'s agents (see
[below](#slop-broker)).
## Network assignments
@@ -34,37 +36,204 @@ See the consolidated [network assignments](../../networking.md#box-assignments)
## Networking
100G `et100g` (mlx5, MTU 9000) uplinks to the `dave` switch and carries `lan-hi` (VLAN 100, the
`hi` assignment). A udev rule creates four SR-IOV VFs on the PF:
100G `uplink-dave` (mlx5, MTU 9000) connects to the `dave` switch and carries `lan-hi` (VLAN 100,
the `hi` assignment). A udev rule creates six SR-IOV VFs on the PF. Two physically separate Intel
connections lead to `jim`: `host-jim` serves `palace` and `sfh`, while `river-jim-phy` is exported
exclusively to `river`.
| VF | Consumer | VLAN handling |
|---|---|---|
| 0 | `cellar` | `hi` |
| 1 | `river` | untagged VF; `river` tags its LAN and WAN VLANs |
| 2 | `sfh` | `hi` |
| 3 | `sfh` container MACVLAN parent | `hi` |
- `lan-core` is a bridge with the `core` assignment (no gateway); the 1G `host-jim` connection and
the `lan-lo-phy` VLAN ride on it. `lan-lo` is a second, L3-less bridge used for VM netboot and
`lo` clients.
- The separate 1G `river-jim-phy` connection is exported exclusively to `river` as the
passthru-mode macvtap `river-jim-tap`; the guest names it `lan-jim`. Direct PCI passthrough is
blocked by its shared X399 IOMMU group; see [PCI isolation](#pci-isolation).
- `lan-core` is a bridge with the `core` assignment (no gateway); the 1G
`lan-core-phy` and the `lan-lo-phy` VLAN ride on it. `lan-lo` is a second, L3-less bridge used
for VM netboot and `lo` clients.
- The 1G `et1g0` (igb) is exported to `river` as a passthru-mode macvtap (`vm-et1g0`) — river sees
it as `wan-old`.
### PCI isolation
The Intel I211 controllers at `04:00.0` (`river-jim-phy`) and `06:00.0` (`host-jim`) share IOMMU
group 13 with chipset USB/SATA controllers, PCIe bridges and the wireless controller. Passing
only the router NIC through VFIO would leave the group nonviable; detaching the whole group
would remove essential host devices. The dedicated passthru-mode macvtap keeps the NIC host-owned.
Direct passthrough would need a NIC or firmware layout that isolates the controller.
Keep both Intel connections: `host-jim` provides independent host management and VM netboot,
while `river-jim-phy` carries the router's redundant trunk. The host physical router interface and
its macvtap both use `hiMTU`; the macvtap enables all-multicast reception so guest RSTP can receive
BPDUs without a guest-to-host receive-filter synchronization service.
### End-to-end interface topology
```text
dave
└─ palace uplink-dave (ConnectX-4 PF)
├─ VLAN 100 ───────────────────────────────> palace lan-hi ───> cellar NVMe/RDMA (slop-cannon's disk)
├─ VF 0 cellar-hi ────────────────────────> cellar lan-hi
├─ VF 1 river-rdma ───────────────────────> river rdma-hi ──> cellar NVMe/RDMA
├─ VF 2 sfh-hi ───────────────────────────> sfh lan-hi ─────> cellar NVMe/RDMA
├─ VF 3 sfh-ctrs ─────────────────────────> sfh ctrs-hi
│ ├─> hass host0
│ └─> unifi host0
├─ VF 4 river-dave ───────────────────────> river lan-dave ──┐
└─ VF 5 slop-cannon-ut ───> slop-cannon lan-untrusted │
├─> river lan (RSTP)
jim │
├─ palace river-jim-phy ── river-jim-tap ─────> river lan-jim ───┘
└─ palace host-jim ──> palace lan-core
├─ sfh-core-tap ───────────────────────────> sfh ctrs-core ──> unifi lan-core
└─ VLAN 110 lan-lo-phy ──> palace lan-lo
└─ sfh-lo-tap ──────────────────────────> sfh ctrs-lo
├─> sfh PXE
└─> hass lan-lo
```
Inside `river`, `lan-dave` and `lan-jim` terminate on the shared `lan` RSTP bridge. `lan-core` is a
MACVLAN above it; `lan-hi`, `lan-lo` and `lan-untrusted` are VLAN uppers. `river` also adds its
Digiweb VLANs 10 and 140 to this bridge. `rdma-hi` is deliberately outside it.
VF 4 explicitly enables trust and disables MAC spoof checking for bridge traffic, which can use
MACs other than the VF's assigned address. Its automatic link state follows the physical port;
the storage VFs retain forced link state so local VF-to-VF storage can continue without carrier.
The firmware must expose enough VFs before the udev allocation can succeed.
### Interface map
The physical connections terminate on `palace`; PCI VFs and virtual interfaces hand traffic
from the host to its guests. Interface names in the destination columns belong to that box.
#### Physical connections
| Switch port | Host interface | Host networks | Guest handoff |
|---|---|---|---|
| `dave` `palace` | `uplink-dave` | VLAN 100 → `lan-hi` | Six PCI VFs, listed below |
| `jim` `palace` | `host-jim` | Native `core` → `lan-core`; VLAN 110 → `lan-lo-phy` → `lan-lo` | `sfh-core-tap` and `sfh-lo-tap` |
| `jim` `river` | `river-jim-phy` | No host L3 configuration | `river-jim-tap` macvtap → `river` `lan-jim` |
#### ConnectX-4 VFs
All six VFs belong to `uplink-dave`. VLAN filtering and carrier policy are applied on the PF.
| VF / PCI BDF | QEMU device | Guest | Guest interface | VLAN / carrier | Role |
|---|---|---|---|---|---|
| 0 / `44:00.1` | `cellar-hi` | [cellar](cellar.md) | `lan-hi` | 100 / forced up | Storage target and management |
| 1 / `44:00.2` | `river-rdma` | [river](river.md#storage) | `rdma-hi` | 100 / forced up | Dedicated NVMe/RDMA root path |
| 2 / `44:00.3` | `sfh-hi` | [sfh](sfh/README.md) | `lan-hi` | 100 / forced up | NVMe/RDMA root and management |
| 3 / `44:00.4` | `sfh-ctrs` | [sfh](sfh/README.md#networking) | `ctrs-hi` | 100 / forced up | Container `hi` network |
| 4 / `44:00.5` | `river-dave` | [river](river.md#virtual-machine-and-network-attachment) | `lan-dave` | Unfiltered trunk / automatic | Preferred RSTP attachment |
| 5 / `44:00.6` | `slop-cannon-ut` | [slop-cannon](slop-cannon.md#network) | `lan-untrusted` | 120 / automatic | Agents' only network. MAC spoof checking is on. |
#### Virtual Ethernet handoffs
| Host interface | Kind / parent | Guest interface | Downstream use |
|---|---|---|---|
| `river-jim-tap` | Passthru macvtap on `river-jim-phy` | `river` `lan-jim` | Backup RSTP attachment |
| `sfh-core-tap` | TAP on `lan-core` | `sfh` `ctrs-core` | `unifi` `lan-core` |
| `sfh-lo-tap` | TAP on `lan-lo` | `sfh` `ctrs-lo` | PXE boot; `hass` `lan-lo` |
`sfh` keeps no L3 configuration on the three `ctrs-*` parents. Its nspawn configuration creates the
container-side names shown above; `host0` remains the default `hi` interface in both containers.
See [the `sfh` page](sfh/README.md#networking) for its container-oriented view and
[failover validation](router-failover.md) for tested failure scenarios and maintenance checks.
## VMs
The RAID-backed `hdds` LVs need `dm-raid` loaded in the initrd: LVM's initial autoactivation can
run before stage-two module loading. `sfh` requires the `frigate` LV before QEMU can start.
| VM | vCPUs | RAM | Passthrough | Notes |
|---|---|---|---|---|
| `cellar` | 8c × 2t | 16 GiB | VF 0 (`44:00.1`); NVMe `41:00.0`–`43:00.0` | pinned to NUMA node 1; split IRQ chip + vIOMMU |
| `river` | 3c × 2t | 4 GiB | VF 1 (`44:00.2`); macvtap `vm-et1g0` | only an ESP local disk (plus an installer ISO) — root is NVMe-oF from `cellar` |
| `sfh` | 8c × 2t | 32 GiB | VF 2 (`44:00.3`), VF 3 (`44:00.4`); two USB host ports | no boot disk — netboots; gets the `hdds/frigate` LV |
| `cellar` | 8c × 2t | 16 GiB | `cellar-hi` VF 0 (`44:00.1`); NVMe `41:00.0`–`43:00.0` | pinned to NUMA node 1; split IRQ chip + vIOMMU |
| `river` | 3c × 2t | 4 GiB | `river-rdma` VF 1 (`44:00.2`), `river-dave` VF 4 (`44:00.5`), `river-jim-tap` | only an ESP local disk (plus an installer ISO) — root is NVMe-oF from `cellar` |
| `sfh` | 8c × 2t | 32 GiB | `sfh-hi` VF 2 (`44:00.3`), `sfh-ctrs` VF 3 (`44:00.4`); two USB host ports | no boot disk — netboots; gets the `hdds/frigate` LV |
| `slop-cannon` | 16c × 2t | 24 GiB | `slop-cannon-ut` VF 5 (`44:00.6`) | disk is NVMe-oF from `cellar`, connected by `palace` (plus an installer ISO) |
`slop-cannon`'s vCPUs are overcommitted (the VMs total more vCPUs than the host's 32 threads) so
coding agents can burst; `vm@slop-cannon` has a low `CPUWeight`, so `cellar`, `river` and `sfh`
win under contention.
Boot ordering is enforced with systemd dependencies: `vm@river` waits for `cellar`'s SSH port (and
for the `vm-et1g0` device), and `vm@sfh` waits for `river` — storage first, then the router, then
everything that boots off both.
for the `river-jim-tap` device), and `vm@sfh` waits for `river` — storage first, then the router,
then everything that boots off both. `vm@slop-cannon` waits only for its disk (below); nothing
waits for it.
`vm@` units don't restart on deploy (`restartIfChanged = false`); a changed VM config applies the
next time the VM starts.
### `slop-cannon`'s disk
`palace` is an NVMe-oF initiator for one guest: `slop-cannon`'s disk is
`nqn.2016-06.io.spdk:slop-cannon` on [`cellar`](cellar.md), connected by `palace` (`my.nvme.uuid`
is its host NQN) and passed to QEMU as a virtio disk. The guest never speaks NVMe-oF itself:
SPDK only checks the host NQN, which root in the guest could forge.
`palace` hosts `cellar`, so the connection is kept out of `palace`'s own boot and shutdown:
- `slop-cannon-disk.service` waits for `cellar`'s SSH port, runs `nvme connect -t rdma` over
`lan-hi` and disconnects on stop. It is `BindsTo` / `After` `vm@cellar`, and only
`vm@slop-cannon` requires it. Nothing in the initrd, `fileSystems` or `multi-user.target` uses
the disk.
- Shutdown runs in reverse: `vm@slop-cannon`, then the disconnect, then `cellar`.
- `--ctrl-loss-tmo 60`: if `cellar` dies, the controller is removed after a minute and QEMU sees
I/O errors, instead of the kernel retrying forever.
- `devices/global_filter` rejects `/dev/nvme*` in `lvm.conf`, so `palace` never activates the
guest's volume group (also called `main`). `palace` has no NVMe of its own.
- The filter has no accept pattern: LVM accepts a device if any of its names matches one, and
the disk's `/dev/disk/by-*` links would.
- Without it, `palace` sees two VGs called `main`, and LVM commands naming `main` refuse to
run.
## `slop-broker`
`palace` runs [`slop-broker`](../../slop-broker.md), which carries out privileged operations for
the agents on `slop-cannon` after policy and, usually, a human approve them.
- `slop-cannon` reaches it only over vsock: the VM has a `vhost-vsock-pci` device, and the broker
identifies it by that device's CID. Policy is set per operation in
[`palace/slop-broker.nix`](../../../nixos/boxes/home/palace/slop-broker.nix).
- The broker holds the deploy key (age secret `palace/slop-broker-deploy.key`). That key is root on
every box, so `palace` must be treated as being as sensitive as a workstation with `.keys/`.
- Deploys are built by `slop-broker-build`, a user without keys that the broker reaches over SSH
(`services.slop-broker-builder`). It fetches
commits from Gitea with a read-only deploy key on `dev/nixfiles` (age secret
`palace/slop-broker-git.key`, mirrored in `/var/lib/slop-broker-build/repository.git`) and builds
with `palace`'s Nix daemon, so builds use the host's spare CPU and memory.
- Because they run agent-written Nix, builds (the `nixbld` group) and the builder's own fetches
are kept off internal networks like `lan-untrusted` is (`lib.my.c.internalNets`), and only
`git` gets the builder's Gitea key. `nix-daemon.service` has memory limits and a low
`CPUWeight`, so builds can't starve the VMs. Builds you run on `palace` yourself are confined
the same way.
- Agents' use of the builder (the `builder` step of `slop deploy` and `slop build`) asks, showing
the commits and their diff, with a one-hour lease on offer; commits already on `master` don't
ask. `slop build` then pushes without asking again, while deploys still ask once built.
- `slop build` outputs are pushed to the binary cache on [`object`](../colony/shill/containers/object.md)
as `harmonia`, with a key of the broker's own (age secret `palace/slop-broker-cache.key`) whose
forced command allows only the store protocol and adding GC roots (see
[Binary cache](../../slop-broker.md#binary-cache)).
- The broker's age identity (age secret `palace/slop-broker-age.key`, public key
`.keys/slop-broker.pub`) is a recipient of every secret, so it can carry out `slop secret`. Its
builder looks each request's file up on `master` and evaluates `master`'s `secrets.nix` for the
approval (see [Secrets](../../slop-broker.md#secrets)). Listing a secret's keys doesn't ask;
everything else does, and reading one never offers a lease.
- Answer requests on `palace` as `dev` with `slop-approve`. In a terminal it shows each request
in full, asks for an answer and waits for new ones; `slop-approve list` and
`slop-approve <id> <decision>` (any unique ID prefix) work from scripts. `slop-approve log`
shows recent requests, answers and results from the audit log
(`/var/lib/slop-broker/audit.jsonl`, also in the journal).
- The [approvals web app](../../slop-broker.md#approvals-web-app) listens on TCP port 8095,
which the firewall opens only to `middleman`, the reverse proxy for `approve.slop.nul.ie`.
Approvers sign in through Pocket ID (client secret in age secret
`palace/slop-broker-oidc-secret`); its sessions, push subscriptions and push signing key are in
`/var/lib/slop-broker/web`. Deploys to the routers need a fresh passkey there.
- Requesters and approvers on other boxes log in over SSH as `slop`, whose keys can only run the
broker's forced command (see
[Other requesters and approvers](../../slop-broker.md#other-requesters-and-approvers)). The
agents on `castle` are the requester `castle`, with the same policy as `slop-cannon`, and
`castle` also has an approver key (`sshApprovers.castle`).
## Notable config files
- [`nixos/boxes/home/palace/default.nix`](../../../nixos/boxes/home/palace/default.nix) — host
hardware, networkd (links/bridges/SR-IOV), LVM.
- [`nixos/boxes/home/palace/vms/default.nix`](../../../nixos/boxes/home/palace/vms/default.nix) —
VM instances and boot ordering.
VM instances, boot ordering and `slop-cannon`'s disk connection.
- [`nixos/boxes/home/palace/slop-broker.nix`](../../../nixos/boxes/home/palace/slop-broker.nix) —
the broker's policy for `slop-cannon`, its deploy key and the VM's vsock device.
+35 -12
View File
@@ -24,9 +24,10 @@ See the consolidated [network assignments](../../networking.md#box-assignments)
### Link and addressing
`services.pppd` peer `digiweb` attaches directly to `wan-pon-isp`, the raw ISP VLAN 10
(`vlans.pon-isp`) trunked untranslated from the ONT through `brian` and `dave`; see
[switches.md](switches.md). The netdev has no L3 configuration and uses `MTUBytes=1508`, leaving a
clean `mtu`/`mru 1500` after PPPoE overhead.
(`vlans.pon-isp`) trunked untranslated from the ONT. It normally reaches `river` through `brian`
and `dave`; the configured RSTP path through `jim` is intended to provide redundancy after
successful deployment and validation. See [switches.md](switches.md). The netdev has no L3
configuration and uses `MTUBytes=1508`, leaving a clean `mtu`/`mru 1500` after PPPoE overhead.
The static `84.203.124.128` address is requested through IPCP. The provider-wide credentials are
deliberately not secret; the peer persists indefinitely with LCP echo monitoring and ignores
@@ -46,23 +47,45 @@ every WAN flap.
### Traffic shaping
The shared `wan-ifb` ingress-shaping pieces are inert here. CAKE is specific to `stream`, and
`networkd-dispatcher` is `mkForce false` pending scheduling tests.
CAKE and the `wan-ifb` network configuration remain specific to `stream`. The shared IFB netdev
exists here but has no matching `.network` file to trigger the ingress-mirroring rule. The source
enables the shared `networkd-dispatcher` for RSTP setup.
## Platform
### Virtual machine and network attachment
The 100G `lan` NIC is VF 1 of `palace`'s `et100g` (MTU 9000), with every router VLAN tagged on top
as `55-lan`. A macvtap of `palace`'s 1G `et1g0` remains as the old `wan-old` path without L3
configuration. Deployments use the `hi` assignment.
The router's ordinary networks sit above the `lan` RSTP bridge. Its preferred port, `lan-dave`, is
an unfiltered ConnectX-4 VF trunk; `lan-jim` is the 1G `river-jim-tap` macvtap exported by
`palace`. Native `core`, the client VLANs and Digiweb VLANs 10/140 use `dave` normally and fail
over to `jim`. The shared policy is documented in [Router HA](../../networking.md#router-ha);
[failover validation](router-failover.md) covers attachment and switch outages.
The bridge uses the trunk VF's assigned MAC so the ConnectX-4's local switching can deliver
traffic from `palace` and the other VFs to the router. On `lan-hi` and `rdma-hi`, `arp_ignore=1`
and `arp_announce=2` keep router and storage addresses on their respective interfaces; otherwise
the storage VF can answer ARP for the router VIP and attract traffic to the wrong interface.
The separate ConnectX-4 VF `rdma-hi` is not a bridge port. It has a PF-applied VLAN 100 and exists
only for storage traffic.
Ordinary Ethernet traverses the guest software bridge; this does not require mlx5
switchdev or host representors. The bridge disables LRO on its ports; RDMA stays outside this
path.
### Storage
The VM's local disk holds only an ESP; `/nix` and `/persist` are LVs on `cellar`'s
`nqn.2016-06.io.spdk:river` namespace over RDMA. The initrd brings up `lan-hi`
with `roceBootModules`, and `KeepConfiguration=static` prevents networkd from dropping the address
during reconfiguration. An installer ISO remains attached.
`nqn.2016-06.io.spdk:river` namespace over RDMA. The initrd brings up `rdma-hi` with the dedicated
`rdma` assignment and a link-scoped host route to `cellar`, alongside `roceBootModules`.
NixOS copies the main system's `.link` units into the systemd initrd, so the `rdma-hi` rename is
shared, but its `.network` and `.netdev` units are separate. `river` therefore declares the storage
assignment and route once under `boot.initrd.systemd.network` and again under the main
`systemd.network`. The systemd initrd leaves its kernel network state in place during the stage-two
handover; `KeepConfiguration=static` on the main `.network` prevents networkd from dropping and
recreating the static address and route underneath the mounted NVMe-oF root. An installer ISO
remains attached.
## Netboot
@@ -76,4 +99,4 @@ assignment, restricted to the `hi` and `lo` prefixes.
- [`nixos/boxes/home/routing-common/default.nix`](../../../nixos/boxes/home/routing-common/default.nix) —
shared router definition (assignments, firewall/NAT, `as211024`).
- [`nixos/boxes/home/palace/vms/default.nix`](../../../nixos/boxes/home/palace/vms/default.nix) —
the VM definition on `palace` (VF 1, macvtap, ESP disk).
the VM definition on `palace` (dedicated RDMA VF, trunk VF, macvtap and ESP disk).
+62
View File
@@ -0,0 +1,62 @@
# Router failover validation
Failure-scenario checks for the deployed home router pair. The design lives in
[Router HA](../../networking.md#router-ha), the physical paths in [switches.md](switches.md),
and the host/VF layout in [palace.md](palace.md) and [river.md](river.md).
## Validated scenarios
These checks were performed on 2026-11-15. WAN and ONT probes check Ethernet path availability;
reads from `river`'s root LV and probes over `rdma-hi` check its separate storage path.
| Scenario | Test | Validated behavior |
|---|---|---|
| Router startup | Boot both routers | Kea starts without retries; the configured bridge MAC, ARP policy and administrative RSTP costs are applied |
| Primary router offline | Reboot its host | `stream` takes over both IPv4 and IPv6 VIPs, then returns to standby when `river` recovers |
| Preferred guest port down | Disable `river`'s `lan-dave`, then restore it | `lan-jim` becomes root/forwarding; WAN, ONT and 9000-byte RDMA pings pass while direct root-LV reads continue for 20 seconds |
| Backup guest port down | Disable `river`'s `lan-jim`, then restore it | `lan-dave` stays root/forwarding; WAN, ONT, jumbo RDMA and root-LV read checks pass |
| Physical `palace` attachment lost | Disable `dave`'s `palace` port for 30 seconds with automatic restoration | `lan-dave` loses carrier and `lan-jim` becomes root/forwarding; forced-link storage VFs retain local RDMA and root-LV reads succeed |
| Whole `dave` outage | Reboot the switch | `jim` becomes root and forwards on `brian-downlink`; Digiweb WAN and ONT access use `jim`–`brian` while local RDMA reads continue |
| Whole `jim` outage | Reboot the switch | `river` continues using `dave`; WAN, ONT and root-storage read probes succeed |
| Restoration | Restore each failed attachment or switch | The normal RSTP preferences return and `palace` is reachable on `hi` again |
Brief WAN/ONT probe losses occur during the tested `dave` tree transitions; subsequent probes
succeed on the backup tree and after restoration. The monitors recorded no storage-read
failures or matched kernel NVMe errors. The whole-switch test demonstrates the backup WAN path
without relying on the direct `jim`–`dave` trunk.
## Test limits
The storage checks exercise reads, not write integrity or long-duration endurance. They validate
local VF-to-VF RDMA during physical carrier loss, not failure of the ConnectX-4 itself. Storage
still depends on the adapter, `palace` and `cellar`; see [river's storage](river.md#storage).
`brian`'s live RSTP port state was not captured during the outage tests. Its backup
connection is validated by successful WAN and ONT traffic while `dave` is offline.
Disabling only the guest trunk VF while the host PF remains healthy is an artificial fault:
`palace`'s `hi` return traffic can still target that local VF's MAC and become unreachable through
`river`. During physical carrier loss, external `hi` access to the host and its guests is also
unavailable. `palace` remains accessible on `core` through a jump connection from `stream`;
direct routed management access depends on a working return route.
## Repeating the checks
Perform maintenance from a box independent of `palace`, such as `tower`. Before interrupting
`palace` or `dave`, power `castle` off cleanly: its NVMe-oF root depends on `cellar` and `dave`.
Keep a known-working boot entry and working JetKVM video and keyboard access.
1. Check boot defaults, system profiles, switch VLAN membership and spanning-tree state. When
changing host and guest networking together, stage matching configurations with `deploy --boot`.
2. Verify VF isolation, VLAN/trust/carrier policies, MTUs, the RoCE GID and the mounted NVMe
subsystem before injecting a fault.
3. Arrange independent automatic restoration before disabling an interface or switch port.
Run probes and storage reads in a service that survives loss of the SSH connection; bound
remote commands so a path change cannot leave a check waiting indefinitely.
4. Inject one fault at a time. Monitor root/alternate port roles, native `core`, client VLANs,
ONT access, PPPoE, DNS through the floating VIPs and storage I/O. Capture BPDUs when changing
the topology and watch for returned own-source packets or MAC flapping.
5. Restore the path and verify the normal RSTP roles, VIP ownership, services and management
access before testing another fault.
Switch changes require confirmation; see [switches.md](switches.md#accessing-the-switches).
+12 -7
View File
@@ -31,16 +31,21 @@ See the consolidated [network assignments](../../../networking.md#box-assignment
## Networking
Four NICs, all MTU 9000 where jumbo-capable:
| Interface | `palace` attachment | Purpose |
|---|---|---|
| `lan-hi` | `sfh-hi` SR-IOV VF 2 | Box's `hi` assignment and NVMe/RDMA root path; MTU 9000 |
| `ctrs-hi` | `sfh-ctrs` SR-IOV VF 3 | L3-less MACVLAN parent for each container's `host0`; MTU 9000 |
| `ctrs-core` | Virtio via `sfh-core-tap`, `lan-core` and `host-jim` | L3-less MACVLAN parent for UniFi's `lan-core` management attachment |
| `ctrs-lo` | Virtio via `sfh-lo-tap`, `lan-lo` and `host-jim` | L3-less MACVLAN parent for `hass`'s `lan-lo` and the VM's PXE path |
- `lan-hi` — SR-IOV VF 2, the box's own `hi` assignment.
- `lan-hi-ctrs` — SR-IOV VF 3, no L3: the MACVLAN parent for the containers' `hi` interfaces
(`host0` inside each container).
- `lan-core-ctrs` / `lan-lo-ctrs` — virtio NICs (bridged to palace's `lan-core` / `lan-lo`), no
L3: MACVLAN parents for containers that need a `core` or `lo` interface.
The two VFs separate the box's RDMA root traffic from container `hi` traffic; they do not provide
redundant switch paths. The Virtio attachments reach the `jim`-facing `palace` host bridges. Container
`host0` names are intentionally unchanged.
The per-container MACVLAN wiring lives in `systemd.nspawn.*.networkConfig` in
[`sfh/default.nix`](../../../../nixos/boxes/home/palace/vms/sfh/default.nix).
[`sfh/default.nix`](../../../../nixos/boxes/home/palace/vms/sfh/default.nix). The
[`palace` interface topology](../palace.md#end-to-end-interface-topology) traces these interfaces
back through the VM handoffs to the physical switch connections.
## Containers
+11 -6
View File
@@ -18,12 +18,15 @@ integrations. A `hass-cli` wrapper uses a token from `my.secrets` to reach the l
- **mosquitto** — MQTT broker (anonymous local listener; port 1883 allowed, alongside HTTP).
- **go2rtc** — restreams the Reolink living-room camera (RTSP from `reolink-living-room`, on the
`lo` network) and the office USB webcam (`/dev/video0` via ffmpeg).
`lo` network) and the office USB webcam (`/dev/hass-webcam/video0` via ffmpeg).
- **Frigate** (`services.frigate`, `frigate.h.nul.ie` — the `frigate` alt name on the `hi`
assignment) — records both restreamed cameras with a short retention policy; detection is
disabled.
- External access is via `https://hass.nul.ie` through the `middleman` reverse proxy
(`trusted_proxies`); internally it's `hass-ctr.h.nul.ie`.
- External access is via `https://hass.nul.ie` through the `middleman` reverse proxy;
internally it's `hass-ctr.h.nul.ie`. Home Assistant's HTTP settings (port `8123`, forwarded
headers and `middleman`'s addresses as trusted proxies) live in the UI under Settings › System
› Network, stored in `.storage/http`, not in Nix. Update the trusted proxies there if
`middleman`'s addresses change, or logins through the proxy will fail.
- Not a deploy-rs target (`my.deploy.enable = false`) — it's rendered via `my.asContainer` and
started by `sfh`'s `my.containers.instances`.
@@ -42,13 +45,15 @@ Frigate footage lives on a **separate HDD LV**: `palace` passes the `hdds/frigat
Passed through from `sfh` (USB host ports on `palace`):
- Nabu Casa Connect ZBT-1 Zigbee coordinator → `/dev/ttyUSB0` (used by `zha`).
- USB webcam → `/dev/video0` (go2rtc's `webcam_office` stream).
- USB webcam → `/dev/hass-webcam/video0` (go2rtc's `webcam_office` stream). The container
starts with an empty `/dev/hass-webcam` directory if the webcam is absent. Restart the
container after reconnecting the webcam to expose it again.
- The matching raw USB device node allowed through from `sfh`.
## Networking
MACVLAN interfaces created from `sfh`'s container NICs: `host0` on `lan-hi-ctrs` (the `hi` assignment,
alt name `frigate`, default gateway via the VIP) and `lan-lo` on `lan-lo-ctrs` (the `lo`
MACVLAN interfaces created from `sfh`'s container NICs: `host0` on `ctrs-hi` (the `hi` assignment,
alt name `frigate`, default gateway via the VIP) and `lan-lo` on `ctrs-lo` (the `lo`
assignment, no gateway) — the `lo` interface reaches the IoT devices (the Reolink camera lives there).
## Notable config files
+2 -2
View File
@@ -29,8 +29,8 @@ management network. It is imported, listed in `sfh`'s `my.containers.instances`,
## Networking
Two MACVLAN interfaces come from `sfh`'s container NICs: `host0` on `lan-hi-ctrs` carries the `hi`
assignment (`unifi-ctr`, default gateway via the VIP), while `lan-core` on `lan-core-ctrs` carries
Two MACVLAN interfaces come from `sfh`'s container NICs: `host0` on `ctrs-hi` carries the `hi`
assignment (`unifi-ctr`, default gateway via the VIP), while `lan-core` on `ctrs-core` carries
the gatewayless `core` assignment (`unifi-ctr-core`). The `core` interface is how the controller
talks to `brian` and the other switches on their management network.
+257
View File
@@ -0,0 +1,257 @@
# slop-cannon
Coding agents (Claude Code and Codex), driven from the phone or a browser through
[Paseo](https://github.com/getpaseo/paseo), running in a VM on [`palace`](palace.md) with root
inside it.
- **Source:** [`nixos/boxes/home/palace/vms/slop-cannon.nix`](../../../nixos/boxes/home/palace/vms/slop-cannon.nix)
(the VM itself in [`palace/vms/default.nix`](../../../nixos/boxes/home/palace/vms/default.nix))
- **Host:** VM on `palace`
- **nixpkgs:** `mine`
## VM resources
| vCPUs | RAM | Disk | Network | Other |
|---|---|---|---|---|
| 16c × 2t (overcommitted) | 24 GiB | 512 GiB virtio, NVMe-oF from `cellar` via `palace` | SR-IOV VF 5 (`44:00.6`) on VLAN 120 | installer ISO |
`vm@slop-cannon` has a low `CPUWeight` on `palace`, so `cellar`, `river` and `sfh` win under
contention. `palace` has `kvm_amd` `nested=1`, so the guest has `/dev/kvm`.
## Role
- Runs the Paseo daemon and the agents it starts, as the user `slop-cannon`. Agents have root in
the VM (`wheel`, passwordless `doas`): nested VMs, kernel modules, system services.
- A normal deploy node (`deploy .#slop-cannon`, `ssh-machine slop-cannon`).
- Everything inside the guest is treated as agent-controlled. The boundaries are outside it:
the `untrusted` filter on the routers, the VLAN tag on the NIC and the disk connection on
`palace`. Credentials for deploying or logging into other boxes stay outside the VM, with
[`slop-broker`](../../slop-broker.md) on `palace`.
## Network assignments
See the consolidated [network assignments](../../networking.md#box-assignments) table (this box:
`slop-cannon`).
## Network
- The only interface, `lan-untrusted`, is SR-IOV VF 5 on `palace`. The NIC tags and filters VLAN
120 and enforces MAC spoof checking on the host side. The guest loads `mlx5_core` at boot.
See the [VF attachment table](palace.md#connectx-4-vfs).
- A static `untrusted` address (outside both routers' DHCP pools), MTU 1500. DNS is Cloudflare,
as `untrusted`'s DHCP and RAs hand out; the routers' resolvers aren't reachable from
`untrusted`.
- The routers keep `untrusted` to the Internet (see
[Untrusted clients](../../networking.md#untrusted-clients)). `git.nul.ie` and
`paseo-relay.nul.ie` resolve to colony IPv6 addresses, which are rejected, so Gitea and the
Paseo relay fall back to IPv4 immediately.
- SSH from `hi` and `lo` works through the routers. The VM shares layer 2 with other clients
on the `untrusted` VLAN.
- Builds use the guest's own Nix daemon and store, behind the same filter.
## Storage
- One virtio disk: GPT with a 2 GiB ESP (partition label `esp`) and an LVM PV in VG `main`.
- `slop-cannon-nix`, `slop-cannon-persist` and `slop-cannon-tmp` are thin LVs in `main/tpool`,
overcommitted, so space goes to whichever needs it. The pool takes 90% of the VG; LVM grows it
into the rest at 80% full (`thin_pool_autoextend_threshold`). Watch `lvs` if it gets close.
- The root is `tmproot`; `/tmp` is its own LV, cleaned on boot and mounted with `discard`, so
agents' scratch files don't use RAM and freed space returns to the pool.
- The disk is `nqn.2016-06.io.spdk:slop-cannon` on [`cellar`](cellar.md), connected by `palace`
(see [`palace`'s disk notes](palace.md#slop-cannons-disk)). The guest never speaks NVMe-oF.
## Users and secrets
| User | Purpose |
|---|---|
| `slop-cannon` | Runs Paseo and the agents; `wheel` and `kvm`; locked password, Dev's SSH key; home persisted; UID/GID pinned in `lib.my.c.ids` |
| `dev` | Administration; locked password, Dev's SSH key |
- No `user-passwd.txt` (`my.user.passwordSecret = null`): root belongs to the agents, so the box
gets no shared secrets. Recovery is through the installer ISO.
- The VM's SSH host key is the age identity for `slop-cannon/paseo.env` and
`slop-cannon/gitea-token`. Agents can read the host key and decrypt anything encrypted to it.
## Paseo
A daemon (`paseo-server`) that starts and manages agents and serves a WebSocket API to the Paseo
app, the web UI and the `paseo` CLI. Claude Code runs through the Claude Agent SDK, using the
installed `claude` and its claude.ai login; Codex runs through `codex app-server`.
### Service
- The `services.paseo` module from our Paseo fork (flake input `paseo`, imported in
`nixos/modules/common.nix`), with a package override for the web UI bug
[getpaseo/paseo#7673](https://github.com/getpaseo/paseo/issues/7673).
- The fork, [`dev/paseo`](https://git.nul.ie/dev/paseo), adds support for colocated Jujutsu
repositories: Jujutsu workspaces, change views and actions in the app, and
`paseo workspace jj` in the CLI. Each `fork/jujutsu-v<version>` branch carries the fork commits
on an upstream release; `main` mirrors upstream. The branch's `docs/jujutsu-fork.md` explains
the controls and how to rebase the fork.
- The fork also compacts an idle Claude agent with a large context shortly before its one-hour
prompt cache expires, as Claude Code does in a terminal. It is on by default and set with
`agents.idleCompaction` (see the fork's `public-docs/configuration.md`).
- The daemon runs the `jj` from the system and user profiles on its `PATH`.
- Runs as `slop-cannon`, so agents use that user's logins and settings, with `~/.paseo` as
`PASEO_HOME`.
- The daemon password comes from the age secret `slop-cannon/paseo.env`. To read it for a new
client, follow [Pair a Paseo client](#pair-a-paseo-client).
- The service is not restarted on deploy, so running agents aren't interrupted. Restart it by hand
(`doas systemctl restart paseo`) to pick up a new config; stopping it stops its agents.
- Startup takes about a minute and a half while bundled plugins load; the daemon answers 503 until
it is ready.
### Settings
`services.paseo.settings` is rewritten into `~/.paseo/config.json` on every start, so changes made
from the app don't survive a restart. It:
- disables the tools Paseo injects into agents (`daemon.mcp.injectIntoAgents = false`), which would
let an agent change its own mode, answer its own permission prompts or open terminals;
- requires relay replay protection;
- turns off dictation and voice, which would otherwise download a large local speech model;
- hides providers other than Claude and Codex;
- adds "Claude, bypass permissions" and "Codex, full access" agent profiles. Each provider's
default mode is hardcoded upstream (Claude `auto`, Codex `auto-review`), and profiles are the
only way to preset one, so pick a profile when starting an agent for the permissive mode.
### Connectivity
- The daemon listens on `127.0.0.1:6767` only. The phone app and the browser reach it through our
relay on [`middleman`](../colony/shill/containers/middleman.md#paseo-relay)
(`paseo-relay.nul.ie`).
- Traffic through the relay is end-to-end encrypted between the app and the daemon; the relay sees
only addresses, timing and sizes. The pairing QR code or link is the trust anchor; treat it like a
password. Switching relays means re-pairing.
- Push notifications go from the daemon to Expo's push service (`exp.host`), one outbound request
per notification carrying its text.
- `middleman` serves the static web app on `slop.nul.ie`. The daemon's own web UI stays off.
### State
The agent home is backed by `/persist/home/slop-cannon`. It holds the provider logins and
sessions, repos, and `~/.paseo`, which contains the daemon keypair, agent records, projects,
workspaces and Paseo-managed Git worktrees. Paired clients trust that daemon keypair. Claude
sessions live under `~/.claude/projects/` and Codex sessions under `~/.codex/sessions/`.
## Repos, worktrees and jj
Repos live under `~/src` as colocated jj clones (see `slop-clone` below). The fork drives them
through `jj`:
- A `local` workspace runs the agent in the checkout itself. Archiving it removes only Paseo's
record; the folder is kept.
- A new jj workspace is a colocated `jj workspace` under `~/.paseo/worktrees` with its own
working-copy change. Use it for parallel or unattended agents. Archiving saves the change for
restore before removing the directory.
- A workspace goes stale when another one rewrites its `@`, typically a `jj git fetch` after its
pull request is merged. Paseo then offers **Update stale workspace** (`jj workspace
update-stale`), which keeps edits jj hadn't recorded in a separate change. Run it once the
workspace's agent is idle, since it changes the files under it.
- Don't run `jj` in a folder while an agent is mid-turn there: jj snapshots its partial edits.
## Terminal access
- The `paseo` CLI talks to the running daemon: `paseo ls`, `paseo logs -f <id>`, `paseo send <id>
"…"`, `paseo permit ls|allow|deny`. It is command-line only, not a chat interface.
- A session can be taken over in the provider's own TUI by its ID: `claude --resume <session>` in
the agent's folder, or `codex resume <session>`. `paseo import` goes the other way. This is a
hand-off, not a shared view: stop the agent in Paseo first and don't type in both.
## Agent permissions
Paseo has the full rights of `slop-cannon`, and `slop-cannon` has root: anyone with the daemon
password or a pairing controls the VM.
- Claude Code and Codex come from the shared `my.agents` home-manager module.
- Claude's user settings deny raw `deploy` and `ssh-machine`, and allow `slop`, since the broker
asks a human where its policy says so. The checkout's `.keys/` only has the committed public
keys, so reading it isn't denied. Claude's managed settings
(`/etc/claude-code/managed-settings.json`) repeat the `deny` rules. All of these match command
text and live inside the guest, so they steer agents towards `slop` rather than enforce
anything.
- Agents are permissive by default, since the VM is the boundary and
[`slop-broker`](../../slop-broker.md) gates everything that needs credentials: Claude starts in
`bypassPermissions` (the `deny` rules still apply), and Codex runs without approvals or its
sandbox (`approval_policy = "never"`, `sandbox_mode = "danger-full-access"`). Agents started
through Paseo use its defaults unless started with one of the profiles above.
- Codex stores its credentials in a file.
### Privileged operations
Agents ask [`slop-broker`](../../slop-broker.md) on `palace` for anything needing credentials, with
the `slop` command (`my.agents.slop.enable`). It connects over vsock (CID 3; see
[`palace`](palace.md#slop-broker)). The agent guide, `slop guide`, is installed as a Claude rule
(`~/.claude/rules/slop.md`) and as Codex's `AGENTS.md`.
The `my.agents.rules.slop-approvals` rule adds the local guidance on waiting for approval
and pausing after expiry to both providers' user-level instructions, including in Paseo sessions.
## SSH and first login
`ssh slop-cannon` (agent user) and `ssh slop-cannon-dev` (`dev`) are the shared aliases, both with
`ForwardAgent=no`. Never forward your SSH agent into the box: agents could use it while you're
logged in. For recovery, use the [VM serial console](../../deployment.md#vm-consoles) for
`slop-cannon` on `palace`.
To set up provider logins and repos on a fresh agent home, connect with `ssh slop-cannon`:
1. `claude auth login` (a full login; `setup-token` tokens are not enough for every feature).
2. `codex login --device-auth`.
3. [Pair a Paseo client](#pair-a-paseo-client).
4. `slop-clone <owner>/<repo>` for each repo. It clones a colocated jj repo over HTTPS into
`~/src/<repo>` and registers it with Paseo as a local workspace.
## Gitea
Agents reach Gitea as a bot user, with its access token (age secret `slop-cannon/gitea-token`,
scopes `write:repository` and `write:issue`).
- **Git** uses HTTPS: a credential helper for `git.nul.ie` sends the token. Commits are still
authored as Dev through the shared Git config; the pushes are the bot's.
- **`tea`**, Gitea's CLI, is wrapped to log in with the same token, so agents can open and update
pull requests.
- **Pull requests:** a rule for every agent (`my.agents.rules.gitea`: a Claude rule, and part of
Codex's `AGENTS.md`) makes a pull request from a branch of its own the default way to finish a
piece of work, and says how with jj and `tea`. A repository's own `AGENTS.md` can allow more,
such as pushing to its main branch.
- **Issues:** the same rule keeps agents' running notes, plans and handoffs in Gitea issues on
the repository they're about, rather than in files on branches that go stale. Durable facts
still go in the repository's docs, and the issue is closed.
- **Access per repo:** where agents should only propose changes (`dev/nixfiles`, `slop-broker`),
protect the main branch so only Dev pushes and merges. Elsewhere the bot's Write access is
enough to push directly.
- **Access:** the bot is a collaborator with Write on each repo agents may use. `master` on
`dev/nixfiles` only takes pushes and merges from Dev (see
[`slop-broker`](../../slop-broker.md#master-is-protected)).
- **Replacing the token:** make a new one for the bot and put it in the secret with
`ragenix -e secrets/slop-cannon/gitea-token.age`, then deploy `slop-cannon`.
## Pair a Paseo client
1. On the VM, run `slop-pair` as `slop-cannon`. It prints the QR code, pairing link and
`PASEO_PASSWORD`. Keep its output private.
2. If you only need the QR code and link, run `paseo daemon pair` as `slop-cannon`. To look up the
password separately, run `doas cat /run/secrets/slop-cannon/paseo.env` on the VM. You can also
decrypt it from a repo checkout with access to the dev age key:
```sh
rage --decrypt -i .keys/dev.key secrets/slop-cannon/paseo.env.age
```
3. On a phone, scan the QR code from the Paseo app. In a browser, open `https://slop.nul.ie` and
use the app's paste-pairing-link option. Enter the value after `PASEO_PASSWORD=` when prompted
and open the paired host. If the browser shows “Password required” after opening the link in
the address bar, remove that host entry and pair again using the paste dialog.
## Notable config files
- [`nixos/boxes/home/palace/vms/slop-cannon.nix`](../../../nixos/boxes/home/palace/vms/slop-cannon.nix) —
the box: users, Paseo, Claude settings, `slop-clone`, `slop-pair`, disk layout, network.
- [`nixos/boxes/home/palace/slop-broker.nix`](../../../nixos/boxes/home/palace/slop-broker.nix) —
the broker's policy for this box and the VM's vsock device.
- [`nixos/boxes/home/palace/vms/default.nix`](../../../nixos/boxes/home/palace/vms/default.nix) —
the VM on `palace` and `slop-cannon-disk.service`.
- [`nixos/boxes/home/palace/default.nix`](../../../nixos/boxes/home/palace/default.nix) — VF 5, the
NVMe host ID and the LVM filter.
- [`home-manager/modules/agents/default.nix`](../../../home-manager/modules/agents/default.nix) —
shared Claude Code and Codex configuration, including the `slop` client and guide.
+20 -19
View File
@@ -16,7 +16,7 @@ redundant router pair with [`river`](river.md) and is dual-homed to both switche
| CPU | Intel Celeron N5105 (4 cores / 4 threads) |
| Memory | 16 GiB |
| Storage | 512 GB Samsung SSD 970 PRO NVMe containing `/boot`, `/nix` and `/persist`; integrated 128 GB eMMC is present but is not used by the declared filesystems |
| Network | Three Intel `igc` interfaces and a dual-port Mellanox `mlx4_en` adapter; `wan`, `lan-jim` and `lan-dave` use three of these ports |
| Network | Three Intel I225-V 2.5G interfaces (`igc`) and a dual-port Mellanox ConnectX-3 10G SFP+ adapter (`mlx4_en`); `wan`, `lan-jim` and `lan-dave` use three of these ports |
The platform configuration enables `kvm-intel`, `intel_iommu=on` and Intel microcode updates.
@@ -39,8 +39,9 @@ lease this section assumes — see [wwan.md](wwan.md).
### Link and addressing
`wan` is a renamed igc NIC (`00:f0:cb:ee:ca:dd`) towards the cable modem. The modem segment is
switch VLAN 130; `jim` handles the tag, so the box interface is untagged. See
`wan` is a renamed igc NIC (`00:f0:cb:ee:ca:dd`) on a physically separate connection to `jim`'s
`stream-wan` port. The Virgin Media modem connects to `shytzel`, which trunks
VLAN 130 to `jim`; `stream-wan` delivers it untagged to the box. See
[switches.md](switches.md) for the fabric side.
`DHCP=ipv4` pulls the public lease. `dhcpV4Config.UseDNS=false` points resolution at the local
@@ -67,23 +68,23 @@ uses the DOCSIS overhead preset.
### Per-box `routing-common` options
The modem's management subnet shares the `wan` interface, which `routing-common` itself knows
nothing about — it declares two per-box options
([`routing-common/default.nix`](../../../nixos/boxes/home/routing-common/default.nix)) that this
box sets:
- `my.homeRouter.dns.wanSkipBroadcasts` — skip the modem subnet's broadcast address when
auto-selecting the router's own `wan` A record for the zone's LUA record.
- `my.homeRouter.firewall.untrustedRejectV4` — reject untrusted clients from
reaching the modem subnet (needed only because it shares `wan`; WAN egress is otherwise
accepted).
nothing about. This box sets `my.homeRouter.dns.wanSkipBroadcasts`
([`routing-common/default.nix`](../../../nixos/boxes/home/routing-common/default.nix)) to skip the
modem subnet's broadcast address when auto-selecting the router's own `wan` A record for the zone's
LUA record. `untrusted` clients can't reach the modem subnet: it's private, so the
[`untrusted` filter](../../networking.md#untrusted-clients) rejects it.
## Switching (RSTP)
`stream` is dual-homed to both switches: `lan-jim` (igc) and `lan-dave` (mlx4_en), both MTU 9000,
are enslaved to the `lan` bridge with `STP=true`. The explicit bridge-port costs prefer
`lan-dave` at 10 over `lan-jim` at 100. [`routing-common/mstpd.nix`](../../../nixos/boxes/home/routing-common/mstpd.nix)
runs a patched `mstpd` and forces RSTP on `lan` once it is configured, so exactly one uplink carries
traffic at a time. (The remaining NICs are renamed `et2`/`et5` and left unconfigured.)
`stream` is dual-homed to both switches: `lan-dave` (mlx4_en) and `lan-jim` (igc), both MTU 9000,
are ports of the shared `lan` bridge. `routing-common` owns the bridge, its STP setting and the
explicit `dave`/`jim` costs of 10/100. [`routing-common/mstpd.nix`](../../../nixos/boxes/home/routing-common/mstpd.nix)
runs a patched `mstpd` and forces RSTP once `lan` is configured, so exactly one uplink carries
traffic at a time and `dave` is preferred. (The remaining NICs are renamed `et2`/`et5` and left
unconfigured.)
The separate `wan` connection to `jim` is not a bridge port. Retaining it provides an isolated
untagged DHCP handoff for Virgin Media and a simple path for a future replacement direct-IP WAN.
## Deployment
@@ -96,8 +97,8 @@ traffic at a time. (The remaining NICs are renamed `et2`/`et5` and left unconfig
## Notable config files
- [`nixos/boxes/home/stream.nix`](../../../nixos/boxes/home/stream.nix) — box config: DHCP WAN,
modem management, CAKE, `wan-online.target` gate, STP bridge.
modem management, CAKE, `wan-online.target` gate and hardware link matching.
- [`nixos/boxes/home/routing-common/default.nix`](../../../nixos/boxes/home/routing-common/default.nix) —
shared router definition (index 1).
shared router definition, including the `lan` bridge and port preferences (index 1).
- [`nixos/boxes/home/routing-common/mstpd.nix`](../../../nixos/boxes/home/routing-common/mstpd.nix) —
RSTP on the `lan` bridge.
+184 -73
View File
@@ -1,85 +1,130 @@
# Home switches
Reference for the two MikroTik switches on the home network — **jim** and **dave** — plus the
Ubiquiti switch **brian**, and how the home boxes and the Digiweb WAN hang off them. These switches
are **not** managed by this flake; they are configured by hand (RouterOS on jim/dave, UniFi on
brian). It covers the physical topology, the VLAN map, and how the Digiweb WAN reaches river.
Reference for the home switches: MikroTik boxes `jim` and `dave`, Ubiquiti switch `brian`, and
Zyxel L2 switch `shytzel`. These switches are **not** managed by this flake; they are configured by
hand. This page covers the physical topology, VLAN map, and WAN paths.
In short: the Digiweb ISP VLAN (10) is trunked straight through to river (which runs PPPoE on it),
and the ONT's untagged management is PVID'd onto VLAN 140 at brian, its edge switch. VLAN 10 is
In short: the Digiweb ISP VLAN (10) is trunked straight through to `river` (which runs PPPoE on it),
and the ONT's untagged management is PVID'd onto VLAN 140 at `brian`, its edge switch. VLAN 10 is
carried untranslated because a single ONT makes it unique on the fabric — see
[the WAN path](#the-digiweb-wan-path-trunked-vlan-10--pvid-140) and
[why not translation](#why-not-translation-for-one-ont). The router side lives in
[river.md](river.md); the logical network map in [networking.md](../../networking.md). The Wi-Fi
APs that hang off these switches are in [aps.md](aps.md).
APs that hang off these switches are in [aps.md](aps.md). A fourth switch, **fergal**, hangs off jim
but belongs to the colony site — see [fergal](#fergal-portculliss-switch).
## The switches
| | jim | dave | brian |
|---|---|---|---|
| Identity | `jim-sw` | `dave-sw` | (UniFi) |
| Model | CRS326-24G-2S+ | CRS504-4XQ | Ubiquiti Switch Pro XG 8 PoE |
| Switch chip | Marvell 98DX3236 | Marvell 98DX4310 (+ Atheros 8227 for the 1G mgmt port) | — |
| OS | RouterOS | RouterOS | UniFi |
| Ports | 24×1G + 2×SFP+ | 4×QSFP28 (100G, breakout-capable) + 1G mgmt | 8×10GBASE-T PoE + 2×10G SFP+ |
| Bridge | `main`, `vlan-filtering=yes` | `main`, `vlan-filtering=yes` | UniFi VLAN profiles |
| | `jim` | `dave` | `brian` | `shytzel` |
|---|---|---|---|---|
| Identity | `jim-sw` | `dave-sw` | UniFi | `shytzel` |
| Model | CRS326-24G-2S+ | CRS504-4XQ | Ubiquiti Switch Pro XG 8 PoE | Zyxel GS1920 |
| Switch chip | Marvell 98DX3236 | Marvell 98DX4310 (+ Atheros 8227 for the 100M management port) | — | — |
| OS | RouterOS 7.25.1 | RouterOS 7.25.1 | UniFi | Zyxel firmware |
| RouterBOOT | 7.25.1 | 7.25.1 | — | — |
| Ports | 24×1G + 2×SFP+ | 4×QSFP28 + 100M management | 8×10GBASE-T PoE + 2×10G SFP+ | Not recorded |
| VLAN configuration | `main`, `vlan-filtering=yes` | `main`, `vlan-filtering=yes` | UniFi VLAN profiles | 802.1Q L2; management only on `core` |
jim and dave run a single hardware-offloaded bridge (`main`) with VLAN filtering. Access to the
MikroTiks is SSH as `admin` / `admin` by short hostname (see [Accessing the switches](#accessing-the-switches)).
Only jim and dave can do hardware VLAN translation (`/interface ethernet switch rule` on the Marvell
chips); brian cannot rewrite tags, only trunk/PVID them.
`jim` and `dave` run a single hardware-offloaded bridge (`main`) with VLAN filtering. Access to the
MikroTiks is SSH as `admin` / `admin` by short hostname (see
[Accessing the switches](#accessing-the-switches)). Only `jim` and `dave` can do hardware VLAN
translation (`/interface ethernet switch rule` on the Marvell chips); `brian` and `shytzel` provide
ordinary L2 VLAN switching.
## Physical topology
The two WAN sources enter at the top: the Virgin Media modem lands on **jim** (VLAN 130), and the
Digiweb **ONT** lands on **brian**. Both `jim` and `brian` are edge switches that uplink down into
the **dave** core; the home boxes hang off dave's 100G ports, with backup links up to jim. jim's
`wan-pon-in` (`sfp-sfpplus2`) is a spare SFP+ port, unused today.
The Virgin Media modem lands on `shytzel`, which trunks VLAN 130 to `jim`; the Digiweb ONT lands on
`brian`. `brian` has its primary LAG to the `dave` core and an RSTP-protected secondary connection
to `jim`; `jim` and `dave` are also joined directly. The home boxes hang off `dave`'s high-speed
ports, with backup links to `jim`. `jim`'s second SFP+ port (`sfp-spare`, `sfp-sfpplus2`) feeds
[fergal](#fergal-portculliss-switch), which [`portcullis`](../colony/portcullis.md) hangs off while
it is staged at home.
```
Virgin Media cable modem Digiweb ONT
stream WAN, VLAN 130 river WAN, management + VLAN 10
| |
jim brian
| 10G trunk 802.3ad LAG |
+--------------------+ +---------------+
| |
+---+----------+---+
| dave |
+--------+---------+
|
+---------------------+---------------------+
| | |
palace (100G) castle (100G) stream
river VM NVMe-oF root second router
[![Home switch fabric and router connections](diagrams/home-fabric.svg)](diagrams/home-fabric.svg)
The [Mermaid source](diagrams/home-fabric.mmd) defines the logical topology; the rendered SVG
also works in Markdown viewers without Mermaid support.
Solid and dotted lines distinguish normal carrying paths from backup attachments; RSTP selects
ports for the whole fabric. The separate WAN connection to `stream` is outside its LAN bridge.
The 10G trunk from `jim` to [fergal](#fergal-portculliss-switch) serves the staged colony boxes.
### Front-panel port maps
In the rack, viewed from the front, the order is **`brian`, `jim`, `dave`**, with `palace` several
units below. `stream` sits to the left of `brian`; it is drawn above it to make the connections
easier to follow. The map follows each model's physical socket order: `brian` has a single RJ45 row,
`jim` has three banks with even ports above odd ports, and `dave` has four QSFP28 cages. Chassis
widths, spacing and the gap above `palace` are schematic; exact rack-unit positions are not known.
`palace`'s NICs are rear connections, shown only as endpoints rather than an invented front layout.
[![Front-panel socket map in rack order, with matching cable-end tags](diagrams/switch-panels.svg)](diagrams/switch-panels.svg)
Drawn lines and matching letter badges identify the two ends of a cable. Cable routes are
schematic, not a record of how the cables are dressed in the rack. NIC labels give socket
capacity; `stream`'s 2.5G copper ports connect to `jim` at 1G. Q3.1–Q3.4 are breakout lanes within
**one physical cage** on `dave`, not four separate front-panel sockets. Its management RJ45
is separate from the console above it; `jim`'s console is also separate from Ethernet port 1.
<!-- switch-cables -->
| Cable | Endpoint | Endpoint | Connection |
|---|---|---|---|
| **A** | `brian` `9` | `dave` `Q3.2` | 10G; first LAG member |
| **B** | `brian` `10` | `dave` `Q3.4` | 10G; second LAG member |
| **C** | `brian` `5` | `jim` `7` | 1G; redundant fabric trunk |
| **D** | `jim` `S1` | `dave` `Q3.1` | 10G; direct fabric trunk |
| **E** | `jim` `24` | `dave` `MGMT` | 100M; dave management |
| **F** | `jim` `5` | `palace` `host-jim` | 1G; host core / netboot |
| **G** | `jim` `22` | `palace` `river-jim-phy` | 1G; river backup trunk |
| **H** | `dave` `Q1` | `palace` `uplink-dave` | 100G; host PF and guest VFs |
| **I** | `stream` `ETH0` | `jim` `21` | 1G WAN; 2.5G socket on stream |
| **J** | `stream` `ETH1` | `jim` `6` | 1G backup LAN; 2.5G socket on stream |
| **K** | `stream` `SFP+ R` | `dave` `Q3.3` | 10G preferred LAN |
<!-- /switch-cables -->
Port labels describe configured use, not current link state. `jim` ports 1–4 are configured
members of `shytzel-downlink`; only port 1 had an active link at inspection. `brian` port 3 is
reserved for testing `portcullis`, and port 4 serves its second JetKVM.
The panel layouts reference the manufacturers' [Pro XG 8 PoE guide](https://dl.ui.com/qig/usw-pro-xg-8-poe/),
[CRS326-24G-2S+RM panel](https://mikrotik.com/product/CRS326-24G-2SplusRM),
[CRS504-4XQ-IN panel](https://mikrotik.com/product/crs504_4xq_in), and
[R86S panel photograph](https://www.gowinfanless.com/news/blogs/the-r86s-revolution-low-power-2-5gbe-and-10gbe-networking).
`stream`'s connected SFP+ socket is the right-hand one, confirmed physically; the left is unused.
Its copper socket mapping is inferred from PCI order and sequential permanent MACs. The SFP+
sockets are labelled left/right in the drawing because both carry the same printed label.
Port use comes from RouterOS interface/bonding configuration, LLDP, the UniFi controller and
physical connection confirmation.
The editable inventory is [switch-ports.json](diagrams/switch-ports.json); run
`python3 docs/sites/home/diagrams/render-switch-panels.py` to regenerate the SVG and cable table.
Backup links to jim (normally idle):
* palace: 1G
* stream: 1G; STP selects the active link
* castle: 2.5G, normally down; no live failover
```
Notes:
- **river** runs as a VM on the **palace** host; its uplink is dave's 100G `palace` port. jim also
has 1G `palace`/`stream` ports, but those are secondary links and do **not** carry the WAN.
- **river** uses `palace`'s 100G connection to `dave` and the dedicated 1G `river-jim-phy`
connection to `jim`. The separate `host-jim` connection serves host management and VM netboot.
See [palace's networking](palace.md#networking) for the handoffs and
[failover validation](router-failover.md) for tested failure scenarios.
- `jim`'s `palace-kvm` port is a JetKVM connection, not either of `palace`'s network attachments.
- **stream** (the second router box) is dual-homed to both jim and dave (STP picks the active path).
- The `brian`–`jim` secondary connection provides the redundant Digiweb path. VLANs 10 and 140 are
tagged on `brian-downlink` and `river`, keeping the ONT reachable without `dave`.
### Castle storage dependency
### `castle` storage dependency
`castle` is dual-homed without STP: its primary link is dave's 100G `castle` port (`et100g`), while
the 2.5G link to jim (`et2.5g`) is normally down and provides no live failover. Its root disk is
NVMe-oF over `et100g` and dave, so interrupting either freezes `castle` mid-I/O. Do dave maintenance
from a box that does not depend on it, or power `castle` off cleanly first.
the backup NIC (`et2.5g`) connects at 1G to jim and is normally down, providing no live failover.
Its root disk is NVMe-oF over `et100g` and dave, so interrupting either freezes `castle` mid-I/O.
Do dave maintenance from a box that does not depend on it, or power `castle` off cleanly first.
## VLANs
| VLAN | Name | Purpose |
|---|---|---|
| — (native) | core | Switch management, `192.168.64.0/24` (jim `.10`, dave `.11`, brian `.13`) |
| — (native) | core | Switch management, `192.168.64.0/24` (`jim` `.10`, `dave` `.11`, `shytzel` `.12`, `brian` `.13`) |
| 100 | hi | High-performance / jumbo network (MTU 9000) |
| 110 | lo | Standard LAN |
| 120 | untrusted | Guest / untrusted network |
| 130 | wan | **stream's WAN** — Virgin Media cable modem (untagged on jim's `wan1`/`wan2`/`wan-in`) |
| 130 | wan | `stream`'s WAN — tagged from `shytzel`, untagged on `jim`'s `stream-wan` |
| 140 | wan-pon-ont | ONT management, `192.168.100.0/24` (PVID'd at the ONT edge) |
| 10 | pon-isp | Digiweb ISP transport — **trunked straight through** to river, PPPoE runs on it |
| 141 | wan-pon-isp | **Reserved** — the translated ISP VLAN for the future multi-ONT design |
@@ -105,11 +150,12 @@ we just carry it end to end and let river run PPPoE directly on it:
reach the ONT web UI at `192.168.100.1`. Doing the PVID at the ONT-facing edge keeps it clean —
the untagged frames never share a domain with anything else.
2. **VLAN 10 (ISP) trunked straight through, untranslated.** brian → dave → palace carry tagged
VLAN 10 by ordinary bridge-VLAN membership. No `/interface ethernet switch rule`, no pinning, no
asymmetric-learning issues — it's just a normal tagged VLAN. river attaches PPPoE to VLAN 10
directly (`wan-pon-isp` netdev = VLAN `pon-isp` = 10; baby-jumbo MTU 1508 so PPP nets a clean
1500).
2. **VLAN 10 (ISP) trunked straight through, untranslated.** The primary path is
brian → dave → palace; the RSTP-protected secondary path reaches jim before returning to the
router attachment. Both carry tagged VLAN 10 by ordinary bridge-VLAN membership. No
`/interface ethernet switch rule`, no pinning, no asymmetric-learning issues — it's just a
normal tagged VLAN. river attaches PPPoE to VLAN 10 directly (`wan-pon-isp` netdev = VLAN
`pon-isp` = 10; baby-jumbo MTU 1508 so PPP nets a clean 1500).
Net result: **river runs PPPoE single-tagged on VLAN 10 and holds a VLAN 140 address to reach the
ONT.** See [`nixos/boxes/home/palace/vms/river.nix`](../../../nixos/boxes/home/palace/vms/river.nix)
@@ -137,17 +183,45 @@ How each switch is set up for the Digiweb WAN path. **Confirm any change on the
- The ONT port has **native/untagged network = VLAN 140** (PVID) and is a **tagged member of VLAN 10**,
so the ONT's untagged management lands on 140 and its tagged ISP frames pass through.
- The `brian-downlink` LAG up to dave trunks **tagged 140 + tagged 10** (alongside the LAN VLANs).
- Its secondary connection to jim carries the same relevant VLANs and participates in RSTP, so it
normally remains blocked while the primary path is healthy.
**dave (RouterOS)** — trunks both WAN-pon VLANs to `brian-downlink` and `palace`. The ISP VLAN 10 row:
```
/interface bridge vlan add bridge=main vlan-ids=10 tagged=brian-downlink,palace
/interface bridge vlan add bridge=main vlan-ids=10 tagged=brian-downlink,palace,jim-downlink
```
VLAN 140 also spans `brian-downlink,palace` (it carries a few other members too). No switch rules —
this is plain tagged bridging.
VLAN 140 also spans `brian-downlink,palace,jim-downlink` (it carries a few other members too).
The direct connection to `jim` must carry both VLANs: if only `palace`'s `dave` connection fails,
the surviving RSTP path from `river` through `jim` can still traverse `dave` to reach `brian`.
These are ordinary tagged VLANs with no switch rules.
**jim (RouterOS)** — carries **none** of the Digiweb WAN path: no translation rules, and no VLAN
10/140/141 rows. `wan-pon-in` (`sfp-sfpplus2`) sits at `pvid=1` as a spare port. jim only handles
stream's VLAN-130 WAN and the LAN VLANs.
**jim (RouterOS)** — the physical `brian-downlink` is the RSTP-protected secondary connection from
`brian`. VLANs 10 and 140 have `brian-downlink`, `river` and `dave-uplink` as tagged members; no
translation rules are involved. RSTP selects one tree for the bridge, so VLAN membership must
include the surviving paths through `dave` as well as the direct backup connection to `brian`.
The `river` port is native `core` with VLANs 10, 100, 110, 120 and 140 tagged. It
faces `palace`'s `river-jim-phy`; `palace-kvm` is the separate JetKVM connection and must remain
unchanged. See [failover validation](router-failover.md) for attachment and switch-outage checks.
Other connections on `jim`:
| Interface | Connection |
|---|---|
| `ether9` | Disconnected, unbridged spare |
| `stream-wan` | Dedicated untagged VLAN 130 handoff to `stream` `wan` |
| `river` | `river-jim-phy`, redundant native-core trunk |
The modem connects to `shytzel`. `stream` has two distinct connections to `jim`: `stream-wan`
for its isolated WAN handoff and `stream` for the `lan-jim` RSTP trunk. VLAN 130 has
`shytzel-downlink` tagged and only `stream-wan` untagged.
`sfp-spare` (`sfp-sfpplus2`) stays at `pvid=1`—the switch feeding `portcullis` is reached over
VLAN 1 untagged—and is a tagged member of `hi` (100) and `lo` (110):
```
/interface bridge vlan set [find bridge=main vlan-ids=100] tagged=...,sfp-spare
/interface bridge vlan set [find bridge=main vlan-ids=110] tagged=...,sfp-spare
```
## Switches must not route
@@ -156,8 +230,7 @@ management addresses and static default routes exist only so the boxes themselve
reach out; they must **never** forward traffic or advertise themselves as routers. RouterOS defaults
work against this: `ip-forward` and IPv6 `forward` ship **on**, and with IPv6 forwarding on RouterOS
also emits Router Advertisements (`ra-lifetime=30m`) on every L3 interface — so a switch silently
becomes a competing IPv6 default router. This surfaced after the 7.18 → 7.23 upgrade, when clients
picked up dave/jim as default routers alongside river.
becomes a competing IPv6 default router.
The required config on each RouterOS box:
```
@@ -174,7 +247,7 @@ The required config on each RouterOS box:
actively clears the rogue default from clients (they otherwise cache it for up to ~30 min).
**After any RouterOS upgrade, re-check `/ip settings` and `/ipv6 settings`** — an upgrade can reset
these to the forwarding-on defaults. brian (UniFi) is not a RouterOS box and was not affected.
these to the forwarding-on defaults. `brian` uses UniFi and does not have these RouterOS settings.
## Future: multiple ONTs (per-port VLAN translation)
@@ -200,13 +273,49 @@ Each ONT port must also be a tagged member of bridge VLAN 10 for correct egress
piece that otherwise shows up as pppd "Timeout waiting for PADO"). The pins bypass the FDB, so the
two ISP sessions never mix.
**Why a new switch:** jim (the only box with spare SFP+ *and* the translation feature) has just
**one** free SFP+ port, so it can't host two ONTs. The plan is a dedicated
**Why a new switch:** jim (the only box with spare SFP+ *and* the translation feature) had just
**one** free SFP+ port — now taken by fergal — so it can't host two ONTs. The plan is a dedicated
**CRS305-1G-4S+** (4×SFP+, same Marvell rule support) to land multiple ONTs and do the per-port
translation there, feeding distinct fabric VLANs up to dave.
## fergal (portcullis's switch)
**fergal** is an 8-port SFP+ switch running OpenWrt, hanging off jim's `sfp-spare` port. It belongs
to [`portcullis`](../colony/portcullis.md) rather than to the home fabric — it is here only while
that box is staged at home, and goes to Nikhef with it. Nothing in the home fabric depends on it.
What it borrows from home is VLAN 1 untagged on the jim uplink (fergal's own management sits on it,
at `192.168.64.30` on core) plus tagged `hi` (100) and `lo` (110), so `portcullis` can reach those
over 10G. The switch itself — VLAN layout, flash layout, firmware and flashing notes — is
documented in [sites/colony/fergal.md](../colony/fergal.md).
## Accessing the switches
### Upgrades
Save a text export and an encrypted binary backup, and download both before rebooting. Local
upgrade backups are kept outside Git under `.cache/mikrotik/<date>/`; the backup password is
stored alongside them with restricted permissions. Binary backups are intended for restoration
on the same box and RouterOS version.
Upgrade one switch at a time. Upgrade `dave` while `jim` carries the backup path, verify its
return, then upgrade `jim`. Check RouterOS packages first, then upgrade RouterBOOT and reboot
again if its running version differs. After each upgrade, verify bridge VLAN membership, RSTP
roles, hardware offload and the [forwarding/RA settings](#switches-must-not-route).
During failover, use bounded SSH calls and an explicit IPv4 management address where useful.
RouterOS parses newlines in SSH command strings separately: send a multi-statement block as one
line with semicolons so local variables and braces retain their scope.
Whole-switch outage behavior is covered by the
[validated scenarios](router-failover.md#validated-scenarios).
RouterOS uses Ed25519 host keys by default. Upgrading an older installation can change the
host-key type from RSA; verify the box's identity independently before updating the client's
`known_hosts` entry.
### SSH
The switches resolve by **short hostname** on the home network — the home routers serve their
records in the home zone
([`nixos/boxes/home/routing-common/dns.nix`](../../../nixos/boxes/home/routing-common/dns.nix):
@@ -223,13 +332,15 @@ sshpass -p admin ssh -o IdentityAgent=none -o PubkeyAuthentication=no \
-o UserKnownHostsFile=/tmp/sw_known_hosts admin@jim
```
**Always confirm config changes on the switch** (print the affected menu, apply, re-verify). brian
is UniFi — configured through its controller, not RouterOS CLI.
**Always confirm config changes on the switch** (print the affected menu, apply, re-verify).
`brian` is configured through its UniFi controller. `shytzel` is an L2 managed switch whose
management interface is reachable only through `core`.
## Management IPs
| | core (`192.168.64.0/24`) | hi (`192.168.68.0/22`) | lo (`192.168.72.0/21`) |
|---|---|---|---|
| jim | `.10` (on `main`) | `.10` | `.10` |
| dave | `.11` (on `management`, the 1G Atheros port) | `.11` | `.11` |
| brian | `.13` (core) | — | — |
| `jim` | `.10` (on `main`) | `.10` | `.10` |
| `dave` | `.11` (on `management`, the 1G Atheros port) | `.11` | `.11` |
| `brian` | `.13` (`core`) | — | — |
| `shytzel` | `.12` | — | — |
+130
View File
@@ -0,0 +1,130 @@
# slop-broker
[`slop-broker`](https://git.nul.ie/dev/slop-broker) carries out privileged operations (SSH
commands, deploys, builds and age secrets, and later DNS and previews) for the coding agents on
[`slop-cannon`](sites/home/slop-cannon.md) and other boxes, under a policy and usually after Dev
approves each one. Agents use the `slop` CLI.
The broker, its NixOS and home-manager modules, its design and the agents' guide live in its own
repository, which this flake takes as the `slop-broker` input. This page covers how these boxes use
it; for how it works, read the repository's
[design](https://git.nul.ie/dev/slop-broker/src/branch/main/docs/design.md).
## Boxes
| Box | Role |
|---|---|
| [`palace`](sites/home/palace.md) | Runs the broker, its builder and the approvals web app's listener; holds the deploy key |
| [`slop-cannon`](sites/home/slop-cannon.md) | The agents' VM; reaches the broker over vsock |
| [`castle`](sites/home/castle.md) | Agents there are a requester over SSH; Dev also approves from it over SSH |
| [`object`](sites/colony/shill/containers/object.md) | The binary cache that `slop build` pushes to |
| [`middleman`](sites/colony/shill/containers/middleman.md) | Publishes the approvals web app at `approve.slop.nul.ie`, Pocket ID at `id.nul.ie` and Paseo's web app at `slop.nul.ie` |
`palace`'s configuration is [`palace/slop-broker.nix`](../nixos/boxes/home/palace/slop-broker.nix):
the requesters, the `agent` policy they share, the secrets, and the web app settings. Its SSH
targets are the deploy-rs nodes on `master`, which the builder reads there, so a new box is a
target once it's merged.
### Updating the broker
- **Deploying `palace` doesn't restart the broker** (`restartIfChanged = false`), so it can see a
deploy of its own box through. Afterwards, restart it for a new version or configuration to take
effect: `doas systemctl --no-block restart slop-broker` on `palace`. A restart drops pending
requests and leases.
- **Deploy every requester with it** when `slop`'s protocol version changes, or their requests fail
with a protocol version error: `slop-cannon`, and `castle` over SSH.
## In this flake
- **Input:** `slop-broker` in [`flake.nix`](../flake.nix) selects a release tag. To upgrade,
change the tag and run `nix flake update slop-broker`.
- Its overlay provides `pkgs.slop-broker`.
- The common modules import `services.slop-broker`, `services.slop-broker-builder`,
`services.slop-broker-cache` and `programs.slop`.
- **Persistence:** [`tmproot.nix`](../nixos/modules/tmproot.nix) keeps `/var/lib/slop-broker` and
the builder's home when those services are enabled.
- **Firewall:** the web app's port is open only to `middleman`, in `palace`'s configuration.
- **Agents:** `my.agents.slop` (in the shared `agents` home-manager module) installs `slop` and adds
the guide (`share/slop-broker/slop-tools.md`) as a Claude rule (`~/.claude/rules/slop.md`) and
as Codex's `AGENTS.md`. `slop-cannon` enables it, allows `Bash(slop:*)` in Claude and keeps the
`deny` rules for raw `deploy` and `ssh-machine`.
- **`AGENTS.md`:** "Working from `slop-cannon`" points agents at `slop` instead of `deploy` and
`ssh-machine`. Extend it as operations land.
- **Devshell:** `slop` and `slop-approve`, built from the locked input. `slop` uses
`.keys/slop-request.key` over SSH when that file exists; an approver key never goes in `.keys/`,
because agents can read the checkout.
## Other requesters and approvers
`castle` uses [`programs.slop`](https://git.nul.ie/dev/slop-broker/src/branch/main/docs/design.md#other-requesters-and-approvers):
its agents are the requester `castle` (same policy as `slop-cannon`), and Dev's approver key is
`sshApprovers.castle`. Both log in to `palace` as `slop`.
## Binary cache
`slop build` pushes into Harmonia's store on `object` as `harmonia`, whose broker key is limited to
the store protocol and GC roots (`services.slop-broker-cache` in `object`'s configuration). CI
collects garbage in that store on every run, which the roots survive until they expire (see the
[design](https://git.nul.ie/dev/slop-broker/src/branch/main/docs/design.md#binary-cache)).
## Secrets
`slop secret` lets agents change age secrets without the dev key. The broker's own age identity
(`palace/slop-broker-age.key`, public key `.keys/slop-broker.pub`) is in `defaultKeys` in
[`secrets.nix`](../secrets.nix), so every secret is encrypted to it; adding it took one full rekey.
- The agent sends the `.age` file from its checkout, and the broker returns new ciphertext, which
the agent commits. Recipients come from the agent's `secrets.nix`.
- Before approval, the builder fetches `master`, looks the file's content up there and evaluates
`master`'s `secrets.nix`. The approval says which file the content really is and whether the
recipients match `master`'s rules for it (see the
[design](https://git.nul.ie/dev/slop-broker/src/branch/main/docs/design.md#secrets)).
- Approvals label recipients by name: `dev` and `slop-broker` through `secrets.names`
(`lib.my.c.ageKeyFiles`), and host keys through the system name `secrets.nix` writes after each
key as its comment.
### `master` is protected
Deploy approvals ("on the branch", the diff since `master`) and secret approvals both trust
`master`, so only Dev may push to it or merge into it: branch protection on `dev/nixfiles` in Gitea
refuses everyone else, including the bot user that agents on `slop-cannon` push as.
## Approval timeout
[`services.slop-broker.timeout` on `palace`](../nixos/boxes/home/palace/slop-broker.nix) gives
each approval step up to 45 minutes. For example, a deploy can wait for builder approval before
the build and for deploy approval afterward, with a separate window for each step.
`slop` prints the window when a request starts waiting (`approvers have 45m to answer`).
Keep `slop` running while the request is pending. Use a background session for commands that
may need approval. If the client disconnects, the broker cancels the pending request.
`slop requests` shows how much time each pending request has left.
## Approvals web app
`middleman` proxies `approve.slop.nul.ie` to port 8095 on `palace`. Approvers sign in through
Pocket ID at `id.nul.ie` (client `slop-approve`, restricted to the group `slop-approvers`; its
secret is `palace/slop-broker-oidc-secret`). Deploys to the routers (`river`, `stream` and
`estuary`) need a fresh passkey. See the
[design](https://git.nul.ie/dev/slop-broker/src/branch/main/docs/design.md#approvals-web-app).
## `slop.nul.ie`
`slop.nul.ie` replaces `paseo.nul.ie` for the Paseo web app on `middleman` (`paseoWebUi` in
`vhosts.nix`, `app.baseUrl` in `slop-cannon.nix`), and `*.slop.nul.ie` is reserved for previews.
The relay stays on `paseo-relay.nul.ie` for now, because existing pairings use that hostname.
Previews on `*.slop.nul.ie` will be same-site with every other `nul.ie` service, so a preview page
can set cookies on `.nul.ie` and browsers send `SameSite=Lax` cookies (including the SSO session)
with its requests to other `nul.ie` services. A separate domain would avoid this; `nul.ie` is kept
for simplicity.
## Rollout
Each step updates this page, the box pages and `AGENTS.md` as it lands.
1. **Done:** `slop.nul.ie`; the broker core, box queries, SSH transport, deploys and builds on
`palace`; `castle` over SSH; Pocket ID at `id.nul.ie`; the approvals web app; secrets.
2. **DNS**, with a Cloudflare token of the broker's own for the public zones.
3. **Previews** on `*.slop.nul.ie`, through `middleman`.
4. **TCP forwards and a cache for VM builds**, if needed.
Generated
+448 -228
View File
File diff suppressed because it is too large. Load diff
+51 -8
View File
@@ -1,16 +1,20 @@
{
description = "System configs";
# Offer our Harmonia cache when building the flake itself, so `nix develop` / `nix build` don't
# Offer our Harmonia and Numtide caches when building the flake, so `nix develop` / `nix build` don't
# rebuild from source. Nix reads `nixConfig` before the flake evaluates and rejects any computed
# value (imports/thunks), so these must stay literal — keep them in sync with `lib.my.c.nix.cache`.
# Consumers must trust these (accept-flake-config / a trusted user) for them to take effect.
nixConfig = {
extra-substituters = [
"https://nix-cache.nul.ie"
"https://cache.numtide.com"
"https://nix-community.cachix.org"
];
extra-trusted-public-keys = [
"nix-cache.nul.ie-1:BzH5yMfF4HbzY1C977XzOxoPhEc9Zbu39ftPkUbH+m4="
"niks3.numtide.com-1:DTx8wZduET09hRmMtKdQDxNNthLQETkc/yaX7M4qK0g="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
@@ -35,10 +39,10 @@
home-manager-stable.inputs.nixpkgs.follows = "nixpkgs-stable";
# Determinate Nix, used as the common Nix implementation across systems, homes, the devshell and
# CI (see lib.my.c.nix). We build it ourselves against our pinned nixpkgs (FlakeHub's cache needs
# auth), so it flows through our own Harmonia cache like everything else.
# CI (see lib.my.c.nix). We build it ourselves (FlakeHub's cache needs auth), so it flows through
# our own Harmonia cache like everything else. Let its own lockfile choose the tested nixpkgs
# revision because its packaging carries patches that can conflict with ours.
determinate-nix.url = "https://flakehub.com/f/DeterminateSystems/nix-src/*";
determinate-nix.inputs.nixpkgs.follows = "nixpkgs-unstable";
# Stuff used by the flake for build / deployment
# ragenix.url = "github:yaxitech/ragenix";
@@ -58,9 +62,23 @@
# harmonia.url = "github:devplayer0/harmonia/cache-config-daemon-store";
harmonia.inputs.nixpkgs.follows = "nixpkgs-unstable";
# Firmware building for the OpenWrt boxes, which aren't managed by this flake otherwise.
# `openwrt-feeds` pins the package feeds; without it, evaluation would reach the OpenWrt
# download server over import-from-derivation and break on hashes that upstream rotates daily.
openwrt-imagebuilder.url = "github:astro/nix-openwrt-imagebuilder";
openwrt-imagebuilder.inputs.nixpkgs.follows = "nixpkgs-unstable";
openwrt-feeds.url = "github:devplayer0/openwrt-feeds";
openwrt-feeds.inputs.nixpkgs.follows = "nixpkgs-unstable";
openwrt-feeds.inputs.openwrt-imagebuilder.follows = "openwrt-imagebuilder";
# Packages not in nixpkgs
sharry.url = "github:eikek/sharry";
sharry.inputs.nixpkgs.follows = "nixpkgs-unstable";
# Keep its tested nixpkgs pin so packages can use the upstream binary cache.
llm-agents.url = "github:numtide/llm-agents.nix";
# Our fork with Jujutsu support, one branch per upstream release it is rebased onto. Don't make
# it follow our nixpkgs: its npm dependency hash is tied to its own nixpkgs pin.
paseo.url = "git+https://git.nul.ie/dev/paseo?ref=fork/jujutsu-v0.17.5";
slop-broker.url = "git+https://git.nul.ie/dev/slop-broker?ref=refs/heads/progress";
slop-broker.inputs.nixpkgs.follows = "nixpkgs-unstable";
borgthin.url = "github:devplayer0/borg";
# TODO: Update borgthin so this works
# borgthin.inputs.nixpkgs.follows = "nixpkgs-mine";
@@ -75,6 +93,10 @@
# the source is already realised there. Re-enable (and revisit upstream) if we start using pi.
# pi-agent.url = "github:lukasl-dev/pi.nix";
# pi-agent.inputs.nixpkgs.follows = "nixpkgs-unstable";
bootvine = {
url = "git+https://codeberg.org/wvhulle/bootvine";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
};
outputs =
@@ -147,6 +169,7 @@
myPkgsOverlay
determinateOverlay
inputs.slop-broker.overlays.default
inputs.devshell.overlays.default
inputs.ragenix.overlays.default
inputs.deploy-rs.overlays.default
@@ -163,6 +186,7 @@
myPkgsOverlay
determinateOverlay
inputs.slop-broker.overlays.default
];
config = {
@@ -181,6 +205,7 @@
# Systems
nixos/installer.nix
nixos/boxes/colony
nixos/boxes/colony/portcullis
nixos/boxes/tower
nixos/boxes/home/stream.nix
nixos/boxes/home/palace
@@ -258,7 +283,11 @@
deploy = recurseIntoAttrs (pkgs.deploy-rs.lib.deployChecks self.deploy);
};
packages = flattenTree (import ./pkgs { inherit lib pkgs; });
packages = flattenTree (
(import ./pkgs { inherit lib pkgs; }) //
(import ./openwrt { inherit pkgs inputs; }));
llmAgentPackages = import ./ci/llm-agent-packages.nix { inherit lib inputs nixfiles system; };
devShells.default = shell;
@@ -274,6 +303,20 @@
homes' // systems' // packages' // {
inherit shell;
};
ciDrv = pkgs.linkFarm "ci" ci;
ciIfdReasons =
let
inherit (nixfiles.config) nixos home-manager;
targets = builtins.attrValues nixos.systems ++ builtins.attrValues home-manager.homes;
channels = lib.unique (map (target: target.nixpkgs) (builtins.filter (target: target.system == system) targets));
hasReplacements = channel:
(import ./lib/runtime-dependency-replacements.nix {
inherit lib;
pkgs = pkgs'.${channel}.${system};
pkgsFlake = pkgsFlakes.${channel};
}) != [ ];
in
lib.optional (lib.any hasReplacements channels)
"Runtime dependency replacement reads generated store reference graphs";
}));
}
+1
View File
@@ -2,6 +2,7 @@
home-manager.modules = {
common = ./common.nix;
gui = ./gui;
agents = ./agents;
deploy-rs = ./deploy-rs.nix;
swaync = ./swaync.nix;
};
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
# Source: https://github.com/daniel3303/ClaudeCodeStatusLine
# Single line: Model | tokens | %used | %remain | think | 5h bar @reset | 7d bar @reset | extra
# Single line: Model (effort) | dir@branch | tokens (%used) | 5h @reset | 7d @reset | extra | CLI version
set -f # disable globbing
VERSION="1.4.4"
VERSION="1.4.5"
input=$(cat)
@@ -110,31 +110,26 @@ elif [ -f "$settings_path" ]; then
fi
[ -z "$effort_level" ] && effort_level="medium"
# ===== Claude CLI version (cached, 1h TTL) =====
cli_version_cache="/tmp/claude/statusline-cli-version"
cli_version=""
cli_version_max_age=3600
if [ -f "$cli_version_cache" ]; then
cv_mtime=$(stat -c %Y "$cli_version_cache" 2>/dev/null || stat -f %m "$cli_version_cache" 2>/dev/null)
cv_now=$(date +%s)
cv_age=$(( cv_now - cv_mtime ))
if [ "$cv_age" -lt "$cli_version_max_age" ]; then
cli_version=$(cat "$cli_version_cache" 2>/dev/null)
fi
fi
# ===== Claude CLI version =====
# Prefer the version Claude Code passes on stdin (always the running instance);
# fall back to asking whichever `claude` is on PATH.
cli_version=$(echo "$input" | jq -r '.version // empty')
if [ -z "$cli_version" ]; then
cli_version=$(claude --version 2>/dev/null | awk '{print $1}')
if [ -n "$cli_version" ]; then
mkdir -p /tmp/claude 2>/dev/null
echo "$cli_version" > "$cli_version_cache"
fi
fi
# ===== Build single-line output =====
out=""
out+="${blue}${model_name}${reset}"
out+="${blue}${model_name}${reset} ${dim}(${reset}"
case "$effort_level" in
low) out+="${dim}${effort_level}${reset}" ;;
medium) out+="${orange}med${reset}" ;;
high) out+="${green}${effort_level}${reset}" ;;
xhigh) out+="${purple}${effort_level}${reset}" ;;
max) out+="${red}${effort_level}${reset}" ;;
*) out+="${green}${effort_level}${reset}" ;;
esac
out+="${dim})${reset}"
# Current working directory
cwd=$(echo "$input" | jq -r '.cwd // empty')
@@ -152,16 +147,6 @@ fi
out+=" ${dim}|${reset} "
out+="${orange}${used_tokens}/${total_tokens}${reset} ${dim}(${reset}${green}${pct_used}%${reset}${dim})${reset}"
out+=" ${dim}|${reset} "
out+="effort: "
case "$effort_level" in
low) out+="${dim}${effort_level}${reset}" ;;
medium) out+="${orange}med${reset}" ;;
high) out+="${green}${effort_level}${reset}" ;;
xhigh) out+="${purple}${effort_level}${reset}" ;;
max) out+="${red}${effort_level}${reset}" ;;
*) out+="${green}${effort_level}${reset}" ;;
esac
# ===== Cross-platform OAuth token resolution (from statusline.sh) =====
# Tries credential sources in order: env var → macOS Keychain → Linux creds file → GNOME Keyring
+68
View File
@@ -0,0 +1,68 @@
{ lib, pkgs, inputs, config, options, ... }:
let
inherit (lib) mkIf optional optionalAttrs mapAttrs attrValues types;
inherit (lib.my) mkOpt' mkBoolOpt';
cfg = config.my.agents;
agentPkgs = inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system};
slopGuide = "${pkgs.slop-broker}/share/slop-broker/slop-tools.md";
# Claude takes a rule file each; Codex takes one `AGENTS.md`
rules = optionalAttrs cfg.slop.enable { slop = slopGuide; }
// mapAttrs (name: text: pkgs.writeText "${name}.md" text) cfg.rules;
codexContext = pkgs.concatText "AGENTS.md" (attrValues rules);
in
{
options.my.agents = {
enable = mkBoolOpt' false "Whether to install and configure coding agents (Claude Code, Codex).";
slop.enable = mkBoolOpt' false "Whether agents use the `slop` client for privileged operations.";
rules = mkOpt' (types.attrsOf types.lines) { }
"Instructions for every agent, by name: a Claude rule each, and appended to Codex's `AGENTS.md`.";
};
config = mkIf cfg.enable {
home.packages = optional cfg.slop.enable pkgs.slop-broker;
programs = {
# TODO: Remove mutableSettings guard when Home Manager 26.11 releases; 26.05 lacks it.
codex = {
enable = true;
package = agentPkgs.codex;
settings.sandbox_workspace_write.network_access = true;
settings.tui = {
status_line = [
"model-with-reasoning"
"current-dir"
"five-hour-limit"
"weekly-limit"
"context-used"
"context-window-size"
"total-input-tokens"
"total-output-tokens"
"used-tokens"
];
status_line_use_colors = true;
};
} // optionalAttrs (options.programs.codex ? mutableSettings) {
mutableSettings = true;
} // optionalAttrs (rules != { }) {
context = "${codexContext}";
};
claude-code = {
enable = true;
package = agentPkgs.claude-code;
inherit rules;
settings = {
model = "opus";
theme = "auto";
statusLine = {
type = "command";
command = ./claude-statusline.sh;
padding = 0;
};
};
};
};
};
}
+49 -1
View File
@@ -2,14 +2,17 @@
let
inherit (builtins) listToAttrs mapAttrs readFile;
inherit (lib)
optionalString nameValuePair concatMapStrings concatStringsSep optionalAttrs
optionalString nameValuePair concatMapStrings concatStringsSep
mapAttrsToList mkMerge mkIf mkDefault mkOption;
inherit (lib.hm) dag;
inherit (lib.my) mkOpt' dummyOption;
runtimeDependencyReplacements = import ../../lib/runtime-dependency-replacements.nix { inherit lib pkgs pkgsFlake; };
in
{
# Disabled: breaks `nix flake check` in CI (see flake.nix pi-agent note).
# imports = [ inputs.pi-agent.homeModules.default ];
imports = [ inputs.slop-broker.homeModules.slop ];
options = with lib.types; {
my = {
@@ -29,6 +32,20 @@ in
};
};
};
home.activationPackage = mkOption {
apply = drv:
if config.my.isStandalone && runtimeDependencyReplacements != [ ] then
(pkgs.replaceDependencies.override {
replaceDirectDependencies = pkgs.replaceDirectDependencies.override {
nix = config.nix.package;
};
}) {
inherit drv;
replacements = runtimeDependencyReplacements;
}
else drv;
};
};
config = mkMerge [
@@ -67,6 +84,24 @@ in
# never care about.
home-manager.enable = true;
git = {
enable = true;
settings = {
user = {
email = "jackos1998@gmail.com";
name = "Jack O'Sullivan";
};
pull.rebase = true;
};
lfs.enable = true;
};
diff-so-fancy.enable = true;
jujutsu = {
enable = true;
settings.user = config.programs.git.settings.user;
};
lsd = {
enable = mkDefault true;
enableFishIntegration = mkDefault true;
@@ -151,6 +186,18 @@ in
HostName = "ch-s010.rsync";
};
# Coding agents run as `slop-cannon`; never forward an agent there
slop-cannon = {
HostName = "slop-cannon.${lib.my.c.home.domain}";
User = "slop-cannon";
ForwardAgent = "no";
};
slop-cannon-dev = {
HostName = "slop-cannon.${lib.my.c.home.domain}";
User = "dev";
ForwardAgent = "no";
};
shoe = {
Host = "shoe.netsoc.tcd.ie shoe";
User = "netsoc";
@@ -202,6 +249,7 @@ in
file
tree
pwgen
python3
minicom
iperf3
+11 -35
View File
@@ -1,6 +1,6 @@
{ lib, pkgs', pkgs, config, ... }:
{ lib, pkgs', pkgs, inputs, config, options, ... }:
let
inherit (lib) genAttrs mkIf mkMerge mkForce mapAttrs mkOptionDefault mkDefault optional;
inherit (lib) genAttrs mkIf mkMerge mkForce mapAttrs mkOptionDefault mkDefault optional optionalAttrs;
inherit (lib.my) mkOpt' mkBoolOpt';
inherit (lib.my.c) pubDomain;
@@ -73,6 +73,8 @@ in
}
];
my.agents.enable = mkDefault true;
home = {
packages = (with pkgs; [
xdg-utils
@@ -84,7 +86,7 @@ in
grim
slurp
swappy
satty
python3Packages.python-lsp-server
nil # nix language server
@@ -186,19 +188,6 @@ in
};
};
};
claude-code = {
enable = true;
settings = {
model = "opus";
theme = "auto";
statusLine = {
type = "command";
command = ./claude-statusline.sh;
padding = 0;
};
};
};
};
}
@@ -387,8 +376,8 @@ in
"${mod}+Shift+n" = "exec ${clearWsName}";
# Screenshots
"${mod}+Shift+d" = ''exec grim - | swappy -f -'';
"${mod}+Shift+s" = ''exec grim -g "$(slurp)" - | swappy -f -'';
"${mod}+Shift+d" = ''exec grim - | satty -f - --copy-command "${pkgs.wl-clipboard}/bin/wl-copy"'';
"${mod}+Shift+s" = ''exec grim -g "$(slurp)" - | satty -f - --copy-command "${pkgs.wl-clipboard}/bin/wl-copy"'';
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%";
@@ -423,12 +412,12 @@ in
gtk = {
enable = true;
theme = {
name = "Numix";
package = pkgs.numix-gtk-theme;
name = "Adwaita";
package = pkgs.gnome-themes-extra;
};
gtk4.theme = {
name = "Numix";
package = pkgs.numix-gtk-theme;
name = "Adwaita";
package = pkgs.gnome-themes-extra;
};
iconTheme = {
name = "Numix";
@@ -485,19 +474,6 @@ in
};
programs = {
git = {
enable = true;
settings = {
user = {
email = "jackos1998@gmail.com";
name = "Jack O'Sullivan";
};
pull.rebase = true;
};
lfs.enable = true;
};
diff-so-fancy.enable = true;
waybar = import ./waybar.nix { inherit lib pkgs config font; };
rofi = {
enable = true;
+28 -1
View File
@@ -14,6 +14,7 @@ rec {
keepalived_script = 405;
photoprism = 406;
copyparty = 408;
slop-cannon = 1001;
};
gids = {
matrix-syncv3 = 400;
@@ -25,12 +26,13 @@ rec {
photoprism = 406;
adbusers = 407;
copyparty = 408;
slop-cannon = 1001;
};
};
kernel = {
lts = pkgs: pkgs.linuxKernel.packages.linux_6_18;
latest = pkgs: pkgs.linuxKernel.packages.linux_7_0;
latest = pkgs: pkgs.linuxKernel.packages.linux_7_3;
};
nginx = rec {
@@ -102,9 +104,13 @@ rec {
cache = rec {
substituters = [
"https://nix-cache.${pubDomain}"
"https://cache.numtide.com"
"https://nix-community.cachix.org"
];
keys = [
"nix-cache.nul.ie-1:BzH5yMfF4HbzY1C977XzOxoPhEc9Zbu39ftPkUbH+m4="
"niks3.numtide.com-1:DTx8wZduET09hRmMtKdQDxNNthLQETkc/yaX7M4qK0g="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
conf = ''
extra-substituters = ${concatStringsSep " " substituters}
@@ -460,6 +466,22 @@ rec {
'';
};
# Non-public destinations, plus our own IPv6 prefixes (trusted across the mesh), for keeping
# untrusted workloads to the Internet
internalNets = rec {
v4 = [
"0.0.0.0/8" "10.0.0.0/8" "100.64.0.0/10" "127.0.0.0/8" "169.254.0.0/16"
"172.16.0.0/12" "192.168.0.0/16" "224.0.0.0/4" "240.0.0.0/4"
];
v6 = [
"::/127" "::ffff:0:0/96" "fc00::/7" "fe80::/10" "ff00::/8"
] ++ map (p: colony.prefixes.${p}.v6) [ "home" "all" "cust" "as211024" ];
nftReject = ''
ip daddr { ${concatStringsSep ", " v4} } reject with icmpx admin-prohibited
ip6 daddr { ${concatStringsSep ", " v6} } reject with icmpx admin-prohibited
'';
};
kelder = {
groups = {
storage = 2000;
@@ -495,4 +517,9 @@ rec {
sshHostKeys = {
mail-vm = ../.keys/mail-vm-host.pub;
};
# age recipients that every secret is encrypted to (see `secrets.nix`)
ageKeyFiles = {
dev = ../.keys/dev.pub;
slop-broker = ../.keys/slop-broker.pub;
};
}
+4 -3
View File
@@ -179,11 +179,11 @@ rec {
};
vm = rec {
lvmDisk'' = name: vg: lv: {
blockDisk = name: filename: {
inherit name;
backend = {
driver = "host_device";
filename = "/dev/${vg}/${lv}";
inherit filename;
# It appears this needs to be set on the backend _and_ the format
discard = "unmap";
};
@@ -193,6 +193,7 @@ rec {
};
frontend = "virtio-blk";
};
lvmDisk'' = name: vg: lv: blockDisk name "/dev/${vg}/${lv}";
lvmDisk' = vg: lv: lvmDisk'' lv vg lv;
lvmDisk = lvmDisk' "main";
disk = vm: lv: lvmDisk'' lv "main" "vm-${vm}-${lv}";
@@ -253,7 +254,7 @@ rec {
in
{
trivial = prev.trivial // {
release = "26.06:u-${prev.trivial.release}";
release = "26.11:u-${prev.trivial.release}";
codeName = "Irritating";
revisionWithDefault = default: self.rev or default;
versionSuffix = ".${date}.${revCode self}:u-${revCode pkgsFlake}";
+13
View File
@@ -0,0 +1,13 @@
{ lib, pkgs, pkgsFlake }:
# TODO: Drop the json-c replacement when updating the fork pin to a revision with the json-c fix.
# Patch the runtime library separately so existing consumers can be reused.
lib.optional ((pkgsFlake.rev or null) == "320600d55ff67365e933b98b339acdeac238eb26") {
oldDependency = pkgs.json_c;
newDependency = pkgs.json_c.overrideAttrs (old: {
patches = (old.patches or [ ]) ++ [ (pkgs.fetchpatch {
url = "https://github.com/json-c/json-c/commit/f291fa81c6f21d925ea771a8cca597f5886309cc.patch";
hash = "sha256-ZffSw1pfEfOH2ylRpJShdx7sTQR2nmPM/JIj/26UrDM=";
}) ];
});
}
+3
View File
@@ -105,6 +105,9 @@ in
(networkdAssignment "as211024" assignments.as211024)
{
matchConfig.Name = "as211024";
# The routing policy rule below holds this link in "configuring" until
# tailscale0 exists, and tailscaled only starts once the network is online
linkConfig.RequiredForOnline = "no";
networkConfig.IPv6AcceptRA = mkForce false;
routes = [
{
+3
View File
@@ -138,6 +138,7 @@ in
linuxPackages.cpupower
smartmontools
xfsprogs
ipmitool
];
systemd = {
@@ -378,6 +379,8 @@ in
my = {
#deploy.generate.system.mode = "boot";
network.bbr = true;
secrets = {
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPIijqzAWF6OxKr4aeCa1TAc5xGn4rdIjVTt0wAPU6uY";
files = {
+175
View File
@@ -0,0 +1,175 @@
{ lib, ... }:
let
inherit (lib.my) net;
inherit (lib.my.c.colony) domain;
home = lib.my.c.home;
in
{
nixos.systems.portcullis = {
system = "x86_64-linux";
nixpkgs = "mine-stable";
home-manager = "mine-stable";
assignments = {
# Staging-only: the 10G link lands on the home hi VLAN until portcullis is racked.
hi = {
domain = home.domain;
mtu = home.hiMTU;
ipv4 = {
address = net.cidr.host 41 home.prefixes.hi.v4;
mask = 22;
gateway = home.vips.hi.v4;
};
ipv6 = {
iid = "::6:1";
address = net.cidr.host (65536*6+1) home.prefixes.hi.v6;
};
};
};
configuration = { lib, pkgs, config, assignments, ... }:
let
inherit (lib) mkMerge;
inherit (lib.my) mkVLAN networkdAssignment;
inherit (lib.my.c) networkd;
# Router-sized rings rather than the driver defaults, and GRO kept across
# forwarding so UDP-encapsulated traffic stays batched.
nicTuning = {
RxBufferSize = 4096;
TxBufferSize = 4096;
GenericReceiveOffloadUDPForwarding = true;
};
in
{
hardware = {
enableRedistributableFirmware = true;
cpu = {
intel.updateMicrocode = true;
};
};
boot = {
kernelModules = [ "kvm-intel" ];
# Passthrough mode keeps the IOMMU available without paying DMA translation
# on the forwarding path.
kernelParams = [ "intel_iommu=on" "iommu=pt" ];
initrd = {
availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "usbhid" "sd_mod" "sr_mod" ];
kernelModules = [ "dm-snapshot" ];
};
};
fileSystems = {
"/boot" = {
device = "/dev/disk/by-uuid/1A70-EBCB";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
"/nix" = {
device = "/dev/main/portcullis-nix";
fsType = "ext4";
};
"/persist" = {
device = "/dev/main/portcullis-persist";
fsType = "ext4";
neededForBoot = true;
};
};
networking = { inherit domain; };
# The I226-V link-drop erratum is driven by EEE as well as ASPM. The driver already
# leaves EEE off, so this pins a default rather than changing one; systemd.link has
# no knob for it.
services.udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="net", DRIVERS=="igc", RUN+="${pkgs.ethtool}/bin/ethtool --set-eee $name eee off"
'';
environment.systemPackages = with pkgs; [
pciutils
usbutils
ethtool
lm_sensors
smartmontools
];
systemd.network = {
# Only some ports are patched in while the box is being staged, so don't block
# boot on the others coming up.
wait-online.anyInterface = true;
netdevs = mkVLAN "lan-hi" home.vlans.hi;
links = {
"10-et2g5-0" = {
matchConfig.PermanentMACAddress = "00:d0:b4:05:ed:48";
linkConfig = nicTuning // { Name = "et2g5-0"; };
};
"10-et2g5-1" = {
matchConfig.PermanentMACAddress = "00:d0:b4:05:ed:49";
linkConfig = nicTuning // { Name = "et2g5-1"; };
};
"10-et2g5-2" = {
matchConfig.PermanentMACAddress = "00:d0:b4:05:ed:4a";
linkConfig = nicTuning // { Name = "et2g5-2"; };
};
"10-et2g5-3" = {
matchConfig.PermanentMACAddress = "00:d0:b4:05:ed:4b";
linkConfig = nicTuning // { Name = "et2g5-3"; };
};
"11-et10g-0" = {
matchConfig.PermanentMACAddress = "60:be:b4:2e:9b:a2";
linkConfig = nicTuning // { Name = "et10g-0"; };
};
"11-et10g-1" = {
matchConfig.PermanentMACAddress = "60:be:b4:2e:9b:a3";
linkConfig = nicTuning // { Name = "et10g-1"; };
};
};
networks = {
# TODO: replace with the colony assignments and routing config once portcullis is
# racked at Nikhef. Until then it is staged at home, so every 2.5G port takes DHCP on
# the lo VLAN and whichever one is patched in provides connectivity. kea registers
# the DHCP hostname, making the box reachable as `portcullis.dyn.h.nul.ie`.
"80-bootstrap" = {
matchConfig.Name = "et2g5-*";
DHCP = "yes";
networkConfig.IPv6PrivacyExtensions = "no";
linkConfig.RequiredForOnline = "routable";
};
# 10G up to jim's spare SFP+ port via an intermediary switch. That uplink is
# untagged VLAN 1, so hi has to be tagged on its own interface.
"81-et10g-0" = {
matchConfig.Name = "et10g-0";
vlan = [ "lan-hi" ];
networkConfig = networkd.noL3;
linkConfig = {
# The carrier has to allow hi's jumbo frames before lan-hi can take that MTU
MTUBytes = toString home.hiMTU;
RequiredForOnline = "no";
};
};
"82-lan-hi" = mkMerge [
(networkdAssignment "lan-hi" assignments.hi)
{ networkConfig = home.vlanDns "hi"; }
];
};
};
my = {
# As above: no colony assignment yet, so deploy over the staging hi address.
deploy.node.hostname = assignments.hi.ipv4.address;
secrets = {
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAUolR93Byg+Daw8pUYHVpQ34ioxSc2C8vzj9F4KbqMs";
};
server.enable = true;
};
};
};
}
+49 -33
View File
@@ -52,7 +52,7 @@ in
protocol device {}
protocol direct {
interface "wan", "frys-ix", "nl-ix", "fogixp", "ifog-transit";
interface "wan", "clue-ix", "frys-ix", "nl-ix", "fogixp", "ifog-transit";
ipv4;
ipv6;
}
@@ -140,6 +140,9 @@ in
preference PREFPEER;
};
}
template bgp nlix_peer_bgp4 from peer_bgp4 {
ipv4 { preference (PREFPEER-1); };
}
template bgp ixp_bgp4 from base_bgp4 {
ipv4 {
import filter bgp_import;
@@ -170,6 +173,9 @@ in
preference PREFPEER;
};
}
template bgp nlix_peer_bgp6 from peer_bgp6 {
ipv6 { preference (PREFPEER-1); };
}
template bgp ixp_bgp6 from base_bgp6 {
ipv6 {
import filter bgp_import;
@@ -219,20 +225,31 @@ in
# neighbor 2001:7f8:ca:1::107 as 208431;
# }
protocol bgp peer4_cc_luje from peer_bgp4 {
description "LUJE.net (on ColoClue, IPv4)";
neighbor 94.142.240.20 as 212855;
}
protocol bgp peer6_cc_luje from peer_bgp6 {
description "LUJE.net (on ColoClue, IPv6)";
neighbor 2a02:898:0:20::166:1 as 212855;
}
protocol bgp peer6_luje_labs from peer_bgp6 {
description "LUJE.net labs (IPv6)";
multihop 3;
neighbor 2a07:cd40:1::9 as 202413;
}
protocol bgp ixp6_clueix_rs1 from ixp_bgp6 {
description "Clue-IX route server 1 (IPv6)";
local role rs_client;
ttl security on;
neighbor 2001:7f8:154::21:8511:1 as 218511;
}
protocol bgp ixp6_clueix_rs2 from ixp_bgp6 {
description "Clue-IX route server 2 (IPv6)";
local role rs_client;
ttl security on;
neighbor 2001:7f8:154::21:8511:2 as 218511;
}
protocol bgp peer6_clueix_luje from peer_bgp6 {
description "LUJE.net (on Clue-IX, IPv6)";
neighbor 2001:7f8:154::21:2855:1 as 212855;
}
protocol bgp ixp4_frysix_rs3 from ixp_bgp4 {
description "Frys-IX route server 3 (IPv4)";
neighbor 185.1.160.255 as 56393;
@@ -291,19 +308,28 @@ in
neighbor 2001:7f8:10f::3:3e9b:134 as 212635;
}
protocol bgp peer4_nlix_meta1 from peer_bgp4 {
protocol bgp peer4_nlix_luje from nlix_peer_bgp4 {
description "LUJE.net (on NL-ix, IPv4)";
neighbor 193.239.116.87 as 212855;
}
protocol bgp peer6_nlix_luje from nlix_peer_bgp6 {
description "LUJE.net (on NL-ix, IPv6)";
neighbor 2001:7f8:13::a521:2855:1 as 212855;
}
protocol bgp peer4_nlix_meta1 from nlix_peer_bgp4 {
description "Meta 1 (on NL-ix, IPv4)";
neighbor 193.239.116.147 as 32934;
}
protocol bgp peer4_nlix_meta2 from peer_bgp4 {
protocol bgp peer4_nlix_meta2 from nlix_peer_bgp4 {
description "Meta 2 (on NL-ix, IPv4)";
neighbor 193.239.116.148 as 32934;
}
protocol bgp peer6_nlix_meta1 from peer_bgp6 {
protocol bgp peer6_nlix_meta1 from nlix_peer_bgp6 {
description "Meta 1 (on NL-ix, IPv6)";
neighbor 2001:7f8:13::a503:2934:1 as 32934;
}
protocol bgp peer6_nlix_meta2 from peer_bgp6 {
protocol bgp peer6_nlix_meta2 from nlix_peer_bgp6 {
description "Meta 2 (on NL-ix, IPv6)";
neighbor 2001:7f8:13::a503:2934:2 as 32934;
}
@@ -347,55 +373,45 @@ in
ipv6 { preference (PREFIXP-1); };
}
# protocol bgp peer4_nlix_cloudflare1 from peer_bgp4 {
# protocol bgp peer4_nlix_cloudflare1 from nlix_peer_bgp4 {
# description "Cloudflare NL-ix 1 (IPv4)";
# neighbor 193.239.117.14 as 13335;
# ipv4 { preference (PREFPEER-1); };
# }
# protocol bgp peer4_nlix_cloudflare2 from peer_bgp4 {
# protocol bgp peer4_nlix_cloudflare2 from nlix_peer_bgp4 {
# description "Cloudflare NL-ix 2 (IPv4)";
# neighbor 193.239.117.114 as 13335;
# ipv4 { preference (PREFPEER-1); };
# }
# protocol bgp peer4_nlix_cloudflare3 from peer_bgp4 {
# protocol bgp peer4_nlix_cloudflare3 from nlix_peer_bgp4 {
# description "Cloudflare NL-ix 3 (IPv4)";
# neighbor 193.239.118.138 as 13335;
# ipv4 { preference (PREFPEER-1); };
# }
# protocol bgp peer6_nlix_cloudflare1 from peer_bgp6 {
# protocol bgp peer6_nlix_cloudflare1 from nlix_peer_bgp6 {
# description "Cloudflare NL-ix 1 (IPv6)";
# neighbor 2001:7f8:13::a501:3335:1 as 13335;
# ipv6 { preference (PREFPEER-1); };
# }
# protocol bgp peer6_nlix_cloudflare2 from peer_bgp6 {
# protocol bgp peer6_nlix_cloudflare2 from nlix_peer_bgp6 {
# description "Cloudflare NL-ix 2 (IPv6)";
# neighbor 2001:7f8:13::a501:3335:2 as 13335;
# ipv6 { preference (PREFPEER-1); };
# }
# protocol bgp peer6_nlix_cloudflare3 from peer_bgp6 {
# protocol bgp peer6_nlix_cloudflare3 from nlix_peer_bgp6 {
# description "Cloudflare NL-ix 3 (IPv6)";
# neighbor 2001:7f8:13::a501:3335:3 as 13335;
# ipv6 { preference (PREFPEER-1); };
# }
protocol bgp peer4_nlix_jurrian from peer_bgp4 {
protocol bgp peer4_nlix_jurrian from nlix_peer_bgp4 {
description "AS212635 aka jurrian (on NL-ix, IPv4)";
neighbor 193.239.117.55 as 212635;
ipv4 { preference (PREFPEER-1); };
}
protocol bgp peer6_nlix_jurrian from peer_bgp6 {
protocol bgp peer6_nlix_jurrian from nlix_peer_bgp6 {
description "AS212635 aka jurrian (on NL-ix, IPv6)";
neighbor 2001:7f8:13::a521:2635:1 as 212635;
ipv6 { preference (PREFPEER-1); };
}
protocol bgp peer4_nlix_apple from peer_bgp4 {
protocol bgp peer4_nlix_apple from nlix_peer_bgp4 {
description "Apple (on NL-ix, IPv4)";
neighbor 193.239.117.113 as 714;
ipv4 { preference (PREFPEER-1); };
}
protocol bgp peer6_nlix_apple from peer_bgp6 {
protocol bgp peer6_nlix_apple from nlix_peer_bgp6 {
description "Apple (on NL-ix, IPv6)";
neighbor 2001:7f8:13::a500:714:2 as 714;
ipv6 { preference (PREFPEER-1); };
}
protocol bgp ixp4_fogixp_rs1 from ixp_bgp4 {
+6 -4
View File
@@ -65,7 +65,7 @@ in
configuration = { lib, pkgs, modulesPath, config, assignments, allAssignments, ... }:
let
inherit (lib) flatten mkIf mkMerge mkForce;
inherit (lib) flatten mkIf mkMerge mkForce optional;
inherit (lib.my) networkdAssignment;
inherit (lib.my.c) networkd;
in
@@ -144,6 +144,7 @@ in
netdevs = mkMerge [
(mkVLAN "ifog" 409)
(mkVLAN "clue-ix" 121)
(mkVLAN "frys-ix" 701)
(mkVLAN "nl-ix" 1845)
@@ -241,7 +242,7 @@ in
mkIXPConfig = name: ipv4: ipv6: {
"85-${name}" = {
matchConfig.Name = name;
address = [ ipv4 ipv6 ];
address = optional (ipv4 != null) ipv4 ++ [ ipv6 ];
linkConfig.MTUBytes = "1500";
networkConfig = {
DHCP = "no";
@@ -254,13 +255,14 @@ in
in
mkMerge
[
(mkIXPConfig "clue-ix" null "2001:7f8:154::21:1024:1/64")
(mkIXPConfig "frys-ix" "185.1.160.196/23" "2001:7f8:10f::3:3850:196/64")
(mkIXPConfig "nl-ix" "193.239.116.145/22" "2001:7f8:13::a521:1024:1/64")
(mkIXPConfig "fogixp" "185.1.147.159/24" "2001:7f8:ca:1::159/64")
{
"80-wan" = {
matchConfig.Name = "wan";
vlan = [ "ifog" ];
vlan = [ "ifog" "clue-ix" ];
DHCP = "no";
address = with assignments.internal; [
(with ipv4; "${address}/${toString mask}")
@@ -451,7 +453,7 @@ in
'';
in
''
define ixps = { frys-ix, nl-ix, fogixp, ifog-transit }
define ixps = { clue-ix, frys-ix, nl-ix, fogixp, ifog-transit }
table inet filter {
chain input {
+2
View File
@@ -180,6 +180,8 @@ in
};
my = {
network.bbr = true;
secrets = {
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP+KINpHLMduBuW96JzfSRDLUzkI+XaCBghu5/wHiW5R";
files = {
+11 -6
View File
@@ -68,12 +68,17 @@ in
systemd = {
services = {
gitea-runner-main.serviceConfig = {
# Needs to be able to read its secrets
CacheDirectory = "gitea-runner";
DynamicUser = mkForce false;
User = "gitea-runner";
Group = "gitea-runner";
gitea-runner-main = {
# The runner exits if Gitea isn't serving yet when it starts
after = [ "gitea.service" ];
serviceConfig = {
# Needs to be able to read its secrets
CacheDirectory = "gitea-runner";
DynamicUser = mkForce false;
User = "gitea-runner";
Group = "gitea-runner";
};
};
};
};
+44 -3
View File
@@ -1,8 +1,11 @@
{ lib, pkgs, config, assignments, allAssignments, ... }:
let
inherit (lib) mkMerge;
inherit (lib) mkMerge mkAfter getExe;
inherit (lib.my.c) pubDomain;
inherit (lib.my.c.colony) prefixes;
# Pocket ID login source, client `gitea` (declared on `middleman`)
oidcSource = "id.${pubDomain}";
in
{
config = {
@@ -48,6 +51,40 @@ in
# The default /tmp is on the small tmpfs root, so keep them on the state volume.
environment.TMPDIR = "${config.services.gitea.stateDir}/tmp";
}
{
# Gitea keeps login sources in its database: add the Pocket ID one, or bring it up to
# date. The server only reads them at startup, so this runs before it; a failure only
# warns, so Gitea still starts. The CLI only takes the secret as an argument.
preStart = mkAfter (
let
gitea = getExe config.services.gitea.package;
in
''
oidc_source_setup() {
local oidc_args=(
--name '${oidcSource}'
--provider openidConnect
--key gitea
--secret "$(< '${config.age.secrets."gitea/oidc-secret.txt".path}')"
--auto-discover-url 'https://${oidcSource}/.well-known/openid-configuration'
--scopes openid --scopes email --scopes profile
)
local list oidc_id
list="$(${gitea} admin auth list)" || return
oidc_id="$(${pkgs.gawk}/bin/awk '$2 == "${oidcSource}" { print $1 }' <<< "$list")" || return
if [ -n "$oidc_id" ]; then
${gitea} admin auth update-oauth --id "$oidc_id" "''${oidc_args[@]}"
else
${gitea} admin auth add-oauth "''${oidc_args[@]}"
fi
}
if ! oidc_source_setup; then
echo "Couldn't set up the ${oidcSource} login source; starting without it" >&2
fi
'');
}
];
};
@@ -76,9 +113,9 @@ in
mailerPasswordFile = config.age.secrets."gitea/mail.txt".path;
settings = {
server = {
DOMAIN = "git.${pubDomain}";
SSH_DOMAIN = "git.${pubDomain}";
HTTP_ADDR = "::";
ROOT_URL = "https://git.${pubDomain}";
ROOT_URL = "https://git.${pubDomain}/";
};
service = {
DISABLE_REGISTRATION = true;
@@ -119,6 +156,8 @@ in
};
actions = {
ENABLED = true;
# Match the runner's job timeout; the default (3h) fails long builds that are still running
ENDLESS_TASK_TIMEOUT = "8h";
};
};
};
@@ -137,6 +176,8 @@ in
"gitea/db.txt" = ownedByGit;
"gitea/mail.txt" = ownedByGit;
"gitea/minio.txt" = ownedByGit;
# Shared with `middleman`, which registers it with Pocket ID
"gitea/oidc-secret.txt" = ownedByGit;
};
};
};
@@ -63,7 +63,7 @@ in
};
postgresql = {
package = pkgs.postgresql_14;
package = pkgs.postgresql_18;
enable = true;
enableTCPIP = true;
@@ -0,0 +1,125 @@
{ lib, config, ... }:
let
inherit (lib) attrNames filterAttrs;
inherit (lib.my.c) pubDomain;
# Vhosts gated by `ssoServer` in `vhosts.nix`, each with its own `/oauth2/` endpoints
ssoVhosts = attrNames (filterAttrs (_: v: v.locations ? "= /oauth2/auth") config.services.nginx.virtualHosts);
in
{
my = {
secrets.files = {
# Pocket ID's database encryption key; it reads it through `LoadCredential`
"middleman/pocket-id-encryption-key" = { };
# Admin key for `pocket-id-sync`, which only works from inside (`vhosts.nix` strips it)
"middleman/pocket-id-api-key" = { };
# `OAUTH2_PROXY_CLIENT_SECRET` and `OAUTH2_PROXY_COOKIE_SECRET`
"middleman/oauth2-proxy.env" = { };
# Client secrets shared with the boxes that run the apps
"gitea/oidc-secret.txt" = { };
# Not deployed anywhere else: mailcow isn't NixOS, so it's pasted into its admin UI
"mailcow/oidc-secret.txt" = { };
};
pocket-id = {
enable = true;
apiKeyFile = config.age.secrets."middleman/pocket-id-api-key".path;
groups = {
admins.friendlyName = "Admins";
};
clients = {
# oauth2-proxy, which gates vhosts that have no sign-in of their own (`ssoServer`)
sso = {
name = "nul.ie SSO";
callbackURLs = map (h: "https://${h}/oauth2/callback") ssoVhosts;
pkce = true;
allowedGroups = [ "admins" ];
extraSettings.skipConsent = true;
secret = {
file = config.age.secrets."middleman/oauth2-proxy.env".path;
key = "OAUTH2_PROXY_CLIENT_SECRET";
};
};
# Gitea's `id.nul.ie` login source (`git` VM)
gitea = {
name = "Gitea";
callbackURLs = [ "https://git.${pubDomain}/user/oauth2/id.${pubDomain}/callback" ];
launchURL = "https://git.${pubDomain}/";
secret.file = config.age.secrets."gitea/oidc-secret.txt".path;
};
# mailcow's Generic-OIDC identity provider (`mail` VM), for mailbox sign-in
mailcow = {
name = "mailcow";
callbackURLs = [ "https://mail.${pubDomain}" "https://mail.${pubDomain}/" ];
launchURL = "https://mail.${pubDomain}/";
secret.file = config.age.secrets."mailcow/oidc-secret.txt".path;
};
};
};
};
# oauth2-proxy talks to Pocket ID through the local nginx rather than out and back in
networking.hosts = {
"127.0.0.1" = [ "id.${pubDomain}" ];
"::1" = [ "id.${pubDomain}" ];
};
services = {
# Passkey-only OpenID Connect provider at `id.nul.ie`, published by nginx
pocket-id = {
settings = {
APP_URL = "https://id.${pubDomain}";
HOST = "127.0.0.1";
PORT = 1411;
TRUST_PROXY = true;
ANALYTICS_DISABLED = true;
};
credentials.ENCRYPTION_KEY = config.age.secrets."middleman/pocket-id-encryption-key".path;
};
# Single sign-on for every `.nul.ie` vhost behind `ssoServer` in `vhosts.nix`
oauth2-proxy = {
enable = true;
provider = "oidc";
oidcIssuerUrl = "https://id.${pubDomain}";
clientID = "sso";
# On the vhost being signed in to
redirectURL = "/oauth2/callback";
keyFile = config.age.secrets."middleman/oauth2-proxy.env".path;
# `offline_access` for a refresh token, so sessions can be checked again without a passkey
scope = "openid email profile groups offline_access";
approvalPrompt = "auto";
# Access is decided by Pocket ID group (`allowed_groups` in `ssoServer`)
email.domains = [ "*" ];
httpAddress = "http://127.0.0.1:4180";
reverseProxy = true;
trustedProxyIP = [ "127.0.0.1" ];
setXauthrequest = true;
cookie = {
# Host-only, so the cookie is only sent to the vhost it was issued for
secure = true;
# Sessions last a week, but Pocket ID checks the user (and their groups) every hour
expire = "168h";
refresh = "1h";
};
extraConfig = {
code-challenge-method = "S256";
skip-provider-button = true;
# Pocket ID doesn't verify email addresses, and they aren't used for access here
insecure-oidc-allow-unverified-email = true;
};
};
};
systemd.services.oauth2-proxy = {
wants = [ "pocket-id-sync.service" ];
after = [ "pocket-id-sync.service" "nginx.service" ];
};
}
@@ -29,13 +29,14 @@ in
inherit (lib.my) networkdAssignment;
in
{
imports = [ ./vhosts.nix ];
imports = [ ./auth.nix ./vhosts.nix ];
config = mkMerge [
{
my = {
deploy.enable = false;
server.enable = true;
network.bbr = true;
secrets = {
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAQM9U1e/XcUCyMJITrpAHjAGahpqkZCmtX6pJkYzuks";
@@ -53,10 +54,6 @@ in
group = "acme";
mode = "400";
};
"middleman/nginx-sso.yaml" = {
owner = "nginx-sso";
group = "nginx-sso";
};
"middleman/htpasswd" = {
owner = "nginx";
group = "nginx";
@@ -76,56 +73,6 @@ in
'';
};
nginx-sso = {
enable = true;
extraConfigFile = config.age.secrets."middleman/nginx-sso.yaml".path;
configuration = {
listen = {
addr = "[::]";
port = 8082;
};
login = {
title = "${pubDomain} login";
default_redirect = "https://${pubDomain}";
default_method = "google_oauth";
names = {
google_oauth = "Google account";
simple = "Username / password";
};
};
cookie = {
domain = ".${pubDomain}";
secure = true;
};
audit_log = {
targets = [ "fd://stdout" ];
events = [
"access_denied"
"login_success"
"login_failure"
"logout"
#"validate"
];
};
providers = {
simple = {
groups = {
admin = [ "dev" ];
};
};
google_oauth = {
client_id = "545475967061-cag4g1qf0pk33g3pdbom4v69562vboc8.apps.googleusercontent.com";
redirect_url = "https://sso.${pubDomain}/login";
user_id_method = "user-id";
};
};
};
includes = {
endpoint = "http://localhost:8082";
baseURL = "https://sso.${pubDomain}";
};
};
librespeed = {
frontend.servers = [
{
@@ -138,6 +85,8 @@ in
extraSettingsFile = config.age.secrets."librespeed.toml".path;
};
};
paseo-relay.enable = true;
};
users = {
@@ -200,6 +149,7 @@ in
extraDomainNames = [
"*.${pubDomain}"
"*.s3.${pubDomain}"
"*.slop.${pubDomain}"
];
dnsProvider = "cloudflare";
environmentFile = config.age.secrets."middleman/cloudflare-credentials.conf".path;
@@ -251,10 +201,8 @@ in
valid = "5s";
};
proxyResolveWhileRunning = true;
workerProcesses = "auto";
appendConfig = ''
worker_processes auto;
'';
# Based on recommended*Settings, but probably better to be explicit about these
appendHttpConfig = ''
${baseHttpConfig}
@@ -9,14 +9,40 @@ let
dualStackListen' = l: map (addr: l // { inherit addr; }) [ "0.0.0.0" "[::]" ];
dualStackListen = ll: flatten (map dualStackListen' ll);
ssoServer = i: {
# Gate a vhost behind oauth2-proxy, for members of any of the given Pocket ID groups. The
# session cookie is host-only, so other `.nul.ie` sites never see it; Pocket ID's own session
# makes signing in to the next gated vhost a redirect.
oauth2Proxy = config.services.oauth2-proxy.httpAddress;
ssoServer = groups: {
locations = {
"^~ /oauth2/" = {
proxyPass = oauth2Proxy;
extraConfig = ''
auth_request off;
${proxyHeaders}
# Where to return after signing in; on a 401 this is still the original request
proxy_set_header X-Auth-Request-Redirect $request_uri;
'';
};
# A literal `proxy_pass`: `proxyPass` sets `$nix_proxy_target`, which this subrequest would
# overwrite for the main request too
"= /oauth2/auth".extraConfig = ''
proxy_pass ${oauth2Proxy}/oauth2/auth?allowed_groups=${concatStringsSep "," groups};
internal;
auth_request off;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
${proxyHeaders}
'';
};
# A location with its own `add_header` would drop the refreshed cookie
extraConfig = ''
include /etc/nginx/includes/sso/server-${i}.conf;
'';
};
ssoLoc = i: {
extraConfig = ''
include /etc/nginx/includes/sso/location-${i}.conf;
auth_request /oauth2/auth;
error_page 401 = /oauth2/start;
# Pass on the session cookie when a check refreshes it
auth_request_set $sso_cookie $upstream_http_set_cookie;
add_header Set-Cookie $sso_cookie;
'';
};
@@ -38,6 +64,11 @@ let
}))
];
};
# Paseo's web app, which connects to daemons through the relay
paseoWebUi = pkgs.runCommand "paseo-web-ui-${pkgs.paseo.version}" { } ''
cp -r ${pkgs.paseo}/lib/paseo/packages/server/dist/server/web-ui "$out"
'';
wellKnown = {
"/.well-known/" = {
alias = "${wellKnownRoot}/";
@@ -53,12 +84,6 @@ let
};
in
{
my = {
nginx-sso.includes.instances = {
generic = {};
};
};
services.nginx.virtualHosts =
let
hosts = {
@@ -106,11 +131,6 @@ in
};
};
"sso.${pubDomain}" = {
locations."/".proxyPass = config.my.nginx-sso.includes.endpoint;
useACMEHost = pubDomain;
};
"netdata-colony.${pubDomain}" =
let
hosts = [
@@ -125,26 +145,23 @@ in
locations = {
"= /".return = "301 https://$host/vm/";
"~ /(?<behost>${matchHosts})$".return = "301 https://$host/$behost/";
"~ /(?<behost>${matchHosts})/(?<ndpath>.*)" = mkMerge [
{
proxyPass = "http://$behost.${domain}:19999/$ndpath$is_args$args";
extraConfig = ''
proxy_pass_request_headers on;
${proxyHeaders}
proxy_set_header Connection "keep-alive";
proxy_store off;
"~ /(?<behost>${matchHosts})/(?<ndpath>.*)" = {
proxyPass = "http://$behost.${domain}:19999/$ndpath$is_args$args";
extraConfig = ''
proxy_pass_request_headers on;
${proxyHeaders}
proxy_set_header Connection "keep-alive";
proxy_store off;
gzip on;
gzip_proxied any;
gzip_types *;
'';
}
(ssoLoc "generic")
];
gzip on;
gzip_proxied any;
gzip_types *;
'';
};
};
useACMEHost = pubDomain;
}
(ssoServer "generic")
(ssoServer [ "admins" ])
];
"pass.${pubDomain}" =
@@ -237,56 +254,40 @@ in
"torrents.${pubDomain}" = mkMerge [
{
locations."/" = mkMerge [
{
proxyPass = "http://jackflix-ctr.${domain}:9091";
}
(ssoLoc "generic")
];
locations."/".proxyPass = "http://jackflix-ctr.${domain}:9091";
useACMEHost = pubDomain;
}
(ssoServer "generic")
(ssoServer [ "admins" ])
];
"jackett.${pubDomain}" = mkMerge [
{
locations."/" = mkMerge [
{
proxyPass = "http://jackflix-ctr.${domain}:9117";
}
(ssoLoc "generic")
];
locations."/".proxyPass = "http://jackflix-ctr.${domain}:9117";
useACMEHost = pubDomain;
}
(ssoServer "generic")
(ssoServer [ "admins" ])
];
"radarr.${pubDomain}" = mkMerge [
{
locations."/" = mkMerge [
{
proxyPass = "http://jackflix-ctr.${domain}:7878";
proxyWebsockets = true;
extraConfig = proxyHeaders;
}
(ssoLoc "generic")
];
locations."/" = {
proxyPass = "http://jackflix-ctr.${domain}:7878";
proxyWebsockets = true;
extraConfig = proxyHeaders;
};
useACMEHost = pubDomain;
}
(ssoServer "generic")
(ssoServer [ "admins" ])
];
"sonarr.${pubDomain}" = mkMerge [
{
locations."/" = mkMerge [
{
proxyPass = "http://jackflix-ctr.${domain}:8989";
proxyWebsockets = true;
extraConfig = proxyHeaders;
}
(ssoLoc "generic")
];
locations."/" = {
proxyPass = "http://jackflix-ctr.${domain}:8989";
proxyWebsockets = true;
extraConfig = proxyHeaders;
};
useACMEHost = pubDomain;
}
(ssoServer "generic")
(ssoServer [ "admins" ])
];
"gib.${pubDomain}" = {
locations."/".proxyPass = "http://jackflix-ctr.${domain}:5055";
@@ -336,15 +337,6 @@ in
useACMEHost = pubDomain;
};
"share.${pubDomain}" = {
locations."/" = {
proxyPass = "http://object-ctr.${domain}:9090";
proxyWebsockets = true;
extraConfig = proxyHeaders;
};
useACMEHost = pubDomain;
};
"stuff.${pubDomain}" = {
locations."/" = {
proxyPass = "http://jackflix-ctr.${domain}:3923";
@@ -387,6 +379,75 @@ in
useACMEHost = pubDomain;
};
"paseo-relay.${pubDomain}" = {
locations = {
"/" = {
proxyPass = "http://127.0.0.1:${toString config.my.paseo-relay.port}";
proxyWebsockets = true;
extraConfig = ''
${proxyHeaders}
proxy_read_timeout 1h;
proxy_send_timeout 1h;
'';
};
"= /metrics".return = "404";
};
useACMEHost = pubDomain;
};
"slop.${pubDomain}" = {
root = paseoWebUi;
extraConfig = ''
gzip_static on;
brotli_static on;
'';
locations = {
"/".tryFiles = "$uri $uri/ /index.html";
"= /index.html".extraConfig = ''
add_header Cache-Control "no-store";
'';
"/_expo/".extraConfig = ''
add_header Cache-Control "public, max-age=31536000, immutable";
'';
};
useACMEHost = pubDomain;
};
# `slop-broker`'s approvals web app, which handles sign-in itself
"approve.slop.${pubDomain}" = {
locations."/" = {
proxyPass = "http://palace.${home.domain}:8095";
extraConfig = proxyHeaders;
};
useACMEHost = pubDomain;
};
"id.${pubDomain}" =
let
# API keys (including `pocket-id-sync`'s admin key) only work from inside
pocketIdHeaders = ''
${proxyHeaders}
proxy_set_header X-API-Key "";
'';
pocketId = {
proxyPass = "http://127.0.0.1:${toString config.services.pocket-id.settings.PORT}";
extraConfig = pocketIdHeaders;
};
in
{
locations = {
"/" = pocketId;
# Creating the first admin account is only possible from inside
"~ ^/(setup|api/signup/setup)$" = pocketId // {
extraConfig = ''
${concatStringsSep "\n" (map (n: "allow ${n};") (with lib.my.c.internalNets; v4 ++ v6))}
deny all;
${pocketIdHeaders}
'';
};
};
useACMEHost = pubDomain;
};
"md.${pubDomain}" = {
locations."/" = {
proxyPass = "http://object-ctr.${domain}:3000";
@@ -410,24 +471,18 @@ in
"pront.${pubDomain}" = mkMerge [
{
locations."/" = mkMerge [
{
proxyPass = "http://stream-hi.${home.domain}:5000";
proxyWebsockets = true;
extraConfig = proxyHeaders;
}
(ssoLoc "generic")
];
locations."~* ^/webcam/(.*)" = mkMerge [
{
proxyPass = "http://stream-hi.${home.domain}:5050/$1$is_args$args";
extraConfig = proxyHeaders;
}
(ssoLoc "generic")
];
locations."/" = {
proxyPass = "http://stream-hi.${home.domain}:5000";
proxyWebsockets = true;
extraConfig = proxyHeaders;
};
locations."~* ^/webcam/(.*)" = {
proxyPass = "http://stream-hi.${home.domain}:5050/$1$is_args$args";
extraConfig = proxyHeaders;
};
useACMEHost = pubDomain;
}
(ssoServer "generic")
(ssoServer [ "admins" ])
];
"hass.${pubDomain}" = {
locations."/" = {
@@ -22,14 +22,28 @@ in
};
};
configuration = { lib, pkgs, config, assignments, ... }:
configuration = { lib, pkgs, pkgsFlakes, config, assignments, ... }:
let
inherit (lib) mkMerge mkIf mkForce;
inherit (config.my.user.homeConfig.lib.file) mkOutOfStoreSymlink;
inherit (lib.my) networkdAssignment systemdAwaitPostgres;
# TODO: Migrate the object store and remove this MinIO compatibility pin.
minioPkgs = import pkgsFlakes.mine-stable {
inherit (pkgs.stdenv.hostPlatform) system;
config.permittedInsecurePackages = [ "minio-2025-10-15T17-29-55Z" ];
};
# Unstable reserves services.minio for its removed-option diagnostic.
minioModule = import "${pkgsFlakes.mine-stable}/nixos/modules/services/web-servers/minio.nix" {
inherit lib;
pkgs = minioPkgs;
config = config // { services = config.services // { minio = config.my.minio; }; };
};
in
{
options.my.minio = minioModule.options.services.minio;
config = mkMerge [
minioModule.config
{
fileSystems = {
"/var/lib/harmonia" = {
@@ -43,14 +57,26 @@ in
deploy.enable = false;
server.enable = true;
minio = {
enable = true;
region = "eu-central-1";
browser = true;
rootCredentialsFile = config.age.secrets."object/minio.env".path;
dataDir = [ "/mnt/minio" ];
};
tmproot.persistence.config.directories = mkIf (config.my.tmproot.persistence.dir != null) [
{
directory = config.my.minio.configDir;
user = "minio";
group = "minio";
}
];
secrets = {
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFdHbZErWLmTPO/aEWB1Fup/aGMf31Un5Wk66FJwTz/8";
files = {
"object/minio.env" = {};
"object/sharry.conf" = {
owner = "sharry";
group = "sharry";
};
"object/minio-client-config.json" = {
owner = config.my.user.config.name;
group = config.my.user.config.group;
@@ -65,7 +91,6 @@ in
firewall = {
tcp.allowed = [
9000 9001
config.services.sharry.config.bind.port
8069
5000
config.services.hedgedoc.settings.port
@@ -122,8 +147,6 @@ in
};
};
sharry = awaitPostgres;
atticd = mkMerge [
awaitPostgres
{
@@ -157,82 +180,19 @@ in
};
};
environment = {
systemPackages = with pkgs; [
minio-client
];
};
# TODO/FIXME: this is bad...
nixpkgs.config.permittedInsecurePackages = [ "minio-2025-10-15T17-29-55Z" ];
environment.systemPackages = [ minioPkgs.minio-client ];
services = {
minio = {
# `slop build` on `palace` pushes into Harmonia's store
slop-broker-cache = {
enable = true;
region = "eu-central-1";
browser = true;
rootCredentialsFile = config.age.secrets."object/minio.env".path;
dataDir = [ "/mnt/minio" ];
};
sharry = {
enable = true;
configOverridesFile = config.age.secrets."object/sharry.conf".path;
config = {
base-url = "https://share.${lib.my.c.pubDomain}";
bind.address = "::";
alias-member-enabled = true;
webapp = {
chunk-size = "64M";
};
backend = {
auth = {
fixed = {
enabled = true;
user = "dev";
};
internal = {
enabled = true;
order = 50;
};
};
jdbc = {
url = "jdbc:postgresql://colony-psql:5432/sharry";
user = "sharry";
};
files = {
default-store = "minio";
stores = {
database.enabled = false;
minio = {
enabled = true;
type = "s3";
endpoint = "https://s3.nul.ie";
access-key = "share";
bucket = "share";
};
};
};
compute-checksum.parallel = 4;
signup.mode = "invite";
share = {
max-size = "128G";
max-validity = "3650 days";
};
mail = {
enabled = true;
smtp = {
host = "mail.nul.ie";
port = 587;
user = "sharry@nul.ie";
ssl-type = "starttls";
default-from = "Sharry <sharry@nul.ie>";
timeout = "30 seconds";
};
};
};
};
user = "harmonia";
store = "/var/lib/harmonia";
# As `ci/push-to-cache.sh` does; `harmonia-dev`'s runtime directory
home = "/run/harmonia";
brokerKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJMx9rrKaPGFnwdvdEKCHyonMjWi/kDWMkbZkSEHijhp slop-broker cache (palace)"
];
};
atticd = {
@@ -308,7 +268,6 @@ in
forwardPorts = [
{ from = "host"; host.port = 9000; guest.port = 9000; }
{ from = "host"; host.port = 9001; guest.port = 9001; }
{ from = "host"; guest.port = config.services.sharry.config.bind.port; }
];
};
})
+1
View File
@@ -166,6 +166,7 @@ in
my = {
secrets.key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ6bc1pQCYalLXdB4X+7kFXtkTdFalbH5rchjuYj2ceU";
server.enable = true;
network.bbr = true;
firewall = {
tcp.allowed = [ 19999 ];
@@ -162,6 +162,7 @@ in
my = {
secrets.key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDBTIj1jVdknXLNNroMJfgy7S2cSUC/qgFdnaUopEUzZ";
server.enable = true;
network.bbr = true;
firewall = {
tcp.allowed = [ 19999 ];
+9 -5
View File
@@ -2,24 +2,28 @@
let
inherit (lib) concatStringsSep;
inherit (lib.my) dockerNetAssignment;
admin = "76561198049818986"; # /dev/player0
in
{
config = {
virtualisation.oci-containers.containers = {
valheim = {
image = "ghcr.io/lloesche/valheim-server@sha256:d977ccbeff02d2509646fb0157b5e353ebadb3105a3ed351b9c309a09a61701b";
image = "ghcr.io/community-valheim-tools/valheim-server@sha256:f3ccde9a4e292663cf5096d502ff33cc9617015f6d70b6a9ca0968543f165ef2";
environment = {
BACKUPS_IF_IDLE = "false";
SERVER_NAME = "amogus sus";
SERVER_PUBLIC = "true";
WORLD_NAME = "simpland2";
ADMINLIST_IDS = "76561198049818986";
# Previous world: simpland2
WORLD_NAME = "simpland3";
ADMINLIST_IDS = admin;
PERMITTEDLIST_IDS = concatStringsSep " " [
"76561198049818986" # /dev/player0
admin
"76561198044432445" # Nuda
"76561198121606266" # El Pugador
"76561198059894566" # hynge
"76561198818857736" # Quad
];
TZ = "Europe/Dublin";
};
@@ -27,7 +31,7 @@ in
volumes = [
"valheim_data:/config"
"valhem_server:/opt/valheim"
"valheim_server:/opt/valheim"
];
extraOptions = [
+17
View File
@@ -198,6 +198,9 @@ in
];
"45-lan-lo" = {
matchConfig.Name = "lan-lo";
# The parent carries hi's jumbo frames, but lo runs at the standard MTU;
# without this the VLAN would inherit the parent's larger one.
linkConfig.MTUBytes = "1500";
networkConfig = {
DHCP = "ipv4";
IPv6AcceptRA = true;
@@ -218,6 +221,7 @@ in
my = {
tmproot.size = "24G";
network.bbr = true;
user = {
config.extraGroups = [ "input" ];
@@ -238,6 +242,19 @@ in
claude-code = {
enable = true;
};
# Try `slop-broker` from here; both keys are generated locally
slop = {
host = "palace.${domain}";
request = {
enable = true;
keyFile = "~/.ssh/slop-castle-request";
};
approve = {
enable = true;
keyFile = "~/.ssh/slop-castle-approve";
};
};
};
services = {
+44 -15
View File
@@ -5,7 +5,7 @@ let
inherit (lib.my.c.home) domain vlans prefixes vips vlanDns hiMTU;
in
{
imports = [ ./vms ];
imports = [ ./slop-broker.nix ./vms ];
nixos.systems.palace = {
system = "x86_64-linux";
@@ -53,10 +53,12 @@ in
};
};
});
kernelModules = [ "dm-raid" "kvm-amd" ];
kernelModules = [ "dm-raid" "kvm-amd" "nvme-rdma" ];
kernelParams = [ "amd_iommu=on" ];
initrd = {
availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "sr_mod" ];
# LVM autoactivation can discover the RAID LVs before stage-two module loading.
kernelModules = [ "dm-raid" ];
};
};
@@ -83,6 +85,13 @@ in
};
};
# NVMe-oF disks connected here belong to guests (`palace` has no NVMe of its own; its
# drives are passed to `cellar`); never activate their volume groups. No accept pattern:
# LVM accepts a device if any of its other names (`/dev/disk/by-*`) is accepted.
environment.etc."lvm/lvm.conf".text = ''
devices/global_filter = [ "r|^/dev/nvme|" ]
'';
services = {
lvm = {
boot.thin.enable = true;
@@ -94,7 +103,7 @@ in
extraOptions = [ "-A /var/log/smartd/" "--interval=600" ];
};
udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="net", ENV{ID_NET_DRIVER}=="mlx5_core", ENV{ID_PATH}=="pci-0000:44:00.0", ATTR{device/sriov_numvfs}="4"
ACTION=="add", SUBSYSTEM=="net", ENV{ID_NET_DRIVER}=="mlx5_core", ENV{ID_PATH}=="pci-0000:44:00.0", ATTR{device/sriov_numvfs}="6"
'';
};
@@ -119,24 +128,24 @@ in
network = {
links = {
"10-et1g0" = {
"10-river-jim-phy" = {
matchConfig = {
PermanentMACAddress = "e0:d5:5e:68:0c:6e";
Driver = "igb";
};
linkConfig.Name = "et1g0";
linkConfig.Name = "river-jim-phy";
};
"10-lan-core-phy" = {
"10-host-jim" = {
matchConfig.PermanentMACAddress = "e0:d5:5e:68:0c:70";
linkConfig.Name = "lan-core-phy";
linkConfig.Name = "host-jim";
};
"10-et100g" = {
"10-uplink-dave" = {
matchConfig = {
PermanentMACAddress = "24:8a:07:ac:59:c0";
Driver = "mlx5_core";
};
linkConfig = {
Name = "et100g";
Name = "uplink-dave";
MTUBytes = toString hiMTU;
};
};
@@ -169,8 +178,8 @@ in
}
];
"50-et100g" = {
matchConfig.Name = "et100g";
"50-uplink-dave" = {
matchConfig.Name = "uplink-dave";
vlan = [ "lan-hi" ];
networkConfig = networkd.noL3;
linkConfig.RequiredForOnline = "no";
@@ -182,9 +191,10 @@ in
LinkState=yes
MACAddress=52:54:00:cc:3e:70
# river
# river RDMA
[SR-IOV]
VirtualFunction=1
VLANId=${toString vlans.hi}
LinkState=yes
MACAddress=52:54:00:8a:8a:f2
@@ -195,12 +205,28 @@ in
LinkState=yes
MACAddress=52:54:00:ac:15:a9
# sfh bridge
# sfh containers
[SR-IOV]
VirtualFunction=3
VLANId=${toString vlans.hi}
LinkState=yes
MACAddress=52:54:00:90:34:95
# river LAN trunk
[SR-IOV]
VirtualFunction=4
LinkState=auto
MACAddress=52:54:00:8a:8a:f4
Trust=yes
MACSpoofCheck=no
# slop-cannon (untrusted)
[SR-IOV]
VirtualFunction=5
VLANId=${toString vlans.untrusted}
LinkState=auto
MACAddress=52:54:00:71:22:ea
MACSpoofCheck=yes
'';
};
"60-lan-hi" = mkMerge [
@@ -208,8 +234,8 @@ in
{ networkConfig = vlanDns "hi"; }
];
"50-lan-core-phy" = {
matchConfig.Name = "lan-core-phy";
"50-host-jim" = {
matchConfig.Name = "host-jim";
networkConfig = {
Bridge = "lan-core";
} // networkd.noL3;
@@ -236,6 +262,9 @@ in
server.enable = true;
deploy.node.hostname = "192.168.68.22";
# Host NQN for guest disks on `cellar`; nothing on `palace` itself boots from it
nvme.uuid = "a5b573fe-59e0-4760-802d-4b6d2df6dcf2";
};
};
};
+187
View File
@@ -0,0 +1,187 @@
{
nixos.systems.palace.configuration = { lib, config, allAssignments, ... }:
let
inherit (lib) mapAttrs fileContents;
# `slop-cannon`'s vsock address; the kernel reports it for every connection from the guest
slopCannonCid = 3;
# Home's pair, and colony's
routers = [ "river" "stream" "estuary" ];
middleman = allAssignments.middleman.internal;
webPort = config.services.slop-broker.web.port;
in
{
my = {
secrets.files = {
"palace/slop-broker-deploy.key" = {
owner = "root";
mode = "0400";
};
# Pushes `slop build` outputs into Harmonia's store on `object`
"palace/slop-broker-cache.key" = {
owner = "root";
mode = "0400";
};
# The approvals web app's client secret at Pocket ID
"palace/slop-broker-oidc-secret" = {
owner = "root";
mode = "0400";
};
# The broker's age identity, a recipient of every secret (`.keys/slop-broker.pub`)
"palace/slop-broker-age.key" = {
owner = "root";
mode = "0400";
};
# Read-only deploy key for `dev/nixfiles` on Gitea
"palace/slop-broker-git.key" = {
owner = "slop-broker-build";
group = "slop-broker-build";
mode = "0400";
};
};
vms.instances.slop-cannon.qemuFlags = [ "device vhost-vsock-pci,guest-cid=${toString slopCannonCid}" ];
# Builds and the builder run agent-written Nix, so like `lan-untrusted` they only get the
# Internet (and `resolved`'s stub, which builds use for DNS)
firewall.extraRules = ''
table inet filter {
chain agent-builds {
ct state established,related return
ip daddr 127.0.0.53 meta l4proto { tcp, udp } th dport 53 return
${lib.my.c.internalNets.nftReject}
}
chain output {
meta skgid ${toString config.ids.gids.nixbld} jump agent-builds
meta skuid slop-broker-build jump agent-builds
}
# Only `middleman`, which publishes it, may reach the web app; `input` (not `wan-tcp`, which
# ends in `return`) gets these after everything else
chain input {
ip saddr ${middleman.ipv4.address} tcp dport ${toString webPort} accept
ip6 saddr ${middleman.ipv6.address} tcp dport ${toString webPort} accept
}
}
'';
};
# Builds commits for `slop deploy` and `slop build`, as a user without keys; reached over SSH
# like a separate box
services.slop-broker-builder = {
enable = true;
repository = "git@git.nul.ie:dev/nixfiles.git";
keyFile = config.age.secrets."palace/slop-broker-git.key".path;
brokerKeys = [ (lib.trim (builtins.readFile lib.my.c.sshKeyFiles.deploy)) ];
};
services.slop-broker = {
enable = true;
timeout = "45m";
approvers = [ config.my.user.config.name ];
# For coding agents, wherever they run
policies.agent.ops = {
# Fixed read-only commands built by the broker
query.action = "auto";
# Running agent-written Nix at all; approvers see the commits and diff. Commits already
# on `master` have been reviewed.
builder = {
action = "ask";
leases = [ "1h" ];
rules = [
{
match.on_branch = "true";
action = "auto";
}
];
};
deploy = {
action = "ask";
# The routers carry everything else; a bad deploy there is hard to reach and undo
rules = map
(node: {
match.node = node;
action = "ask";
confirm = "passkey";
})
routers;
};
# The source was reviewed for `builder`, and the cache only gets what `palace` built
build.action = "auto";
ssh = {
action = "ask";
leases = [ "5m" "1h" ];
};
# Approvals show whether the file and its recipients match `master`; reading always asks
secret = {
action = "ask";
leases = [ "5m" ];
rules = [
{
match.action = "keys";
action = "auto";
}
];
};
};
requesters.slop-cannon = {
vsockCid = slopCannonCid;
policy = "agent";
};
# Agents on `castle` connecting over SSH
requesters.castle = {
sshKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINY4Znri43VCA0gJYBbO9g72OsN3xnMYbMZ79G5tAZnr slop requester (castle)"
];
policy = "agent";
};
# Answering requests from `castle` over SSH
sshApprovers.castle = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAnv2y4uuABxHtk2iXhKe67W8jRIJcLrDVt9/LQaG14l slop approver (castle)" ];
ssh = {
enable = true;
keyFile = config.age.secrets."palace/slop-broker-deploy.key".path;
};
deploy.enable = true;
cache = {
enable = true;
hostname = "object-ctr.${lib.my.c.colony.domain}";
user = "harmonia";
keyFile = config.age.secrets."palace/slop-broker-cache.key".path;
};
# Checked against `master`'s `secrets.nix`, which only people can push to
secrets = {
enable = true;
identityFile = config.age.secrets."palace/slop-broker-age.key".path;
names = mapAttrs (_: fileContents) lib.my.c.ageKeyFiles;
};
# `approve.slop.nul.ie`, published by `middleman`; approvers sign in with Pocket ID
web = {
enable = true;
address = "::";
url = "https://approve.slop.${lib.my.c.pubDomain}";
issuer = "https://id.${lib.my.c.pubDomain}";
clientSecretFile = config.age.secrets."palace/slop-broker-oidc-secret".path;
};
};
# The ruleset check runs where `slop-broker-build` doesn't exist
networking.nftables.preCheckRuleset = ''
sed 's/skuid slop-broker-build/skuid nobody/g' -i ruleset.conf
'';
# Builds share the host with the VMs, including the router; keep them from starving those
systemd.services.nix-daemon.serviceConfig = {
MemoryHigh = "32G";
MemoryMax = "40G";
CPUWeight = 20;
};
};
}
+27 -10
View File
@@ -14,15 +14,8 @@ in
spdk = {
enable = true;
extraArgs = "--mem-channels 2 --cpumask 0xffff";
debugCommands = ''
spdk-rpc bdev_nvme_attach_controller -t pcie -a 02:00.0 -b NVMe0
spdk-rpc bdev_nvme_attach_controller -t pcie -a 03:00.0 -b NVMe1
spdk-rpc bdev_nvme_attach_controller -t pcie -a 04:00.0 -b NVMe2
spdk-rpc bdev_raid_create -n NVMeRaid -z 64 -r 0 -b 'NVMe0n1 NVMe1n1 NVMe2n1'
spdk-rpc ublk_create_target
spdk-rpc ublk_start_disk NVMeRaid 1
'';
# `spdk-debug` exposes the RAID as /dev/ublkb1 (e.g. to edit its partition table)
debug.ublkDisks = [ "NVMeRaid" ];
config.subsystems =
let
nvmeAttaches = mapAttrsToList (name: bdf: {
@@ -82,6 +75,18 @@ in
];
in
{
# Sized with `scripts/calc-iobuf.py` for the 16-core mask: the bdev and accel caches
# plus the RDMA transport's, with headroom for in-flight I/O
iobuf = [
{
method = "iobuf_set_options";
params = {
small_pool_count = 16384;
large_pool_count = 2048;
};
}
];
scheduler = [
{
method = "framework_set_scheduler";
@@ -114,7 +119,12 @@ in
nvmf = [
{
method = "nvmf_create_transport";
params.trtype = "RDMA";
params = {
trtype = "RDMA";
# The default takes whatever the shared pool has left, starving the other caches
iobuf_small_cache_size = 32;
iobuf_large_cache_size = 32;
};
}
(nvmfListener "nqn.2014-08.org.nvmexpress.discovery")
] ++ (nvmfBdev {
@@ -135,6 +145,13 @@ in
hostnqn =
"nqn.2014-08.org.nvmexpress:uuid:85d7df36-0de0-431b-b06e-51f7c0a455b4";
serial = "SPDK00000000000003";
}) ++ (nvmfBdev {
# `slop-cannon`'s disk; `palace` connects it and hands it to the VM
bdev = "NVMeRaidp4";
nqn = "nqn.2016-06.io.spdk:slop-cannon";
hostnqn =
"nqn.2014-08.org.nvmexpress:uuid:a5b573fe-59e0-4760-802d-4b6d2df6dcf2";
serial = "SPDK00000000000004";
});
};
};
+95 -17
View File
@@ -3,13 +3,16 @@
./cellar
./river.nix
./sfh
./slop-cannon.nix
];
nixos.systems.palace.configuration = { lib, pkgs, config, systems, allAssignments, ... }:
let
inherit (lib) mkMerge;
inherit (config.my.nvme) uuid;
inherit (lib.my) vm;
inherit (lib.my.c) networkd;
inherit (lib.my.c.home) hiMTU;
installerDisk = {
name = "installer";
@@ -24,14 +27,22 @@
bootindex = 1;
};
};
# `slop-cannon`'s disk: a partition of `cellar`'s RAID, connected here so the guest never
# speaks NVMe-oF itself
slopDisk = {
nqn = "nqn.2016-06.io.spdk:slop-cannon";
device = "/dev/disk/by-id/nvme-SPDK_bdev_Controller_SPDK00000000000004";
};
in
{
systemd.network = {
netdevs = {
"25-vm-et1g0" = {
"25-river-jim-tap" = {
netdevConfig = {
Name = "vm-et1g0";
Name = "river-jim-tap";
Kind = "macvtap";
MTUBytes = toString hiMTU;
};
# TODO: Upstream this missing section
extraConfig = ''
@@ -41,16 +52,24 @@
};
};
networks = {
"75-et1g0" = {
matchConfig.Name = "et1g0";
linkConfig.RequiredForOnline = "no";
"75-river-jim-phy" = {
matchConfig.Name = "river-jim-phy";
linkConfig = {
RequiredForOnline = "no";
MTUBytes = toString hiMTU;
};
networkConfig = {
MACVTAP = "vm-et1g0";
MACVTAP = "river-jim-tap";
} // networkd.noL3;
};
"75-vm-et1g0" = {
matchConfig.Name = "vm-et1g0";
linkConfig.RequiredForOnline = "no";
"75-river-jim-tap" = {
matchConfig.Name = "river-jim-tap";
linkConfig = {
RequiredForOnline = "no";
MTUBytes = toString hiMTU;
# Guest receive-filter changes are not synchronized to the host macvtap.
AllMulticast = true;
};
networkConfig = networkd.noL3;
};
};
@@ -79,7 +98,7 @@
"vm@river" =
let
vtapUnit = "sys-subsystem-net-devices-vm\\x2det1g0.device";
vtapUnit = "sys-subsystem-net-devices-river\\x2djim\\x2dtap.device";
in
mkMerge [
(awaitVM "cellar")
@@ -89,6 +108,38 @@
}
];
"vm@sfh" = (awaitVM "river");
# Only `vm@slop-cannon` needs this; stops before `cellar` does, and gives up on a dead
# target rather than hanging I/O on `palace`
slop-cannon-disk = mkMerge [
(awaitVM "cellar")
{
description = "Connect slop-cannon's NVMe-oF disk";
path = with pkgs; [ nvme-cli systemd ];
script = ''
until nvme connect -t rdma -a ${allAssignments.cellar.hi.ipv4.address} -s 4420 \
-n ${slopDisk.nqn} -q nqn.2014-08.org.nvmexpress:uuid:${uuid} --ctrl-loss-tmo 60; do
sleep 5
done
udevadm wait --timeout 30 ${slopDisk.device}
'';
preStop = ''
nvme disconnect -n ${slopDisk.nqn}
'';
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
TimeoutStartSec = "5min";
};
}
];
"vm@slop-cannon" = {
requires = [ "slop-cannon-disk.service" ];
bindsTo = [ "slop-cannon-disk.service" ];
after = [ "slop-cannon-disk.service" ];
# Coding agents; keep storage and the router responsive
serviceConfig.CPUWeight = 20;
};
};
my = {
@@ -109,7 +160,7 @@
(vm.disk "cellar" "persist")
];
hostDevices = {
et100g0vf0 = {
cellar-hi = {
index = 0;
hostBDF = "44:00.1";
};
@@ -142,8 +193,8 @@
memory = 4096;
cleanShutdown.timeout = 60;
networks = {
et1g0 = {
ifname = "vm-et1g0";
lan-jim = {
ifname = "river-jim-tap";
bridge = null;
tapFD = 100;
# Real hardware MAC
@@ -156,10 +207,14 @@
(mkMerge [ (vm.disk "river" "esp") { frontendOpts.bootindex = 0; } ])
];
hostDevices = {
et100g0vf1 = {
river-rdma = {
index = 0;
hostBDF = "44:00.2";
};
river-dave = {
index = 1;
hostBDF = "44:00.5";
};
};
};
@@ -175,13 +230,14 @@
networks = {
netboot = {
bridge = "lan-lo";
ifname = "sfh-lo-tap";
waitOnline = "carrier";
mac = "52:54:00:a5:7e:93";
extraOptions.bootindex = 1;
};
core = {
bridge = "lan-core";
ifname = "vm-sfh-core";
ifname = "sfh-core-tap";
waitOnline = "carrier";
mac = "52:54:00:72:67:51";
};
@@ -190,11 +246,11 @@
(vm.lvmDisk' "hdds" "frigate")
];
hostDevices = {
et100g0vf2 = {
sfh-hi = {
index = 0;
hostBDF = "44:00.3";
};
et100g0vf3 = {
sfh-ctrs = {
index = 1;
hostBDF = "44:00.4";
};
@@ -207,6 +263,28 @@
"device usb-host,hostbus=1,hostport=3"
];
};
slop-cannon = {
uuid = "9de7dc84-7506-445f-8e37-37c4cc6d8ed5";
cpu = "host,topoext";
# Overcommitted so agents can burst; `vm@slop-cannon` has a low CPU weight
smp = {
cpus = 16;
threads = 2;
};
memory = 24576;
cleanShutdown.timeout = 120;
drives = [
installerDisk
(mkMerge [ (vm.blockDisk "disk" slopDisk.device) { frontendOpts.bootindex = 0; } ])
];
hostDevices = {
slop-cannon-ut = {
index = 0;
hostBDF = "44:00.6";
};
};
};
};
};
};
+90 -30
View File
@@ -1,3 +1,8 @@
{ lib, ... }:
let
inherit (lib.my) net;
inherit (lib.my.c.home) domain prefixes hiMTU;
in
{
imports = [ (import ../../routing-common 0) ];
@@ -6,6 +11,17 @@
nixpkgs = "mine";
home-manager = "mine";
assignments.rdma = {
name = "river-rdma";
inherit domain;
mtu = hiMTU;
ipv4 = {
address = net.cidr.host 3 prefixes.hi.v4;
mask = 32;
gateway = null;
};
};
configuration = { lib, modulesPath, pkgs, config, assignments, allAssignments, ... }:
let
inherit (builtins) elemAt;
@@ -14,11 +30,11 @@
inherit (lib.my.c) networkd;
inherit (lib.my.c.home) vlans domain prefixes roceBootModules routersPubV4;
# river reaches the ONT over its 100G `lan` uplink to the dave switch (which downlinks to
# brian, where the ONT lands). Digiweb delivers the ISP VLAN (pon-isp, 10) single-tagged at
# the ONT alongside the ONT's untagged management traffic. With a single ONT there's no VLAN
# collision, so the switches simply trunk the ISP's VLAN 10 straight through to river (PPPoE
# runs directly on it) and PVID the ONT's untagged management port onto wan-pon-ont (140).
# river reaches the ONT through its RSTP `lan` bridge, normally over `lan-dave`. Digiweb
# delivers the ISP VLAN (pon-isp, 10) single-tagged at the ONT alongside the ONT's untagged
# management traffic. With a single ONT there's no VLAN collision, so the switches simply
# trunk the ISP's VLAN 10 straight through to river (PPPoE runs directly on it) and PVID the
# ONT's untagged management port onto wan-pon-ont (140).
# river takes .100 in the ONT's /24 (matching stream's modem-mgmt .100) to reach its web
# UI at 192.168.100.1. (See docs/sites/home/switches.md for the switch side and the multi-ONT plan.)
ontV4 = net.cidr.host 100 prefixes.ont.v4;
@@ -35,24 +51,36 @@
boot = {
kernelModules = [ "kvm-amd" ];
kernelParams = [ "console=ttyS0,115200n8" ];
kernel.sysctl = {
# Keep storage and router addresses on their own interfaces on the shared L2 network.
"net.ipv4.conf.rdma-hi.arp_ignore" = 1;
"net.ipv4.conf.lan-hi.arp_ignore" = 1;
"net.ipv4.conf.rdma-hi.arp_announce" = 2;
"net.ipv4.conf.lan-hi.arp_announce" = 2;
};
initrd = {
availableKernelModules = [
"virtio_pci" "ahci" "sr_mod" "virtio_blk"
"8021q"
] ++ roceBootModules;
kernelModules = [ "dm-snapshot" ];
systemd = {
network = {
# Don't need to put the link config here, they're copied from main config
netdevs = mkVLAN "lan-hi" vlans.hi;
# NixOS copies the main system's .link units into the systemd initrd, so the
# rdma-hi rename is already available here. It does not copy .network units.
networks = {
"20-lan" = {
matchConfig.Name = "lan";
vlan = [ "lan-hi" ];
linkConfig.RequiredForOnline = "no";
networkConfig = networkd.noL3;
};
"30-lan-hi" = networkdAssignment "lan-hi" assignments.hi;
"20-rdma-hi" = mkMerge [
(networkdAssignment "rdma-hi" assignments.rdma)
{
networkConfig.IPv6AcceptRA = mkForce false;
routes = [
{
Destination = "${allAssignments.cellar.hi.ipv4.address}/32";
PreferredSource = assignments.rdma.ipv4.address;
Scope = "link";
}
];
}
];
};
};
};
@@ -86,9 +114,6 @@
};
fstrim.enable = true;
# TODO: re-enable once scheduling is tested
networkd-dispatcher.enable = mkForce false;
pppd = {
enable = true;
peers.digiweb = {
@@ -118,8 +143,8 @@
};
};
# PPPoE WAN (Digiweb): pppd owns the `wan` interface on top of wan-pon-isp (the switch's
# swap of the ISP's VLAN 10), and its ip-up/ip-down hooks toggle the shared
# PPPoE WAN (Digiweb): pppd owns the `wan` interface on top of wan-pon-isp (the ISP's
# VLAN 10, trunked untranslated), and its ip-up/ip-down hooks toggle the shared
# wan-online.target. Nothing else Wants the target, so it stays inactive until the link
# is actually up.
systemd.targets.wan-online.unitConfig.DefaultDependencies = false;
@@ -159,10 +184,18 @@
(mkVLAN "wan-pon-ont" vlans.wan-pon-ont)
# The ISP VLAN is trunked through untranslated, so this is the raw pon-isp (10)
(mkVLAN "wan-pon-isp" vlans.pon-isp)
{
# The adapter's local switching must recognize the router's destination MAC.
"25-lan".netdevConfig = {
Name = "lan";
Kind = "bridge";
MACAddress = "52:54:00:8a:8a:f4";
};
}
];
links = {
"10-wan-old" = {
"10-lan-jim" = {
matchConfig = {
# Matching against MAC address seems to break VLAN interfaces
# (since they share the same MAC address)
@@ -170,34 +203,61 @@
PermanentMACAddress = "e0:d5:5e:68:0c:6e";
};
linkConfig = {
Name = "wan-old";
Name = "lan-jim";
RxBufferSize = 4096;
TxBufferSize = 4096;
MTUBytes = toString lib.my.c.home.hiMTU;
};
};
"10-lan" = {
"10-rdma-hi" = {
matchConfig = {
Driver = "mlx5_core";
PermanentMACAddress = "52:54:00:8a:8a:f2";
};
linkConfig = {
Name = "lan";
Name = "rdma-hi";
MTUBytes = toString lib.my.c.home.hiMTU;
};
};
"10-lan-dave" = {
matchConfig = {
Driver = "mlx5_core";
PermanentMACAddress = "52:54:00:8a:8a:f4";
};
linkConfig = {
Name = "lan-dave";
MTUBytes = toString lib.my.c.home.hiMTU;
};
};
};
networks = {
"30-rdma-hi" = mkMerge [
(networkdAssignment "rdma-hi" assignments.rdma)
{
networkConfig = {
IPv6AcceptRA = mkForce false;
# Keep the address and route established in the initrd: dropping either while
# stage 2 networkd takes over would interrupt the mounted NVMe-oF root.
KeepConfiguration = "static";
};
routes = [
{
Destination = "${allAssignments.cellar.hi.ipv4.address}/32";
PreferredSource = assignments.rdma.ipv4.address;
Scope = "link";
}
];
}
];
"55-lan" = {
# both WAN VLANs arrive single-tagged on the 100G uplink to dave: wan-pon-ont (140,
# the ONT's management, PVID-tagged at the brian edge) and the ISP's VLAN 10, trunked
# straight through
# Both WAN VLANs arrive single-tagged on the RSTP bridge: wan-pon-ont (140, the ONT's
# management, PVID-tagged at the brian edge) and the ISP's VLAN 10, trunked straight
# through.
vlan = [ "wan-pon-ont" "wan-pon-isp" ];
};
# So we don't drop the IP we use to connect to NVMe-oF!
"60-lan-hi".networkConfig.KeepConfiguration = "static";
# ONT management: the brian edge PVIDs the ONT's untagged port onto wan-pon-ont, so give
# ourselves an address in its /24 to reach the ONT's web UI at 192.168.100.1.
"70-wan-pon-ont" = {
@@ -42,13 +42,14 @@ in
};
};
configuration = { lib, config, pkgs, assignments, allAssignments, ... }:
configuration = { lib, config, pkgs, assignments, ... }:
let
inherit (lib) mkMerge mkIf mkForce;
inherit (lib.my) networkdAssignment;
hassPort = 8123;
hassCli = pkgs.writeShellScriptBin "hass-cli" ''
export HASS_SERVER="http://localhost:${toString config.services.home-assistant.config.http.server_port}"
export HASS_SERVER="http://localhost:${toString hassPort}"
export HASS_TOKEN="$(< ${config.age.secrets."hass/cli-token.txt".path})"
exec ${pkgs.home-assistant-cli}/bin/hass-cli "$@"
'';
@@ -69,7 +70,7 @@ in
};
firewall = {
tcp.allowed = [ "http" 1883 ];
tcp.allowed = [ "http" hassPort 1883 ];
};
};
@@ -112,7 +113,7 @@ in
"rtsp://admin:@reolink-living-room:554/h264Preview_01_main"
];
webcam_office = [
"ffmpeg:device?video=/dev/video0&video_size=1024x576#video=h264"
"ffmpeg:device?video=/dev/hass-webcam/video0&video_size=1024x576#video=h264"
];
};
};
@@ -142,7 +143,8 @@ in
};
record = {
enabled = true;
retain.days = 1;
continuous.days = 1;
motion.days = 0;
};
};
@@ -157,36 +159,15 @@ in
detect.enabled = false;
record = {
enabled = true;
retain.days = 1;
continuous.days = 1;
motion.days = 0;
};
};
};
};
};
home-assistant =
let
cfg = config.services.home-assistant;
pyirishrail = ps: ps.buildPythonPackage rec {
pname = "pyirishrail";
version = "0.0.2";
src = pkgs.fetchFromGitHub {
owner = "ttroy50";
repo = "pyirishrail";
tag = version;
hash = "sha256-NgARqhcXP0lgGpgBRiNtQaSn9JcRNtCcZPljcL7t3Xc=";
};
dependencies = with ps; [
requests
];
pyproject = true;
build-system = [ ps.setuptools ];
};
in
{
home-assistant = {
enable = true;
extraComponents = [
@@ -208,7 +189,6 @@ in
isal
gtts
(pyirishrail python3Packages)
];
customComponents = with pkgs.home-assistant-custom-components; [
alarmo
@@ -217,7 +197,6 @@ in
];
configWritable = false;
openFirewall = true;
config = {
default_config = {};
homeassistant = {
@@ -227,16 +206,10 @@ in
country = "IE";
time_zone = "Europe/Dublin";
external_url = "https://hass.${pubDomain}";
internal_url = "http://hass-ctr.${domain}:${toString cfg.config.http.server_port}";
};
http = {
use_x_forwarded_for = true;
trusted_proxies = with allAssignments.middleman.internal; [
ipv4.address
ipv6.address
];
ip_ban_enabled = false;
internal_url = "http://hass-ctr.${domain}:${toString hassPort}";
};
# HTTP settings (port, trusted proxies) are managed in the UI; Home Assistant ignores
# an `http` block here once it has migrated it to `.storage/http`.
automation = "!include automations.yaml";
script = "!include scripts.yaml";
scene = "!include scenes.yaml";
+28 -20
View File
@@ -105,29 +105,29 @@ in
MTUBytes = toString lib.my.c.home.hiMTU;
};
};
"10-lan-hi-ctrs" = {
"10-ctrs-hi" = {
matchConfig = {
Driver = "mlx5_core";
PermanentMACAddress = "52:54:00:90:34:95";
};
linkConfig = {
Name = "lan-hi-ctrs";
Name = "ctrs-hi";
MTUBytes = toString lib.my.c.home.hiMTU;
};
};
"10-lan-core-ctrs" = {
"10-ctrs-core" = {
matchConfig = {
Driver = "virtio_net";
PermanentMACAddress = "52:54:00:72:67:51";
};
linkConfig.Name = "lan-core-ctrs";
linkConfig.Name = "ctrs-core";
};
"10-lan-lo-ctrs" = {
"10-ctrs-lo" = {
matchConfig = {
Driver = "virtio_net";
PermanentMACAddress = "52:54:00:a5:7e:93";
};
linkConfig.Name = "lan-lo-ctrs";
linkConfig.Name = "ctrs-lo";
};
};
@@ -139,18 +139,18 @@ in
networkConfig = vlanDns "hi" // { KeepConfiguration = "static"; };
}
];
"30-lan-hi-ctrs" = {
matchConfig.Name = "lan-hi-ctrs";
"30-ctrs-hi" = {
matchConfig.Name = "ctrs-hi";
linkConfig.RequiredForOnline = "no";
networkConfig = networkd.noL3;
};
"30-lan-core-ctrs" = {
matchConfig.Name = "lan-core-ctrs";
"30-ctrs-core" = {
matchConfig.Name = "ctrs-core";
linkConfig.RequiredForOnline = "no";
networkConfig = networkd.noL3;
};
"30-lan-lo-ctrs" = {
matchConfig.Name = "lan-lo-ctrs";
"30-ctrs-lo" = {
matchConfig.Name = "ctrs-lo";
linkConfig.RequiredForOnline = "no";
networkConfig = networkd.noL3;
};
@@ -160,21 +160,26 @@ in
systemd.nspawn = {
hass = {
networkConfig = {
MACVLAN = mkForce "lan-hi-ctrs:host0 lan-lo-ctrs:lan-lo";
MACVLAN = mkForce "ctrs-hi:host0 ctrs-lo:lan-lo";
};
};
unifi = {
networkConfig = {
MACVLAN = mkForce "lan-hi-ctrs:host0 lan-core-ctrs:lan-core";
MACVLAN = mkForce "ctrs-hi:host0 ctrs-core:lan-core";
};
};
};
systemd.services = {
"systemd-nspawn@hass".serviceConfig.DeviceAllow = [
"char-ttyUSB rw"
"char-video4linux rw"
];
"systemd-nspawn@hass".serviceConfig = {
DeviceAllow = [
"char-ttyUSB rw"
"char-video4linux rw"
];
# Pass an empty directory to nspawn when the webcam is absent.
RuntimeDirectory = "hass-webcam";
BindPaths = [ "-/dev/video0:/run/hass-webcam/video0" ];
};
};
my = {
@@ -205,7 +210,10 @@ in
readOnly = false;
};
"/dev/bus/usb/001/002".readOnly = false;
"/dev/video0".readOnly = false;
"/run/hass-webcam" = {
mountPoint = "/dev/hass-webcam";
readOnly = false;
};
"/dev/serial/by-id/usb-Nabu_Casa_Home_Assistant_Connect_ZBT-1_ce549704fe38ef11a2c2e5d154516304-if00-port0" = {
readOnly = false;
mountPoint = "/dev/ttyUSB0";
@@ -217,7 +225,7 @@ in
mkMerge [
instances
(mapAttrs (n: i: {
networking.macVLAN = "lan-hi-ctrs";
networking.macVLAN = "ctrs-hi";
}) instances)
];
};
+376
View File
@@ -0,0 +1,376 @@
{ lib, ... }:
let
inherit (lib.my) net;
inherit (lib.my.c.home) domain prefixes vips;
in
{
nixos.systems.slop-cannon = {
system = "x86_64-linux";
nixpkgs = "mine";
home-manager = "mine";
# The routers limit traffic from the untrusted VLAN to the Internet
assignments.untrusted = {
inherit domain;
mtu = prefixes.untrusted.mtu;
ipv4 = {
address = net.cidr.host 5 prefixes.untrusted.v4;
mask = 24;
gateway = vips.untrusted.v4;
};
ipv6 = {
iid = "::5";
address = net.cidr.host 5 prefixes.untrusted.v6;
};
};
configuration = { lib, modulesPath, config, pkgs, assignments, ... }:
let
inherit (builtins) toJSON;
inherit (lib) mkMerge;
inherit (lib.my) networkdAssignment;
agentUser = "slop-cannon";
agentHome = "/home/${agentUser}";
# The bot user's access token, for Git over HTTPS and Gitea's API
giteaToken = config.age.secrets."slop-cannon/gitea-token".path;
giteaUrl = "https://git.nul.ie";
paseoPasswordFile = config.age.secrets."slop-cannon/paseo.env".path;
# Steer agents to the approval broker; these match command text, so they aren't a boundary.
# `.keys/` only has the committed public keys here, which agents may read.
claudeDeny = [
"Bash(deploy:*)"
"Bash(ssh-machine:*)"
];
# The broker asks a human where policy says so; a second prompt here would only add noise
claudeAllow = [ "Bash(slop:*)" ];
# Gitea takes a token as the username when the password is `x-oauth-basic`
gitCredential = pkgs.writeShellScript "gitea-credential" ''
[ "$1" = get ] || exit 0
printf 'username=%s\npassword=x-oauth-basic\n' "$(cat ${giteaToken})"
'';
# `tea`, logged in as the bot
tea = pkgs.writeShellScriptBin "tea" ''
GITEA_INSTANCE_URL=${giteaUrl} GITEA_TOKEN="$(cat ${giteaToken})" exec ${pkgs.tea}/bin/tea "$@"
'';
giteaRule = ''
# Pull requests
By default, your work reaches Dev as a pull request on Gitea (`${giteaUrl}`), and Dev
merges it. The task or the repository's own instructions (its `AGENTS.md`) can say
otherwise, for example that you may push to its main branch yourself; follow them.
- When a piece of work is done, push it to a branch of its own and open a pull request.
Name the branch after the work, such as `fix-paseo-relay`.
- Push with jj: `jj bookmark set <branch> -r <revision>` then `jj git push -b <branch>`.
With Git: `git push origin HEAD:refs/heads/<branch>`.
- Open the pull request with `tea`, which is already logged in, as a bot user:
`tea pulls create --head <branch> --title "<summary>" --description "<what and why>"`.
Pass `--head`, since a jj checkout has no current branch. Outside a clone, add
`--repo <owner>/<repo>`.
- To update a pull request, push to its branch again; rewriting its commits is fine.
- Read a pull request and its comments with `tea pulls <index> --comments`, and reply with
`tea comment <index> "<text>"`.
- The repository's commit conventions still apply.
# Running notes in issues
Keep notes about work in progress (plans, where it stands, what's next, handoffs to
another agent) in Gitea issues on the repository they're about, not in files in the
repository or on branches, which go stale.
- Use one issue per piece of work, and keep its description current: what it's for, where
it stands, what's next and open questions. Add progress and findings as comments.
- Create one with `tea issues create --title "<summary>" --description-file <file>`, and
update it with `tea issues edit <index> --description-file <file>`. List with
`tea issues`, read one with `tea issues <index> --comments`, and comment with
`tea comment <index> "<text>"`.
- Mention the issue (`#<index>`) in pull requests that move it on. Closing keywords such
as "fixes #<index>" close it when the pull request merges, so only use them when that
finishes the work.
- When the work is done, put what lasts in the repository's docs (its `AGENTS.md` says
where) and close the issue with `tea issues close <index>`.
'';
slopClone = pkgs.writeShellApplication {
name = "slop-clone";
runtimeInputs = with pkgs; [ git jujutsu paseo ];
text = ''
if [ $# -ne 1 ] || [[ "$1" != */* ]]; then
echo "usage: slop-clone <owner>/<repo>" >&2
exit 1
fi
repo="$1"
dest="$HOME/src/''${repo##*/}"
if ! jj git clone --colocate "${giteaUrl}/$repo.git" "$dest"; then
echo >&2
echo "Clone failed. If Gitea refused, add the bot user to $repo as a collaborator with Write." >&2
exit 1
fi
paseo workspace create --isolation local --path "$dest"
'';
};
slopPair = pkgs.writeShellApplication {
name = "slop-pair";
runtimeInputs = [ pkgs.paseo ];
text = ''
if [ "$#" -ne 0 ]; then
echo "usage: slop-pair" >&2
exit 2
fi
paseo daemon pair
printf '\n'
exec doas ${pkgs.coreutils}/bin/cat ${paseoPasswordFile}
'';
};
in
{
imports = [
"${modulesPath}/profiles/qemu-guest.nix"
];
config = {
boot = {
# Load the passed-through ConnectX VF even when PCI probing doesn't autoload it.
kernelModules = [ "kvm-amd" "mlx5_core" ];
kernelParams = [ "console=ttyS0,115200n8" ];
initrd = {
availableKernelModules = [ "virtio_pci" "ahci" "sr_mod" "virtio_blk" ];
kernelModules = [ "dm-snapshot" ];
};
# On disk rather than in the tmpfs root, so agents' scratch files don't use RAM
tmp.cleanOnBoot = true;
};
hardware = {
enableRedistributableFirmware = true;
};
fileSystems = {
"/boot" = {
device = "/dev/disk/by-partlabel/esp";
fsType = "vfat";
};
"/nix" = {
device = "/dev/main/slop-cannon-nix";
fsType = "ext4";
};
"/persist" = {
device = "/dev/main/slop-cannon-persist";
fsType = "ext4";
neededForBoot = true;
};
"/tmp" = {
device = "/dev/main/slop-cannon-tmp";
fsType = "ext4";
# Return deleted scratch space to the thin pool straight away
options = [ "discard" ];
};
};
networking = { inherit domain; };
services = {
# The LVs are thin, so space moves between them as needed
lvm = {
boot.thin.enable = true;
dmeventd.enable = true;
};
fstrim.enable = true;
};
# Grow the pool into the VG's spare space before it fills
environment.etc."lvm/lvm.conf".text = ''
activation/thin_pool_autoextend_threshold = 80
activation/thin_pool_autoextend_percent = 10
'';
my = {
server.enable = true;
# Root inside this VM belongs to the agents, so it gets no shared secrets: in particular
# not `user-passwd.txt`
user = {
passwordSecret = null;
config = {
password = null;
hashedPassword = "!";
};
};
secrets = {
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBCkgBZh/YejY+gDnGa9r5SPo1+aHWPAAAIfENE7t0Om";
files = {
"slop-cannon/gitea-token".owner = agentUser;
# `PASEO_PASSWORD=...`
"slop-cannon/paseo.env" = { };
};
};
tmproot.persistence.config.directories = [
{
directory = agentHome;
user = agentUser;
group = agentUser;
mode = "0700";
}
];
};
users = with lib.my.c.ids; {
groups.${agentUser}.gid = gids.slop-cannon;
users.${agentUser} = {
isNormalUser = true;
uid = uids.slop-cannon;
group = agentUser;
# Agents get root (passwordless `doas`) and can run nested VMs
extraGroups = [ "wheel" "kvm" ];
hashedPassword = "!";
shell = pkgs.fish;
openssh.authorizedKeys.keyFiles = [ lib.my.c.sshKeyFiles.me ];
};
};
home-manager.users.${agentUser} = {
my.agents = {
enable = true;
slop.enable = true;
rules.gitea = giteaRule;
rules.slop-approvals = ''
# Slop approval requests
Run `slop` in a background session when it may need approval so it can stay
connected for the broker's configured approval window. If a request expires and
the task still depends on it, tell the user what is blocked and pause for their
direction. Continue any independent work you can do under the existing approvals.
'';
};
home.packages = [ slopClone slopPair tea ];
programs = {
# Permissive by default: the VM is the boundary, and `slop-broker` gates what needs
# credentials
claude-code.settings.permissions = {
defaultMode = "bypassPermissions";
allow = claudeAllow;
deny = claudeDeny;
};
codex.settings = {
cli_auth_credentials_store = "file";
approval_policy = "never";
sandbox_mode = "danger-full-access";
};
git.settings.credential.${giteaUrl}.helper = "${gitCredential}";
};
};
# Not editable by the agent user without `doas`; a convenience, not a boundary
environment.etc."claude-code/managed-settings.json".text = toJSON {
permissions.deny = claudeDeny;
};
systemd = {
network = {
links = {
"10-lan-untrusted" = {
matchConfig = {
Driver = "mlx5_core";
PermanentMACAddress = "52:54:00:71:22:ea";
};
linkConfig = {
Name = "lan-untrusted";
MTUBytes = toString prefixes.untrusted.mtu;
};
};
};
networks = {
"80-lan-untrusted" = mkMerge [
(networkdAssignment "lan-untrusted" assignments.untrusted)
{
# As `untrusted`'s DHCP and RAs hand out; the routers' resolvers aren't reachable
networkConfig.DNS = [
"1.1.1.1" "1.0.0.1"
"2606:4700:4700::1111" "2606:4700:4700::1001"
];
}
];
};
};
services = {
paseo = {
unitConfig.RequiresMountsFor = agentHome;
serviceConfig.EnvironmentFile = paseoPasswordFile;
# Don't interrupt running agents on deploy; restart by hand when convenient
restartIfChanged = false;
};
};
};
services.paseo = {
enable = true;
package = pkgs.paseo;
user = agentUser;
group = agentUser;
listenAddress = "127.0.0.1";
port = 6767;
relay = {
enable = true;
mode = "remote";
host = "paseo-relay.${lib.my.c.pubDomain}";
port = 443;
useTls = true;
};
# Rewritten on every start, so changes made from the app don't survive a restart
settings = {
version = 1;
# Pairing links open our copy of the web app (served by `middleman`)
app.baseUrl = "https://slop.${lib.my.c.pubDomain}";
daemon = {
# Keep agents from changing modes, answering prompts or opening terminals
mcp.injectIntoAgents = false;
relay.requireProtectedSecurity = true;
# Paseo can't change a provider's default mode, only offer these; `slop-broker` gates
# what needs credentials
agentProfiles = [
{
id = "claude-bypass";
name = "Claude, bypass permissions";
provider = "claude";
modeId = "bypassPermissions";
}
{
id = "codex-full-access";
name = "Codex, full access";
provider = "codex";
modeId = "full-access";
}
];
};
# Avoids downloading the local speech model
features = {
dictation.enabled = false;
voiceMode.enabled = false;
};
agents.providers = lib.genAttrs
[ "copilot" "opencode" "pi" "omp" "antigravity" "muse" ]
(_: { enabled = false; });
log.file.level = "info";
};
};
};
};
};
}
Loaded 100 of 208 files, more files were not shown because too many files have changed in this diff. Show more