Author SHA1 Message Date
jackos1998 e110a378ce WIP: slop-broker working notes (not for merge) 2026-11-25 00:21:35 +00:00
46 changed files with 562 additions and 1354 deletions

No files matched your search

+28 -8
View File
@@ -4,11 +4,6 @@ on:
push: push:
branches: [master] branches: [master]
# Only the newest commit is worth building and caching
concurrency:
group: ci
cancel-in-progress: true
jobs: jobs:
check: check:
name: Check, build and cache nixfiles name: Check, build and cache nixfiles
@@ -52,6 +47,31 @@ jobs:
env: env:
HARMONIA_SSH_KEY: ${{ secrets.HARMONIA_SSH_KEY }} HARMONIA_SSH_KEY: ${{ secrets.HARMONIA_SSH_KEY }}
CI_IFD_REQUIRED: ${{ steps.ifd.outputs.required }} CI_IFD_REQUIRED: ${{ steps.ifd.outputs.required }}
run: >- run: |
nix shell .#nixpkgs.unstable.x86_64-linux.python3 .#nixpkgs.unstable.x86_64-linux.nix-eval-jobs set -o pipefail
--command python3 ci/build-and-cache.py nix_options=(--option allow-import-from-derivation "$CI_IFD_REQUIRED")
echo "::group::Collect cache garbage"
ci/push-to-cache.sh --gc
echo "::endgroup::"
nix eval "${nix_options[@]}" --json --apply "builtins.attrNames" .#ci.x86_64-linux | jq -cr '.[]' | while read job; do
echo "::group::Build $job"
nix build "${nix_options[@]}" --no-link .#ci.x86_64-linux."$job"
echo "::endgroup::"
echo "::group::Cache $job"
ci/push-to-cache.sh "$(nix eval "${nix_options[@]}" --raw .#ci.x86_64-linux."$job")"
echo "::endgroup::"
done
if [[ "$CI_IFD_REQUIRED" == true ]]; then
echo "::group::Check flake"
# The target closures are available for the evaluation-time reference graphs.
nix flake check "${nix_options[@]}"
echo "::endgroup::"
fi
echo "Building and caching CI derivation"
nix build "${nix_options[@]}" --no-link .#ciDrv.x86_64-linux
UPDATE_PROFILE=1 ci/push-to-cache.sh "$(nix eval "${nix_options[@]}" --raw .#ciDrv.x86_64-linux)"
-47
View File
@@ -1,47 +0,0 @@
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
-36
View File
@@ -1,36 +0,0 @@
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
-1
View File
@@ -5,5 +5,4 @@ result*
!/.vms/.gitkeep !/.vms/.gitkeep
/.keys/*.key /.keys/*.key
*.swp *.swp
__pycache__/
/.claude/settings.local.json /.claude/settings.local.json
+2 -8
View File
@@ -191,10 +191,8 @@ These APs are not managed by the flake; only their DNS records are. Read and upd
## Working from `slop-cannon` ## Working from `slop-cannon`
Agents on `slop-cannon` have no deploy or SSH keys, so `deploy` and `ssh-machine` don't work there. 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 Use `slop` instead; `slop guide` explains it. Requests that need approval can wait up to five
or give the tool enough time for the [approval window](docs/slop-broker.md#approval-timeout). minutes for a human. See [`docs/slop-broker.md`](docs/slop-broker.md).
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 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`; - `slop ssh <node> -- <cmd>` runs anything else. Nodes are the deploy-rs nodes on `master`;
@@ -275,10 +273,6 @@ in churn.
## Documentation ## 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 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 `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 (containers/nested VMs) gets a **directory named for it** with a `README.md` and the child pages
+136
View File
@@ -0,0 +1,136 @@
# slop-broker: working notes (WIP, not for merge)
Notes for whoever picks up `slop-broker` next in this flake: where the work stands, what was
decided, and what comes next. They live in their own change at the top of the `slop-broker`
bookmark and are not meant to land. Durable facts go in [`docs/slop-broker.md`](docs/slop-broker.md)
and the box pages; drop this file when the work is done.
The broker itself is developed in its own repository, <https://git.nul.ie/dev/slop-broker> (local
checkout `../slop-broker`): code, modules, design (`docs/design.md`), architecture and gotchas
(`docs/architecture.md`), and a demo. Change it there, push, then `nix flake update slop-broker`
here.
`flake.lock` pins `21c2d471`, the broker's `main` after its history was cleaned up
(2026-11-24), so no override is needed any more. `palace` still runs `4e4c68cb`, deployed with one;
deploy it from this stack with plain `deploy .#palace`. Since then `palace` lists no SSH targets,
because the broker reads the deploy-rs nodes on `master` through its builder. Tested from `castle`
with queries to `estuary` and `river` (the first lookup takes about 15 s, then they're cached per
`master` commit) and an unknown node.
## Progress
As of 2026-11-24. The `slop-broker` bookmark, oldest first, on top of `master`, pushed to Gitea
(up to the castle change reviewed, not merged; the secrets changes wait for Dev's review). It
replaced the older stack that had the broker under `pkgs/slop-broker`, which is deleted.
| Change | State |
|---|---|
| `AGENTS.md: Spell out blank lines inside functions` | Done; unrelated to the broker, but sits at the bottom. |
| `nixos/middleman: Move Paseo web app to slop.nul.ie` | Done. `slop.nul.ie` and `*.slop.nul.ie` are CNAMEs to `http.int.nul.ie` in Cloudflare, and the certificate covers the wildcard. |
| `nixos/middleman: Add Pocket ID at id.nul.ie` | Done and deployed. Dev is the admin; the admin API key is `.keys/pocket-id.key`. Pocket ID has the group `slop-approvers` (Dev) and the confidential client `slop-approve` (PKCE, restricted to that group), whose secret is `palace/slop-broker-oidc-secret`. |
| `flake: Add slop-broker from its own repository` | The input (locked to `9f989b78`), overlay and modules; tmproot persistence, `my.agents.slop`, devshell commands, `docs/slop-broker.md`. |
| `nixos/palace: Run slop-broker for agents` | All of `palace`'s broker config, `object`'s cache key, and the `approve.slop.nul.ie` vhost on `middleman`. Targets come from `master`; deploys to `river`, `stream` and `estuary` need a passkey. `slop-cannon`'s Claude rules no longer deny `.keys/`, which only has public keys there. |
| `nixos/castle: Use slop-broker over SSH` | `castle`'s `programs.slop` setup, and its requester and approver keys on `palace`. |
| `secrets: Add slop-broker as a recipient` | `.keys/slop-broker.pub` in `defaultKeys`, and the one full rekey; nothing else, so the churn is on its own. |
| `nixos/palace: Let slop-broker change secrets` | The identity (`palace/slop-broker-age.key`), `services.slop-broker.secrets`, the `secret` policy (`keys` auto, others ask with a 5m lease), `lib.my.c.ageKeyFiles`, docs. Deployed to `palace`. |
| `WIP: slop-broker working notes (not for merge)` | This file. Keep it at the top. |
Deployed from this bookmark on 2026-11-23: `palace` (with the approvals web app) and
`shill.container-middleman` (with the `approve.slop.nul.ie` vhost), and `river` through `slop
deploy`. Deployed from the old stack: `object`, and `slop-cannon` (`--boot` through `slop deploy`,
before its permissive defaults). `castle` is switched to an earlier state locally (`deploy
.#castle` fails host key verification against itself, so use `build-n-switch switch`). Tested end
to end: queries, `slop ssh`, deploys, builds (including a real upload of 1181 paths), builder
leases and the egress filter.
The web app is tested on Dev's Android phone: Web Push notifications, answering from a
notification's buttons with the app closed, a builder approval, and a passkey approval for the
`river` deploy (logged as `web, passkey`). Only `middleman` reaches port 8095 on `palace`. The
`localhost` callback is gone from the `slop-approve` client. The old builder copy
(`nixfiles.git`) on `palace` is deleted.
Secrets (slop-broker `9f989b78`, `ops: Add age secrets`) are deployed to `palace` and tested end to
end from `castle`: `keys` (auto), `set` creating a file and editing it, `generate --kind
wireguard` and `read`, all approved from the phone and checked with the dev key. Until the stack
is merged, every file in a checkout shows as "not on master" (they were rekeyed on this branch),
and `master`'s files and `secrets.nix` don't include the broker yet, so `keys`, `read` and `rekey`
only work on files from this branch. The demo has no builder, so it has no secrets yet.
Not deployed: `slop-cannon`'s permissive agent defaults.
The repository's `main` (now `f94ad9ab`; CI runs `nix flake check` on every push) was rewritten on
2026-11-23, so every commit builds and passes its tests on its own:
- The web app's pages are askama templates (`templates/`), escaped through `ops::printable`;
sessions are in SQLite (`sessions.sqlite`) instead of `sessions.json`, so anyone signed in signs
in again once, and a leftover `sessions.json` in the web state directory can be deleted.
- `libc` is replaced by the `nix` crate (already a dependency) and `File::try_lock`.
- The "drop assumptions from one deployment" commit is folded into the commits that introduced
each line, so no commit names `nul.ie` or defaults to `doas` (some test fixtures still use box
names, which is fine).
- `nix develop` gives a plain shell besides devenv, without the demo or devenv's scripts.
- Looked at and left alone: Web Push (the `web-push` crate does the work), the policy glob,
duration parsing. `ha.rs` is now gone too (`2af7c55a`).
## Decisions (2026-11-22)
- **Approvals web app:** public at `approve.slop.nul.ie`, signing in through **Pocket ID** at
`id.nul.ie` (passkey-only OIDC) with the broker as its own OIDC client, optional per-request
passkeys through OIDC re-authentication (`max_age=0`, checking `auth_time`), and **Web Push**.
- **No passkeys in the broker itself.** Tested with a temporary public PKCE client: `max_age=0`
and `prompt=login` both prompted for a passkey and returned a fresh `auth_time`, while a plain
request reused the existing session's.
- **Agents on `castle`** can use the approver's session or `castle`'s SSH approver key; Dev
accepts that, since agents should mostly run on `slop-cannon`.
- **Home Assistant** notifications are gone (2026-11-24), replaced by the web app's Web Push;
rewritten out of this stack, and `ha.rs` dropped from the broker.
- **`slop-cannon` agents are permissive by default** (Claude `bypassPermissions`, Codex
`approval_policy = "never"` and `danger-full-access`, matching Paseo profiles); the deny rules
and the agent guide still steer towards `slop`.
- **Later, a separate `middleman` project:** move the private vhosts from `nginx-sso` (Google
OAuth) to oauth2-proxy against Pocket ID, and apps with native OIDC (Gitea, HedgeDoc, MinIO,
Synapse) to Pocket ID directly; then previews' `--auth sso` follows.
- **Agents open PRs as a Gitea bot user** (2026-11-24): a user (say `slop`) with write access to
the repositories agents use replaces `slop-cannon`'s deploy key, with a token scoped
`write:repository` and `write:issue` as an age secret for `slop-cannon`, so agents can open,
update and comment on PRs (API or `tea`). It's safe in the VM only because `master`'s protection
lets Dev alone push and merge. Rejected: AGit pushes (`refs/for/master`) with the deploy key,
which may not be allowed for deploy keys and can't comment or edit.
## Next, in order
1. **Deploy the other boxes** at leisure; the rekeyed files decrypt to the same values. `palace`
and `slop-cannon` are done.
2. **Delete the `slop-broker` user** and its long-lived token on `hass` (Dev, in the UI).
3. **Redeploy `slop-cannon`** for the bot's new token (with `read:user`; on `master`), then check
`tea whoami` there. Gitea is set up (2026-11-25): the old deploy key is gone, slop-broker's
`main` is protected like nixfiles' `master`, and agents push as the bot over HTTPS, with pull
requests as their default.
4. DNS, previews and forwards: the rollout in [`docs/slop-broker.md`](docs/slop-broker.md).
## Web app follow-ups
All of these are on slop-broker `main` (`f94ad9ab`), locked here and deployed to `palace`:
- `web: Scroll the audit log sideways on phones`: `table.log` gets a `min-width`, so its `.scroll`
wrapper scrolls instead of squeezing the columns.
- `web: Ask for the passkey on every sign-in`: signing out only ended the app's session, and the
next sign-in went straight through `id.nul.ie`'s own session. Every sign-in now sends
`max_age=0` and checks `auth_time`, like passkey confirmations. Chosen over ending the Pocket ID
session too (RP-initiated logout), which would sign out of every app using Pocket ID.
- `web: Give form controls one consistent style`: selects, text fields and buttons share one
look, and the log's filters stack their labels and wrap into rows on a phone.
- `web: Brand the app as Slopprovals`: the name, and Noto Emoji's thinking face in the icon.
## Working on it
- Workspaces: this one (`nixfiles-jj3`, with `.keys/`), `../nixfiles-deploy-broker` (no private
keys, for trying `slop` as an agent would), `default` (`../nixfiles-jj`) and `../nixfiles-jj2`.
Each workspace's working copy is an empty, undescribed change: don't abandon by a revset that
could match another workspace's.
- jj doesn't create local bookmarks for new remote branches: after `jj git fetch`, use
`jj new <bookmark>@origin` or `jj bookmark track <bookmark>@origin`.
- Claude Code's permission check refuses using the broker's deploy key directly (for example to
test a command by hand on `palace`); test through the broker, or ask Dev.
- In `../slop-broker`, pushed commits are immutable to jj; rewriting them needs
`--ignore-immutable` and a force-push.
-158
View File
@@ -1,158 +0,0 @@
#!/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
@@ -1,29 +0,0 @@
{ 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 { })
+5 -8
View File
@@ -31,15 +31,12 @@ if [ "${1-}" = "--gc" ]; then
exit exit
fi fi
if [ -n "${UPDATE_PROFILE-}" ] && [ $# -ne 1 ]; then path="$1"
echo "UPDATE_PROFILE needs exactly one path" >&2
exit 1
fi
echo "Pushing $# path(s) to cache..." echo "Pushing $path to cache..."
nix copy --no-check-sigs --to "$STORE_URI" "$@" nix copy --no-check-sigs --to "$STORE_URI" "$path"
if [ -n "${UPDATE_PROFILE-}" ]; then if [ -n "$UPDATE_PROFILE" ]; then
echo "Updating profile..." echo "Updating profile..."
remote_cmd nix-env -p "$REMOTE_STORE"/nix/var/nix/profiles/nixfiles --set "$1" remote_cmd nix-env -p "$REMOTE_STORE"/nix/var/nix/profiles/nixfiles --set "$path"
fi fi
-239
View File
@@ -1,239 +0,0 @@
#!/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()
+1 -1
View File
@@ -42,7 +42,7 @@ Physical host and public-infrastructure hub — see [`sites/colony/README.md`](s
``` ```
colony (physical VM host, ams1) colony (physical VM host, ams1)
├── estuary ── edge router: WAN, firewall/NAT, DNS, BGP (AS211024), WireGuard ├── estuary ── edge router: WAN, firewall/NAT, DNS, BGP (AS211024), WireGuard
├── shill ──── NixOS container host ──┬── middleman (reverse proxy, ACME, Pocket ID, librespeed) ├── shill ──── NixOS container host ──┬── middleman (reverse proxy, ACME, nginx-sso, librespeed)
│ ├── vaultwarden (password manager) │ ├── vaultwarden (password manager)
│ ├── colony-psql (shared PostgreSQL) │ ├── colony-psql (shared PostgreSQL)
│ ├── chatterbox (Matrix Synapse + bridges) │ ├── chatterbox (Matrix Synapse + bridges)
+3 -2
View File
@@ -51,7 +51,8 @@ Per platform (`eachDefaultSystem`), the flake produces:
- `devShells.default` — the `numtide/devshell` from [`devshell/`](../devshell) (see - `devShells.default` — the `numtide/devshell` from [`devshell/`](../devshell) (see
[deployment.md](deployment.md)). [deployment.md](deployment.md)).
- `ci.<system>` — one attr per buildable thing (`system-<name>`, `home-<name>` with `@` mangled - `ci.<system>` — one attr per buildable thing (`system-<name>`, `home-<name>` with `@` mangled
to `-at-`, `package-<name>`, plus `shell`), consumed by CI. to `-at-`, `package-<name>`, plus `shell`), consumed by CI; `ciDrv` is a `linkFarm` of all of
them.
## Systems: `systemOpts` and `mkSystem` ## Systems: `systemOpts` and `mkSystem`
@@ -187,7 +188,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`. | | `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. | | `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. | | `pdns` | `my.pdns` — PowerDNS: authoritative server driven by BIND-style zone files (with templating and serial management) and recursor extra-settings wiring. |
| `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. | | `nginx-sso` | `my.nginx-sso` — runs `nginx-sso` (instead of the stock NixOS module) and generates per-instance nginx `auth_request` include files. |
| `gui` | `my.gui.enable` (default on) — desktop baseline: graphics, polkit, swaylock PAM entry, Android udev rules, screenshot tmpdir. | | `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). | | `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. | | `borgthin` | `my.borgthin.jobs` — borg backups of thin-LVM snapshots to local or SSH repos on a systemd timer, with pruning. |
+18 -56
View File
@@ -84,10 +84,9 @@ Boxes default to `fish`, so pipe multi-statement remote scripts through `bash`,
## Coding agents ## Coding agents
The shared GUI home-manager module installs Codex and Claude Code from the `llm-agents` input, The shared GUI home-manager module installs Codex and Claude Code from the `llm-agents` input, retaining
retaining that input's tested nixpkgs pin. [CI proposes version updates](#llm-agents-updates). that input's tested nixpkgs pin. Run `nix flake update llm-agents`, then switch the system
To refresh the pin manually, run `nix flake update llm-agents`, then switch the system or home or home configuration to use the updated package.
configuration to use the updated packages.
The shared cache settings in `lib.my.c.nix.cache` and the flake's `nixConfig` include 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 the [Numtide binary cache](https://github.com/numtide/llm-agents.nix#binary-cache), so
@@ -302,69 +301,32 @@ GitHub/Gitea Actions workflows live in [`.gitea/workflows/`](../.gitea/workflows
On pushes to `master`, this installs Determinate Nix on the runner (via On pushes to `master`, this installs Determinate Nix on the runner (via
`DeterminateSystems/determinate-nix-action`, configured with the same performance settings and `DeterminateSystems/determinate-nix-action`, configured with the same performance settings and
Harmonia substituter as the boxes). A newer push cancels a run still in progress. CI normally Harmonia substituter as the boxes). CI normally runs `nix flake check --no-build` first and
runs `nix flake check --no-build` first and keeps import from derivation disabled. It then runs keeps import from derivation disabled. It builds every attribute of `.#ci.x86_64-linux`:
[`ci/build-and-cache.py`](../ci/build-and-cache.py), which builds every attribute of systems as `system-<name>`, homes as `home-<name>` (with `@` changed to `-at-`), packages as
`.#ci.x86_64-linux`: systems as `system-<name>`, homes as `home-<name>` (with `@` changed to `package-<name>`, and the development `shell`. Each result is pushed to the
`-at-`), packages as `package-<name>`, and the development `shell`. Harmonia cache with [`ci/push-to-cache.sh`](../ci/push-to-cache.sh). Before the first push, the
workflow deletes cache-profile generations older than its retention period, then collects
The script works in stages: 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
- **Collect garbage.** It deletes cache-profile generations older than their retention period, [`slop-broker.md`](slop-broker.md#binary-cache)).
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 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 and allows import from derivation for the target builds. It runs a build-capable flake
builds in parallel. CI runs a build-capable flake check after caching and before updating the check afterward. CI checks [the shared runtime replacement list](../lib/runtime-dependency-replacements.nix)
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 against the nixpkgs channels used by its systems and standalone homes. A matching entry
requires reading generated store reference graphs during evaluation. requires reading generated store reference graphs during evaluation.
The SSH store uses `/var/lib/harmonia`, `HARMONIA_SSH_KEY`, and pinned `ci/known_hosts`; clients It then builds `.#ciDrv.x86_64-linux`, a `linkFarm` of all CI attributes, and pushes it with
use `https://nix-cache.nul.ie` through `lib.my.c.nix.cache`. `UPDATE_PROFILE=1`. That updates the `nixfiles` profile on the cache box. 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` ### `installer.yaml`
Pushing the `installer` tag (refreshed by `update-installer`) builds `my.buildAs.iso` and Pushing the `installer` tag (refreshed by `update-installer`) builds `my.buildAs.iso` and
`my.buildAs.netbootArchive`, then attaches both to a release. `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` ### `update-docs.yaml`
On pushes to `master`, excluding its own commits, this runs the assignment, option and DNS On pushes to `master`, excluding its own commits, this runs the assignment, option and DNS
-9
View File
@@ -20,15 +20,6 @@ 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 `gitea`, on [`object`](shill/containers/object.md)) — the secret is spliced into `app.ini` at
startup. startup.
- Mail goes out via `mail.nul.ie`, including the issue-reply incoming-mail poller. - 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 ### Gitea Actions runner
-12
View File
@@ -33,18 +33,6 @@ 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 estuary's reverse zone). `estuary` accepts traffic to the customer prefixes
without per-port filtering; `colony` forwards it on ("trust for now"). 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 ## Notes
- ACME certificates are issued on `middleman` and pushed to the VM over SSH - ACME certificates are issued on `middleman` and pushed to the VM over SSH
+1 -1
View File
@@ -48,7 +48,7 @@ their current addresses. Each container has its own page:
| Container | Role | | Container | Role |
|---|---| |---|---|
| [`middleman`](containers/middleman.md) | Reverse proxy, ACME, Pocket ID and SSO, librespeed, Paseo relay | | [`middleman`](containers/middleman.md) | Reverse proxy, ACME, nginx-sso, librespeed, Paseo relay |
| [`vaultwarden`](containers/vaultwarden.md) | Password manager | | [`vaultwarden`](containers/vaultwarden.md) | Password manager |
| [`colony-psql`](containers/colony-psql.md) | Shared PostgreSQL (14) | | [`colony-psql`](containers/colony-psql.md) | Shared PostgreSQL (14) |
| [`chatterbox`](containers/chatterbox.md) | Matrix Synapse + bridges | | [`chatterbox`](containers/chatterbox.md) | Matrix Synapse + bridges |
+17 -44
View File
@@ -2,11 +2,11 @@
The front-end reverse proxy for the colony's public web services — the single ingress that 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 `estuary` DNATs HTTP/HTTPS (and Matrix federation on `:8448`) to. Terminates TLS with wildcard
certificates it issues itself, runs the Pocket ID identity provider with oauth2-proxy in front of certificates it issues itself, provides nginx-sso for gated vhosts, and runs the Pocket ID
gated vhosts, and runs a librespeed backend and a Paseo relay. identity provider, a librespeed backend and a Paseo relay.
- **Source:** [`shill/containers/middleman/`](../../../../../nixos/boxes/colony/vms/shill/containers/middleman) - **Source:** [`shill/containers/middleman/`](../../../../../nixos/boxes/colony/vms/shill/containers/middleman)
(`default.nix`, `auth.nix`, `vhosts.nix`) (`default.nix`, `vhosts.nix`)
- **Host:** NixOS container on [`shill`](../README.md) (`my.containers` ephemeral nspawn on the - **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) `ctrs` bridge; bind-mounts `/mnt/media` read-only for the static file vhosts)
- **nixpkgs:** `mine` - **nixpkgs:** `mine`
@@ -32,51 +32,24 @@ also waits for `colony-psql` through `systemdAwaitPostgres`, avoiding an early-b
`mailcow-ssl-reload` there. `mailcow-ssl-reload` there.
- Renewal reloads nginx; the `acme` group owns the secret files and includes the nginx user. - Renewal reloads nginx; the `acme` group owns the secret files and includes the nginx user.
### nginx-sso
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 ### Pocket ID
[Pocket ID](https://pocket-id.org) (`services.pocket-id`) is a passkey-only OpenID Connect [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 provider at `id.nul.ie`, for apps that sign in with OIDC (first the `slop-broker` approvals web
[`slop-broker` approvals web app](../../../../slop-broker.md#approvals-web-app)); the rest go app, see [`slop-broker.md`](../../../../slop-broker.md#approvals-web-app)). It is meant to replace nginx-sso's
through [oauth2-proxy](#sso). Google sign-in later, with oauth2-proxy in front of apps that lack OIDC.
- Listens on `127.0.0.1:1411` behind nginx and keeps its SQLite database in `/var/lib/pocket-id` - 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. (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 - 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. 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 ### librespeed
The frontend and backend are published as `speed.nul.ie` and `librespeed.ams1.int.nul.ie`, both The frontend and backend are published as `speed.nul.ie` and `librespeed.ams1.int.nul.ie`, both
@@ -107,13 +80,14 @@ rewrites outbound IPv6 to the container's own address on `host0`.
## Published vhosts ## Published vhosts
Everything is under `*.nul.ie` with the public wildcard cert unless noted; defaults applied to 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 [oauth2-proxy](#sso). all vhosts are `onlySSL`, kTLS and HTTP/2. "SSO" = gated behind nginx-sso (`generic` instance).
| Host | Upstream | Notes | | 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) | | `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 | | `localhost` | — | loopback-only VTS status page at `/status` (scraped by netdata); plain HTTP |
| `id.nul.ie` | `localhost:1411` | Pocket ID; `/setup` only from internal networks; `X-API-Key` stripped | | `sso.nul.ie` | `localhost:8082` | nginx-sso endpoint |
| `id.nul.ie` | `localhost:1411` | Pocket ID; `/setup` only from internal networks |
| `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** | | `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 | | `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 | | `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 |
@@ -148,7 +122,6 @@ all vhosts are `onlySSL`, kTLS and HTTP/2. "SSO" = gated behind [oauth2-proxy](#
## Notable config files ## 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, librespeed, Paseo relay, secrets - [`nixos/boxes/colony/vms/shill/containers/middleman/default.nix`](../../../../../nixos/boxes/colony/vms/shill/containers/middleman/default.nix) — container definition: nginx, ACME, nginx-sso, Pocket ID, 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 SSO include helpers, and the `.well-known` tree
- [`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 - [`nixos/boxes/colony/vms/shill/containers/middleman/default.html`](../../../../../nixos/boxes/colony/vms/shill/containers/middleman/default.html) — default vhost landing page
-4
View File
@@ -176,10 +176,6 @@ SPDK only checks the host NQN, which root in the guest could forge.
I/O errors, instead of the kernel retrying forever. I/O errors, instead of the kernel retrying forever.
- `devices/global_filter` rejects `/dev/nvme*` in `lvm.conf`, so `palace` never activates the - `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. 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` ## `slop-broker`
+8 -19
View File
@@ -88,9 +88,6 @@ installed `claude` and its claude.ai login; Codex runs through `codex app-server
`paseo workspace jj` in the CLI. Each `fork/jujutsu-v<version>` branch carries the fork commits `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 on an upstream release; `main` mirrors upstream. The branch's `docs/jujutsu-fork.md` explains
the controls and how to rebase the fork. 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`. - 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 - Runs as `slop-cannon`, so agents use that user's logins and settings, with `~/.paseo` as
`PASEO_HOME`. `PASEO_HOME`.
@@ -136,18 +133,15 @@ sessions live under `~/.claude/projects/` and Codex sessions under `~/.codex/ses
## Repos, worktrees and jj ## Repos, worktrees and jj
Repos live under `~/src` as colocated jj clones (see `slop-clone` below). The fork drives them Repos live under `~/src` as colocated jj clones (see `slop-clone` below). Paseo only calls `git`:
through `jj`:
- A `local` workspace runs the agent in the checkout itself. Archiving it removes only Paseo's - A `local` workspace runs the agent in the checkout itself; `jj` and Paseo's git views see the same
record; the folder is kept. changes. Use it for work you want to steer with `jj`.
- A new jj workspace is a colocated `jj workspace` under `~/.paseo/worktrees` with its own - A worktree workspace is a `git worktree` under `~/.paseo/worktrees` on its own branch. Use it for
working-copy change. Use it for parallel or unattended agents. Archiving saves the change for unattended agents. Archiving it removes the worktree with `--force`, losing uncommitted work.
restore before removing the directory. - Archiving a `local` workspace removes only Paseo's record; the folder is kept.
- A workspace goes stale when another one rewrites its `@`, typically a `jj git fetch` after its - Only one colocated working copy per repo is possible, so parallel jj-driven work needs separate
pull request is merged. Paseo then offers **Update stale workspace** (`jj workspace clones.
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. - Don't run `jj` in a folder while an agent is mid-turn there: jj snapshots its partial edits.
## Terminal access ## Terminal access
@@ -183,8 +177,6 @@ Agents ask [`slop-broker`](../../slop-broker.md) on `palace` for anything needin
the `slop` command (`my.agents.slop.enable`). It connects over vsock (CID 3; see 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 [`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`. (`~/.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 and first login
@@ -214,9 +206,6 @@ scopes `write:repository` and `write:issue`).
Codex's `AGENTS.md`) makes a pull request from a branch of its own the default way to finish a 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, 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. 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`), - **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 protect the main branch so only Dev pushes and merges. Elsewhere the bot's Write access is
enough to push directly. enough to push directly.
+5 -28
View File
@@ -25,22 +25,11 @@ the requesters, the `agent` policy they share, the secrets, and the web app sett
targets are the deploy-rs nodes on `master`, which the builder reads there, so a new box is a targets are the deploy-rs nodes on `master`, which the builder reads there, so a new box is a
target once it's merged. 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 ## In this flake
- **Input:** `slop-broker` in [`flake.nix`](../flake.nix) selects a release tag. To upgrade, - **Input:** `slop-broker` in [`flake.nix`](../flake.nix). Its overlay provides `pkgs.slop-broker`,
change the tag and run `nix flake update slop-broker`. and the common modules import `services.slop-broker`, `services.slop-broker-builder`,
- Its overlay provides `pkgs.slop-broker`. `services.slop-broker-cache` and `programs.slop`. Update it with `nix flake update 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 - **Persistence:** [`tmproot.nix`](../nixos/modules/tmproot.nix) keeps `/var/lib/slop-broker` and
the builder's home when those services are enabled. the builder's home when those services are enabled.
- **Firewall:** the web app's port is open only to `middleman`, in `palace`'s configuration. - **Firewall:** the web app's port is open only to `middleman`, in `palace`'s configuration.
@@ -79,9 +68,8 @@ collects garbage in that store on every run, which the roots survive until they
`master`'s `secrets.nix`. The approval says which file the content really is and whether the `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 recipients match `master`'s rules for it (see the
[design](https://git.nul.ie/dev/slop-broker/src/branch/main/docs/design.md#secrets)). [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` - `secrets.names` labels `dev` and `slop-broker` in approvals (`lib.my.c.ageKeyFiles`); host keys
(`lib.my.c.ageKeyFiles`), and host keys through the system name `secrets.nix` writes after each are shown abbreviated.
key as its comment.
### `master` is protected ### `master` is protected
@@ -89,17 +77,6 @@ Deploy approvals ("on the branch", the diff since `master`) and secret approvals
`master`, so only Dev may push to it or merge into it: branch protection on `dev/nixfiles` in Gitea `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. 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 ## Approvals web app
`middleman` proxies `approve.slop.nul.ie` to port 8095 on `palace`. Approvers sign in through `middleman` proxies `approve.slop.nul.ie` to port 8095 on `palace`. Approvers sign in through
Generated
+21 -21
View File
@@ -788,11 +788,11 @@
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1795702923, "lastModified": 1795241446,
"narHash": "sha256-OvSz3gO7ualG+RziLMyiKecxfkqVlt43YUzAbh/+UwU=", "narHash": "sha256-v8/CnsHh4/p58E5d0k208omIYUUu6EruiKRIYYNNuE0=",
"owner": "numtide", "owner": "numtide",
"repo": "llm-agents.nix", "repo": "llm-agents.nix",
"rev": "9e137fb04294426cdd3a8f97d5a6835c9124e13f", "rev": "a59764a6424689d67c1bd9070fd48afa44a47ee0",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1031,11 +1031,11 @@
}, },
"nixpkgs_6": { "nixpkgs_6": {
"locked": { "locked": {
"lastModified": 1795249095, "lastModified": 1795095985,
"narHash": "sha256-8JDgyVvWUZg5m9hNlL8Ge9aT647ng3Ukc8NPMiKNTPQ=", "narHash": "sha256-DOTZsOOoEtOY0ysY9L6JzyDHZm4lGBr6P1bt1mFXcRw=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "93a9ed0a866099a230ed5146a5bb7d16fd5c9b14", "rev": "19cfded70b91ca0981373973c5b1efffdd4d6647",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1111,16 +1111,16 @@
"nixpkgs": "nixpkgs_7" "nixpkgs": "nixpkgs_7"
}, },
"locked": { "locked": {
"lastModified": 1795790016, "lastModified": 1795561002,
"narHash": "sha256-a+U4/NT4sGMLRX4K9x4yhTn/wkb/8yAGS21p9WMKkws=", "narHash": "sha256-mrq0nZBocjR/cb7Ov7jKLF1XOTB3oXW2u3DptUQBPKY=",
"ref": "fork/jujutsu-v0.17.5", "ref": "fork/jujutsu-v0.17.4",
"rev": "d871d1a678ddef68e5237f61a784f6f23b368ace", "rev": "b9518180f0130c0ad00a1eb312f799fde5954e49",
"revCount": 6850, "revCount": 6784,
"type": "git", "type": "git",
"url": "https://git.nul.ie/dev/paseo" "url": "https://git.nul.ie/dev/paseo"
}, },
"original": { "original": {
"ref": "fork/jujutsu-v0.17.5", "ref": "fork/jujutsu-v0.17.4",
"type": "git", "type": "git",
"url": "https://git.nul.ie/dev/paseo" "url": "https://git.nul.ie/dev/paseo"
} }
@@ -1249,16 +1249,16 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1795984395, "lastModified": 1795563488,
"narHash": "sha256-AiAdbNcyquBNZLJDE/dVQsYZlKdqlbNlh9XNfJd8jgw=", "narHash": "sha256-fTRKZn95BBANQpEGkhrmHSoPb9yTl59ZfvfzVbXeo5g=",
"ref": "refs/heads/progress", "ref": "main",
"rev": "6bce33dc66b232a5401ead98c29adef33eb895fd", "rev": "21c2d4715ec3bcf4a90b41c16125db75c599b8b7",
"revCount": 62, "revCount": 26,
"type": "git", "type": "git",
"url": "https://git.nul.ie/dev/slop-broker" "url": "https://git.nul.ie/dev/slop-broker"
}, },
"original": { "original": {
"ref": "refs/heads/progress", "ref": "main",
"type": "git", "type": "git",
"url": "https://git.nul.ie/dev/slop-broker" "url": "https://git.nul.ie/dev/slop-broker"
} }
@@ -1421,11 +1421,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1795615686, "lastModified": 1795173499,
"narHash": "sha256-/C0FK2Fwq0aWE/GADYyYbAIdQeGfYBbWMin3tfks1NA=", "narHash": "sha256-J8IYl3oEdctyvBgWr+/L01MY5Xm0TU4WXwZDccN5jjk=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "treefmt-nix",
"rev": "b7b56d3c8833016c650ca542b1230e6130299741", "rev": "a0a97e31a897a3537eea5c49df4f8adaa83b3b37",
"type": "github" "type": "github"
}, },
"original": { "original": {
+3 -4
View File
@@ -76,8 +76,8 @@
llm-agents.url = "github:numtide/llm-agents.nix"; 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 # 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. # 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"; paseo.url = "git+https://git.nul.ie/dev/paseo?ref=fork/jujutsu-v0.17.4";
slop-broker.url = "git+https://git.nul.ie/dev/slop-broker?ref=refs/heads/progress"; slop-broker.url = "git+https://git.nul.ie/dev/slop-broker?ref=main";
slop-broker.inputs.nixpkgs.follows = "nixpkgs-unstable"; slop-broker.inputs.nixpkgs.follows = "nixpkgs-unstable";
borgthin.url = "github:devplayer0/borg"; borgthin.url = "github:devplayer0/borg";
# TODO: Update borgthin so this works # TODO: Update borgthin so this works
@@ -287,8 +287,6 @@
(import ./pkgs { inherit lib pkgs; }) // (import ./pkgs { inherit lib pkgs; }) //
(import ./openwrt { inherit pkgs inputs; })); (import ./openwrt { inherit pkgs inputs; }));
llmAgentPackages = import ./ci/llm-agent-packages.nix { inherit lib inputs nixfiles system; };
devShells.default = shell; devShells.default = shell;
ci = ci =
@@ -303,6 +301,7 @@
homes' // systems' // packages' // { homes' // systems' // packages' // {
inherit shell; inherit shell;
}; };
ciDrv = pkgs.linkFarm "ci" ci;
ciIfdReasons = ciIfdReasons =
let let
-2
View File
@@ -379,8 +379,6 @@ in
my = { my = {
#deploy.generate.system.mode = "boot"; #deploy.generate.system.mode = "boot";
network.bbr = true;
secrets = { secrets = {
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPIijqzAWF6OxKr4aeCa1TAc5xGn4rdIjVTt0wAPU6uY"; key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPIijqzAWF6OxKr4aeCa1TAc5xGn4rdIjVTt0wAPU6uY";
files = { files = {
-2
View File
@@ -180,8 +180,6 @@ in
}; };
my = { my = {
network.bbr = true;
secrets = { secrets = {
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP+KINpHLMduBuW96JzfSRDLUzkI+XaCBghu5/wHiW5R"; key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP+KINpHLMduBuW96JzfSRDLUzkI+XaCBghu5/wHiW5R";
files = { files = {
+1 -40
View File
@@ -1,11 +1,8 @@
{ lib, pkgs, config, assignments, allAssignments, ... }: { lib, pkgs, config, assignments, allAssignments, ... }:
let let
inherit (lib) mkMerge mkAfter getExe; inherit (lib) mkMerge;
inherit (lib.my.c) pubDomain; inherit (lib.my.c) pubDomain;
inherit (lib.my.c.colony) prefixes; inherit (lib.my.c.colony) prefixes;
# Pocket ID login source, client `gitea` (declared on `middleman`)
oidcSource = "id.${pubDomain}";
in in
{ {
config = { config = {
@@ -51,40 +48,6 @@ in
# The default /tmp is on the small tmpfs root, so keep them on the state volume. # The default /tmp is on the small tmpfs root, so keep them on the state volume.
environment.TMPDIR = "${config.services.gitea.stateDir}/tmp"; 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
'');
}
]; ];
}; };
@@ -176,8 +139,6 @@ in
"gitea/db.txt" = ownedByGit; "gitea/db.txt" = ownedByGit;
"gitea/mail.txt" = ownedByGit; "gitea/mail.txt" = ownedByGit;
"gitea/minio.txt" = ownedByGit; "gitea/minio.txt" = ownedByGit;
# Shared with `middleman`, which registers it with Pocket ID
"gitea/oidc-secret.txt" = ownedByGit;
}; };
}; };
}; };
@@ -1,125 +0,0 @@
{ 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,14 +29,13 @@ in
inherit (lib.my) networkdAssignment; inherit (lib.my) networkdAssignment;
in in
{ {
imports = [ ./auth.nix ./vhosts.nix ]; imports = [ ./vhosts.nix ];
config = mkMerge [ config = mkMerge [
{ {
my = { my = {
deploy.enable = false; deploy.enable = false;
server.enable = true; server.enable = true;
network.bbr = true;
secrets = { secrets = {
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAQM9U1e/XcUCyMJITrpAHjAGahpqkZCmtX6pJkYzuks"; key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAQM9U1e/XcUCyMJITrpAHjAGahpqkZCmtX6pJkYzuks";
@@ -54,11 +53,17 @@ in
group = "acme"; group = "acme";
mode = "400"; mode = "400";
}; };
"middleman/nginx-sso.yaml" = {
owner = "nginx-sso";
group = "nginx-sso";
};
"middleman/htpasswd" = { "middleman/htpasswd" = {
owner = "nginx"; owner = "nginx";
group = "nginx"; group = "nginx";
}; };
"librespeed.toml" = { }; "librespeed.toml" = { };
# Pocket ID's database encryption key; it reads it through `LoadCredential`
"middleman/pocket-id-encryption-key" = { };
}; };
}; };
@@ -73,6 +78,56 @@ 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 = { librespeed = {
frontend.servers = [ frontend.servers = [
{ {
@@ -171,6 +226,19 @@ in
}; };
services = { services = {
# Passkey-only OpenID Connect provider at `id.nul.ie`, published by nginx
pocket-id = {
enable = true;
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;
};
netdata = { netdata = {
enable = true; enable = true;
configDir = { configDir = {
@@ -9,40 +9,14 @@ let
dualStackListen' = l: map (addr: l // { inherit addr; }) [ "0.0.0.0" "[::]" ]; dualStackListen' = l: map (addr: l // { inherit addr; }) [ "0.0.0.0" "[::]" ];
dualStackListen = ll: flatten (map dualStackListen' ll); dualStackListen = ll: flatten (map dualStackListen' ll);
# Gate a vhost behind oauth2-proxy, for members of any of the given Pocket ID groups. The ssoServer = i: {
# 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 = '' extraConfig = ''
auth_request /oauth2/auth; include /etc/nginx/includes/sso/server-${i}.conf;
error_page 401 = /oauth2/start; '';
};
# Pass on the session cookie when a check refreshes it ssoLoc = i: {
auth_request_set $sso_cookie $upstream_http_set_cookie; extraConfig = ''
add_header Set-Cookie $sso_cookie; include /etc/nginx/includes/sso/location-${i}.conf;
''; '';
}; };
@@ -84,6 +58,12 @@ let
}; };
in in
{ {
my = {
nginx-sso.includes.instances = {
generic = {};
};
};
services.nginx.virtualHosts = services.nginx.virtualHosts =
let let
hosts = { hosts = {
@@ -131,6 +111,11 @@ in
}; };
}; };
"sso.${pubDomain}" = {
locations."/".proxyPass = config.my.nginx-sso.includes.endpoint;
useACMEHost = pubDomain;
};
"netdata-colony.${pubDomain}" = "netdata-colony.${pubDomain}" =
let let
hosts = [ hosts = [
@@ -145,23 +130,26 @@ in
locations = { locations = {
"= /".return = "301 https://$host/vm/"; "= /".return = "301 https://$host/vm/";
"~ /(?<behost>${matchHosts})$".return = "301 https://$host/$behost/"; "~ /(?<behost>${matchHosts})$".return = "301 https://$host/$behost/";
"~ /(?<behost>${matchHosts})/(?<ndpath>.*)" = { "~ /(?<behost>${matchHosts})/(?<ndpath>.*)" = mkMerge [
proxyPass = "http://$behost.${domain}:19999/$ndpath$is_args$args"; {
extraConfig = '' proxyPass = "http://$behost.${domain}:19999/$ndpath$is_args$args";
proxy_pass_request_headers on; extraConfig = ''
${proxyHeaders} proxy_pass_request_headers on;
proxy_set_header Connection "keep-alive"; ${proxyHeaders}
proxy_store off; proxy_set_header Connection "keep-alive";
proxy_store off;
gzip on; gzip on;
gzip_proxied any; gzip_proxied any;
gzip_types *; gzip_types *;
''; '';
}; }
(ssoLoc "generic")
];
}; };
useACMEHost = pubDomain; useACMEHost = pubDomain;
} }
(ssoServer [ "admins" ]) (ssoServer "generic")
]; ];
"pass.${pubDomain}" = "pass.${pubDomain}" =
@@ -254,40 +242,56 @@ in
"torrents.${pubDomain}" = mkMerge [ "torrents.${pubDomain}" = mkMerge [
{ {
locations."/".proxyPass = "http://jackflix-ctr.${domain}:9091"; locations."/" = mkMerge [
{
proxyPass = "http://jackflix-ctr.${domain}:9091";
}
(ssoLoc "generic")
];
useACMEHost = pubDomain; useACMEHost = pubDomain;
} }
(ssoServer [ "admins" ]) (ssoServer "generic")
]; ];
"jackett.${pubDomain}" = mkMerge [ "jackett.${pubDomain}" = mkMerge [
{ {
locations."/".proxyPass = "http://jackflix-ctr.${domain}:9117"; locations."/" = mkMerge [
{
proxyPass = "http://jackflix-ctr.${domain}:9117";
}
(ssoLoc "generic")
];
useACMEHost = pubDomain; useACMEHost = pubDomain;
} }
(ssoServer [ "admins" ]) (ssoServer "generic")
]; ];
"radarr.${pubDomain}" = mkMerge [ "radarr.${pubDomain}" = mkMerge [
{ {
locations."/" = { locations."/" = mkMerge [
proxyPass = "http://jackflix-ctr.${domain}:7878"; {
proxyWebsockets = true; proxyPass = "http://jackflix-ctr.${domain}:7878";
extraConfig = proxyHeaders; proxyWebsockets = true;
}; extraConfig = proxyHeaders;
}
(ssoLoc "generic")
];
useACMEHost = pubDomain; useACMEHost = pubDomain;
} }
(ssoServer [ "admins" ]) (ssoServer "generic")
]; ];
"sonarr.${pubDomain}" = mkMerge [ "sonarr.${pubDomain}" = mkMerge [
{ {
locations."/" = { locations."/" = mkMerge [
proxyPass = "http://jackflix-ctr.${domain}:8989"; {
proxyWebsockets = true; proxyPass = "http://jackflix-ctr.${domain}:8989";
extraConfig = proxyHeaders; proxyWebsockets = true;
}; extraConfig = proxyHeaders;
}
(ssoLoc "generic")
];
useACMEHost = pubDomain; useACMEHost = pubDomain;
} }
(ssoServer [ "admins" ]) (ssoServer "generic")
]; ];
"gib.${pubDomain}" = { "gib.${pubDomain}" = {
locations."/".proxyPass = "http://jackflix-ctr.${domain}:5055"; locations."/".proxyPass = "http://jackflix-ctr.${domain}:5055";
@@ -423,14 +427,9 @@ in
"id.${pubDomain}" = "id.${pubDomain}" =
let let
# API keys (including `pocket-id-sync`'s admin key) only work from inside
pocketIdHeaders = ''
${proxyHeaders}
proxy_set_header X-API-Key "";
'';
pocketId = { pocketId = {
proxyPass = "http://127.0.0.1:${toString config.services.pocket-id.settings.PORT}"; proxyPass = "http://127.0.0.1:${toString config.services.pocket-id.settings.PORT}";
extraConfig = pocketIdHeaders; extraConfig = proxyHeaders;
}; };
in in
{ {
@@ -441,7 +440,7 @@ in
extraConfig = '' extraConfig = ''
${concatStringsSep "\n" (map (n: "allow ${n};") (with lib.my.c.internalNets; v4 ++ v6))} ${concatStringsSep "\n" (map (n: "allow ${n};") (with lib.my.c.internalNets; v4 ++ v6))}
deny all; deny all;
${pocketIdHeaders} ${proxyHeaders}
''; '';
}; };
}; };
@@ -471,18 +470,24 @@ in
"pront.${pubDomain}" = mkMerge [ "pront.${pubDomain}" = mkMerge [
{ {
locations."/" = { locations."/" = mkMerge [
proxyPass = "http://stream-hi.${home.domain}:5000"; {
proxyWebsockets = true; proxyPass = "http://stream-hi.${home.domain}:5000";
extraConfig = proxyHeaders; proxyWebsockets = true;
}; extraConfig = proxyHeaders;
locations."~* ^/webcam/(.*)" = { }
proxyPass = "http://stream-hi.${home.domain}:5050/$1$is_args$args"; (ssoLoc "generic")
extraConfig = proxyHeaders; ];
}; locations."~* ^/webcam/(.*)" = mkMerge [
{
proxyPass = "http://stream-hi.${home.domain}:5050/$1$is_args$args";
extraConfig = proxyHeaders;
}
(ssoLoc "generic")
];
useACMEHost = pubDomain; useACMEHost = pubDomain;
} }
(ssoServer [ "admins" ]) (ssoServer "generic")
]; ];
"hass.${pubDomain}" = { "hass.${pubDomain}" = {
locations."/" = { locations."/" = {
-1
View File
@@ -166,7 +166,6 @@ in
my = { my = {
secrets.key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ6bc1pQCYalLXdB4X+7kFXtkTdFalbH5rchjuYj2ceU"; secrets.key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ6bc1pQCYalLXdB4X+7kFXtkTdFalbH5rchjuYj2ceU";
server.enable = true; server.enable = true;
network.bbr = true;
firewall = { firewall = {
tcp.allowed = [ 19999 ]; tcp.allowed = [ 19999 ];
@@ -162,7 +162,6 @@ in
my = { my = {
secrets.key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDBTIj1jVdknXLNNroMJfgy7S2cSUC/qgFdnaUopEUzZ"; secrets.key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDBTIj1jVdknXLNNroMJfgy7S2cSUC/qgFdnaUopEUzZ";
server.enable = true; server.enable = true;
network.bbr = true;
firewall = { firewall = {
tcp.allowed = [ 19999 ]; tcp.allowed = [ 19999 ];
-1
View File
@@ -221,7 +221,6 @@ in
my = { my = {
tmproot.size = "24G"; tmproot.size = "24G";
network.bbr = true;
user = { user = {
config.extraGroups = [ "input" ]; config.extraGroups = [ "input" ];
+2 -3
View File
@@ -86,10 +86,9 @@ in
}; };
# NVMe-oF disks connected here belong to guests (`palace` has no NVMe of its own; its # 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: # drives are passed to `cellar`); never activate their volume groups
# LVM accepts a device if any of its other names (`/dev/disk/by-*`) is accepted.
environment.etc."lvm/lvm.conf".text = '' environment.etc."lvm/lvm.conf".text = ''
devices/global_filter = [ "r|^/dev/nvme|" ] devices/global_filter = [ "r|^/dev/nvme|" "a|.*|" ]
''; '';
services = { services = {
-1
View File
@@ -78,7 +78,6 @@
services.slop-broker = { services.slop-broker = {
enable = true; enable = true;
timeout = "45m";
approvers = [ config.my.user.config.name ]; approvers = [ config.my.user.config.name ];
# For coding agents, wherever they run # For coding agents, wherever they run
@@ -76,24 +76,6 @@ in
- Read a pull request and its comments with `tea pulls <index> --comments`, and reply with - Read a pull request and its comments with `tea pulls <index> --comments`, and reply with
`tea comment <index> "<text>"`. `tea comment <index> "<text>"`.
- The repository's commit conventions still apply. - 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 { slopClone = pkgs.writeShellApplication {
@@ -244,14 +226,6 @@ in
enable = true; enable = true;
slop.enable = true; slop.enable = true;
rules.gitea = giteaRule; 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 ]; home.packages = [ slopClone slopPair tea ];
@@ -317,7 +317,6 @@ in
as211024 = config.age.secrets."l2mesh/as211024.key".path; as211024 = config.age.secrets."l2mesh/as211024.key".path;
}; };
}; };
network.bbr = true;
firewall = { firewall = {
trustedInterfaces = [ "lan-hi" "lan-lo" ]; trustedInterfaces = [ "lan-hi" "lan-lo" ];
udp.allowed = [ 5353 ]; udp.allowed = [ 5353 ];
+1 -1
View File
@@ -13,7 +13,7 @@
vms = ./vms.nix; vms = ./vms.nix;
network = ./network.nix; network = ./network.nix;
pdns = ./pdns.nix; pdns = ./pdns.nix;
pocket-id = ./pocket-id; nginx-sso = ./nginx-sso.nix;
gui = ./gui; gui = ./gui;
l2mesh = ./l2mesh.nix; l2mesh = ./l2mesh.nix;
borgthin = ./borgthin.nix; borgthin = ./borgthin.nix;
-18
View File
@@ -1,16 +1,8 @@
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
let let
inherit (lib) flatten optional mkIf mkDefault mkMerge versionAtLeast; inherit (lib) flatten optional mkIf mkDefault mkMerge versionAtLeast;
inherit (lib.my) mkBoolOpt';
cfg = config.my.network;
in in
{ {
options.my.network.bbr = mkBoolOpt' false
("Whether to use BBR congestion control for TCP connections this box sends. Unlike the default " +
"(CUBIC), BBR doesn't treat packet loss as congestion, so it keeps throughput up on lossy paths. " +
"It has no effect on traffic the box forwards.");
config = mkMerge [ config = mkMerge [
{ {
networking = { networking = {
@@ -30,16 +22,6 @@ in
}; };
} }
(mkIf cfg.bbr {
# BBR paces its own sending, so the default qdisc (fq_codel) stays as it is. A container's
# network namespace copies the host's setting only when it's created, so enable this in
# containers too for it to apply without a restart.
boot = {
kernelModules = [ "tcp_bbr" ];
kernel.sysctl."net.ipv4.tcp_congestion_control" = "bbr";
};
})
(mkIf config.my.build.isDevVM { (mkIf config.my.build.isDevVM {
networking.interfaces.eth0.useDHCP = mkDefault true; networking.interfaces.eth0.useDHCP = mkDefault true;
virtualisation = { virtualisation = {
+127
View File
@@ -0,0 +1,127 @@
{ lib, pkgs, config, ... }:
let
inherit (lib) mkIf mkMerge getBin mapAttrsToList;
inherit (lib.my) mkOpt' mkBoolOpt';
includeOpts = { ... }: {
options = with lib.types; {
auth = {
path = mkOpt' str "/sso-auth" "HTTP path for SSO auth.";
redirect = mkOpt' str "$scheme://$http_host$request_uri" "URL to redirect to upon successful login.";
};
logout = {
path = mkOpt' str "/sso-logout" "HTTP path for SSO logout.";
redirect = mkOpt' str "$scheme://$http_host/" "URL to redirect to upon successful logout.";
};
};
};
cfg = config.my.nginx-sso;
pkg = getBin cfg.package;
baseConfig = pkgs.writeText "nginx-sso.yaml" (builtins.toJSON cfg.configuration);
runCfg = "/run/nginx-sso/config.yaml";
in
{
options.my.nginx-sso = with lib.types; {
enable = mkBoolOpt' false "Whether to enable custom nginx-sso.";
package = mkOpt' package pkgs.nginx-sso "nginx-sso package to use.";
configuration = mkOpt' (attrsOf unspecified) { } "nginx-sso configuration.";
extraConfigFile = mkOpt' (nullOr str) null "Path to configuration (e.g. for secrets).";
includes = {
endpoint = mkOpt' str "http://localhost:8082" "Upstream for proxied auth requests.";
baseURL = mkOpt' str null "Base URL for redirects.";
instances = mkOpt' (attrsOf (submodule includeOpts)) { } "nginx includes instances.";
};
};
config = mkIf cfg.enable {
assertions = [
{
assertion = !config.services.nginx.sso.enable;
message = "Stock nginx-sso cannot be used with this module.";
}
];
environment.etc = with cfg.includes; mkMerge (mapAttrsToList (n: i: {
"nginx/includes/sso/server-${n}.conf".text = ''
location ${i.auth.path} {
# Do not allow requests from outside
internal;
# Access /auth endpoint to query login state
proxy_pass ${endpoint}/auth;
# Do not forward the request body (nginx-sso does not care about it)
proxy_pass_request_body off;
proxy_set_header Content-Length "";
# Set custom information for ACL matching: Each one is available as
# a field for matching: X-Host = x-host, ...
proxy_set_header X-Origin-URI $request_uri;
proxy_set_header X-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Define where to send the user to login and specify how to get back
location @error401 {
return 302 ${baseURL}/login?go=${i.auth.redirect};
}
# If the user is lead to /logout redirect them to the logout endpoint
# of ngninx-sso which then will redirect the user to / on the current host
location ${i.logout.path} {
return 302 ${baseURL}/logout?go=${i.logout.redirect};
}
'';
"nginx/includes/sso/location-${n}.conf".text = ''
# Protect this location using the auth_request
auth_request ${i.auth.path};
# Redirect the user to the login page when they are not logged in
error_page 401 = @error401;
# Automatically renew SSO cookie on request
auth_request_set $cookie $upstream_http_set_cookie;
add_header Set-Cookie $cookie;
'';
}) instances);
users = {
groups.nginx-sso = {};
users.nginx-sso = {
group = "nginx-sso";
isSystemUser = true;
};
};
systemd.services.nginx-sso = {
description = "Nginx SSO Backend";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
preStart = ''
umask 066
${if (cfg.extraConfigFile != null) then ''
${pkgs.yq-go}/bin/yq -P '. *= load("${cfg.extraConfigFile}")' "${baseConfig}" > ${runCfg}
'' else ''
${pkgs.yq-go}/bin/yq -P "${baseConfig}" > ${runCfg}
''}
'';
serviceConfig = {
RuntimeDirectory = "nginx-sso";
User = "nginx-sso";
Group = "nginx-sso";
ExecStart = [
# Specify twice to clear original value
""
''${pkg}/bin/nginx-sso --frontend-dir ${pkg}/share/frontend --config ${runCfg}''
];
};
};
};
}
-102
View File
@@ -1,102 +0,0 @@
{ lib, pkgs, config, ... }:
let
inherit (lib) mkIf mapAttrsToList filterAttrs;
inherit (lib.my) mkOpt' mkBoolOpt';
cfg = config.my.pocket-id;
pocketId = config.services.pocket-id;
groupOpts = { name, ... }: {
options = with lib.types; {
friendlyName = mkOpt' str name "Name shown in Pocket ID's UI.";
};
};
clientOpts = { name, ... }: {
options = with lib.types; {
name = mkOpt' str name "Name shown to users when they sign in.";
callbackURLs = mkOpt' (listOf str) [ ] "Allowed redirect URLs after sign-in.";
logoutCallbackURLs = mkOpt' (listOf str) [ ] "Allowed redirect URLs after sign-out.";
launchURL = mkOpt' (nullOr str) null "URL that Pocket ID's app list links to.";
public = mkBoolOpt' false "Whether this is a public client (no secret).";
pkce = mkBoolOpt' false "Whether to require PKCE.";
allowedGroups = mkOpt' (listOf str) [ ]
"Pocket ID groups (by name) whose members may sign in; any user may when empty.";
secret = {
file = mkOpt' (nullOr path) null "File holding the client secret.";
key = mkOpt' (nullOr str) null
"Read the secret from this key of an env file instead of the whole file.";
};
extraSettings = mkOpt' (attrsOf unspecified) { }
"Extra fields of Pocket ID's client API object (e.g. `skipConsent`).";
};
};
spec = pkgs.writeText "pocket-id-sync.json" (builtins.toJSON {
groups = mapAttrsToList (n: g: { name = n; inherit (g) friendlyName; }) cfg.groups;
clients = mapAttrsToList (id: c: {
inherit id;
groups = c.allowedGroups;
secret = c.secret.file != null;
secretKey = c.secret.key;
settings = {
inherit (c) name callbackURLs logoutCallbackURLs launchURL;
isPublic = c.public;
pkceEnabled = c.pkce;
isGroupRestricted = c.allowedGroups != [ ];
} // c.extraSettings;
}) cfg.clients;
});
sync = pkgs.writers.writePython3 "pocket-id-sync" {
flakeIgnore = [ "E501" ];
} (builtins.readFile ./sync.py);
in
{
options.my.pocket-id = with lib.types; {
enable = mkBoolOpt' false "Whether to manage Pocket ID groups and OIDC clients declaratively.";
apiKeyFile = mkOpt' path null "File holding Pocket ID's static API key (at least 16 characters).";
groups = mkOpt' (attrsOf (submodule groupOpts)) { }
"User groups to create; membership is managed in Pocket ID.";
clients = mkOpt' (attrsOf (submodule clientOpts)) { } "OIDC clients, by client ID.";
};
config = mkIf cfg.enable {
assertions = mapAttrsToList (id: c: {
assertion = c.public == (c.secret.file == null);
message = "my.pocket-id.clients.${id}: a client needs a secret unless it is public.";
}) cfg.clients;
services.pocket-id = {
enable = true;
credentials.STATIC_API_KEY = cfg.apiKeyFile;
};
systemd.services.pocket-id-sync = {
description = "Pocket ID groups and OIDC clients";
requires = [ "pocket-id.service" ];
after = [ "pocket-id.service" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "${sync} ${spec} http://127.0.0.1:${toString pocketId.settings.PORT}";
DynamicUser = true;
RuntimeDirectory = "pocket-id-sync";
StateDirectory = "pocket-id-sync";
LoadCredential = [ "api-key:${cfg.apiKeyFile}" ]
++ mapAttrsToList (id: c: "client-${id}:${c.secret.file}")
(filterAttrs (_: c: c.secret.file != null) cfg.clients);
CapabilityBoundingSet = "";
NoNewPrivileges = true;
PrivateDevices = true;
PrivateTmp = true;
ProtectHome = true;
ProtectSystem = "strict";
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ];
};
};
};
}
-151
View File
@@ -1,151 +0,0 @@
"""Create and update Pocket ID user groups and OIDC clients from a JSON spec.
Usage: pocket-id-sync <spec.json> <base URL>
Credentials come from systemd's $CREDENTIALS_DIRECTORY: `api-key` (the static API key) and
`client-<id>` (each confidential client's secret). Hashes of the secrets that were set are
kept in $STATE_DIRECTORY, since Pocket ID only shows a secret's first few characters.
"""
import hashlib
import json
import os
import sys
import time
import urllib.error
import urllib.request
from pathlib import Path
# Fields of a client that the update endpoint accepts
CLIENT_FIELDS = [
'name', 'description', 'callbackURLs', 'logoutCallbackURLs', 'backchannelLogoutURL',
'isPublic', 'pkceEnabled', 'requiresReauthentication', 'requiresPushedAuthorizationRequests',
'skipConsent', 'credentials', 'launchURL', 'hasLogo', 'hasDarkLogo', 'isGroupRestricted',
'accessTokenDurationMinutes', 'refreshTokenDurationMinutes',
]
SECRET_PREFIX_LENGTH = 4
class NotFound(Exception):
pass
class API:
def __init__(self, base, key):
self.base = base
self.key = key
def request(self, method, path, body=None):
data = None if body is None else json.dumps(body).encode()
req = urllib.request.Request(
f'{self.base}/api{path}', data=data, method=method,
headers={'X-API-Key': self.key, 'Content-Type': 'application/json'})
try:
with urllib.request.urlopen(req) as res:
content = res.read()
except urllib.error.HTTPError as e:
if e.code == 404:
raise NotFound(path) from e
raise RuntimeError(f'{method} {path}: HTTP {e.code}: {e.read().decode()}') from e
return json.loads(content) if content else None
def wait(self, timeout=60):
for _ in range(timeout):
try:
with urllib.request.urlopen(f'{self.base}/healthz'):
return
except OSError:
time.sleep(1)
raise RuntimeError('Pocket ID did not become healthy')
def read_secret(path, key):
text = path.read_text()
if key is None:
return text.rstrip('\n')
# A plain env file, as `slop secret` writes it
value = None
for line in text.splitlines():
name, sep, v = line.removeprefix('export ').partition('=')
if sep and name == key:
value = v
if value is None:
raise RuntimeError(f'{path} has no {key}')
if len(value) >= 2 and value[0] == value[-1] == '"':
value = value[1:-1]
return value
def sync_groups(api, groups):
existing = {g['name']: g for g in api.request('GET', '/user-groups?pagination[limit]=1000')['data']}
for group in groups:
current = existing.get(group['name'])
if current is None:
print(f"Creating group {group['name']}")
api.request('POST', '/user-groups', group)
elif current['friendlyName'] != group['friendlyName']:
print(f"Updating group {group['name']}")
api.request('PUT', f"/user-groups/{current['id']}", group)
return {g['name']: g['id'] for g in api.request('GET', '/user-groups?pagination[limit]=1000')['data']}
def sync_secret(api, client_id, value, state_dir):
digest = hashlib.sha256(f'{client_id}\n{value}'.encode()).hexdigest()
state = state_dir / f'{client_id}.sha256'
secrets = api.request('GET', f'/oidc/clients/{client_id}/secrets')
installed = any(s['isActive'] and s['prefix'] == value[:SECRET_PREFIX_LENGTH] for s in secrets)
if installed and state.exists() and state.read_text() == digest:
return
print(f'Setting the secret of client {client_id}')
new = api.request('POST', f'/oidc/clients/{client_id}/secrets', {'secret': value})
for s in secrets:
if s['id'] != new['id']:
api.request('DELETE', f"/oidc/clients/{client_id}/secrets/{s['id']}")
state.write_text(digest)
def sync_client(api, client, group_ids, creds, state_dir):
client_id = client['id']
settings = client['settings']
# Update on top of the current client, so fields managed in the UI (like logos) stay
try:
current = api.request('GET', f'/oidc/clients/{client_id}')
except NotFound:
print(f'Creating client {client_id}')
api.request('POST', '/oidc/clients', {**settings, 'id': client_id})
else:
merged = {**current, **settings}
api.request('PUT', f'/oidc/clients/{client_id}', {f: merged.get(f) for f in CLIENT_FIELDS})
unknown = [g for g in client['groups'] if g not in group_ids]
if unknown:
raise RuntimeError(f'Client {client_id}: unknown groups {unknown}')
api.request('PUT', f'/oidc/clients/{client_id}/allowed-user-groups',
{'userGroupIds': [group_ids[g] for g in client['groups']]})
if client['secret']:
value = read_secret(creds / f'client-{client_id}', client['secretKey'])
sync_secret(api, client_id, value, state_dir)
def main():
spec = json.loads(Path(sys.argv[1]).read_text())
creds = Path(os.environ['CREDENTIALS_DIRECTORY'])
state_dir = Path(os.environ['STATE_DIRECTORY'])
api = API(sys.argv[2], (creds / 'api-key').read_text().strip())
api.wait()
group_ids = sync_groups(api, spec['groups'])
for client in spec['clients']:
sync_client(api, client, group_ids, creds, state_dir)
if __name__ == '__main__':
main()
+6 -7
View File
@@ -2,8 +2,8 @@ let
self = getFlake (toString ./.); self = getFlake (toString ./.);
inherit (self) lib; inherit (self) lib;
inherit (builtins) mapAttrs readFile getFlake; inherit (builtins) mapAttrs attrValues readFile getFlake;
inherit (lib) fileContents optional flatten zipAttrsWith nameValuePair mapAttrs' mapAttrsToList; inherit (lib) fileContents optional flatten zipAttrsWith nameValuePair mapAttrs';
secretPath = p: "secrets/${p}.age"; secretPath = p: "secrets/${p}.age";
@@ -15,13 +15,12 @@ let
secretKeys = secretKeys =
zipAttrsWith zipAttrsWith
(_: keys: flatten (keys ++ defaultKeys)) (_: keys: flatten (keys ++ defaultKeys))
(mapAttrsToList (map
# The comment names the key in `slop-broker` approvals; age ignores it (c: let cfg = c.config.my.secrets; in mapAttrs'
(name: c: let cfg = c.config.my.secrets; in mapAttrs'
(f: _: nameValuePair (f: _: nameValuePair
(secretPath f) (secretPath f)
(optional (cfg.key != null) "${cfg.key} ${name}")) (optional (cfg.key != null) cfg.key))
cfg.files) cfg.files)
self.nixosConfigurations); (attrValues self.nixosConfigurations));
in in
mapAttrs (_: keys: { publicKeys = keys; }) secretKeys mapAttrs (_: keys: { publicKeys = keys; }) secretKeys
-15
View File
@@ -1,15 +0,0 @@
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IGpJOFJBZyBzU2lH
U05YNG5ISEJtTklOZmZRUUI3MWxuU1JRWG0vNEIxekt3NTdWYVdJCldDMENWenl1
ZmZCTW1ySFBXZFEvbHZhR0NDOWpLSzhNRTZUcFU1NWZXUWcKLT4gc3NoLWVkMjU1
MTkgVkZjdzVnIDdXSXdnK1VvQzJrbWMyRzltL3BZMEZPV2pEV1lSUW5ySXkxaDRC
RjRMVDAKRjVRSm9sMGRNUTBWYkdWNlEwKzNTTU8xRXBmV1JDREhtNThabFRIVERU
MAotPiBYMjU1MTkgdHFnZ1RKQlRDTmg0TksvaGgrUER6SU5MYWV6WlpEWXA3Qktv
MFZJTktTSQpyMHhRb0FNeGFFZkIvUUxjMWlVbkxRY2pKZnhSanlrUWFITWZHUE1i
dldvCi0+IFgyNTUxOSBGbkhrVlZYYjZIakZ5MnZ5ZDJXdnoycEVtL08zYjNjNUty
OTY2amsrWTJnCk9neE80T25naFBDV3pjZXh0QmFKNW9YZ1VHdXJsREJidHlNRUY5
Y0haTDAKLT4gdEkuc210LWdyZWFzZSA0UT5jYyBkICUgIzArNQpCVE5aQnM1blNO
L0Nvb1hDMTRSOVNHUmlTM1lmZWcKLS0tIGFBTDN1ZUhSM21LaVFLZDBUQkFJcDJZ
OUVSYVp5Q2NIL01IUTNsSmQ3Y2MKAuYjogUq28f/Cdf5jd/RkWaPZEqA+qGAmTnx
fXgii0zfKVsAMGtro8wB4RdKYcvyW86k7zYaZobXHzR4ApCF+Zg=
-----END AGE ENCRYPTED FILE-----
-13
View File
@@ -1,13 +0,0 @@
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IFZGY3c1ZyByOEdE
dStNQUxBS2I4OFBNdjc1ek5VQ1d3UnIxMldmQllTVlhXdjFWdkZNClRQeVNxajBO
bjBJRHRKTTJBOG1yZlV3VHFKRjVvN2ZoZjhmM3daQWQ2SjgKLT4gWDI1NTE5IDdJ
OTQ1NlNIbUJHWE9wN0J4Qi82ZVhXZTUvbE14SDR5TlErYnRyRHNPeU0KaGJIZVE1
WGt6N0NnZ0Q2TXBZRm9hOXJMSVY2Vis4TExBQnVETk1zZE53YwotPiBYMjU1MTkg
RHVZS2VKUUxSdkk4aEQ5cGV4WkFQNDFZTnBlMmRrMjdCcHRPbDlYRzFIdwpVNG5R
eHRsSGIyQnVKNE5qenlEa0cwcmw4NUpERHlnRlFYck9kckVTMVp3Ci0+IDNIKil9
cSUtZ3JlYXNlIHMpK15qdwpnMkI3MzhjMHFkUlh0QWFvUWdJR1lsSFNuVFo5QVg1
MWRXM3M5Q1hEWlAyOEoxVFR2dwotLS0gUTRlTTBuSG5vbm5Cc2wwa0JZajZoZXBP
b0tPdjFEWHh2WHN5QVFxQStVYwqJgKKXVzhl1hAzrjCjL9Ms50Opvs0OEp9K0ncS
hBKY7L8jR0mPVdZrTSlA249HW22nAYXxt419WMt9wITs3lDwiA==
-----END AGE ENCRYPTED FILE-----
+23
View File
@@ -0,0 +1,23 @@
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IFZGY3c1ZyBjYUdx
QkdtWUFpWTNiSUljaVRtQnRETktCZVYxQkkyQzRTWVhUanJKZDM0CnlhRXFML01Y
ZWVNVDBiS3I1S1NnMDFGUzh4ZUx6eFFuQjlKSTYrWmNDTjAKLT4gWDI1NTE5IHRk
OGNCMTFsN09ua0FHY3JkUjEzREZScCtDVDEwOEZPdzFWa3UvUW5mWEEKVXhubUd3
b2dWMTByUm5IRGZlSmhnU3luNU1RemU0ZElsZy9kOWE2eHNYUQotPiBYMjU1MTkg
b28vSU1RdTB1NG5TRHFZZkREc2l0cWVoOEZJdmhRTWJLS2VEOFN4NVBCZwpGcFFz
U24rTEJhZGdVY3Nla1FkSmZwNStENElLS1RHZlphU0pPb3FOV1NnCi0+IHI2Inot
Z3JlYXNlIGogKFFbZ2wgQ3AgYV9wWSVlPyUKK201VFJOUUF5U3FJbGFNaTBJc2dW
ZDUvbzBkZ1NxNUdqc0RYN2ZhNE9VMjRGcTdrdUFhMEVZZ1M0SFZ6a2pHMQpwa2hB
OE40UnBqS1Z4K3FwYWcKLS0tIG9iem93TDlNTEZKcjR1RjZZVzJkZzVDbGpYb0RV
TDFrUkdWcEtpTXp3cTAKFSJ4JWRlInDZOngwNKx2MuiR34SegxSS3l/j0sLeRXjf
RCScLwFQOUeuYZ6t9yIXp2oekftODiDFNiA5fY8UiTzhbqXVHO/9mpbkaSZ8C5Nw
VymCLTf4WZX0vphPCTW0hM4nCdhdmY480U7vyen8il1pjhWgOFXm3AeOV3StG1KA
Pu2m1jf9aceXoEblVI4RqFBkbwpYFnD+X0bKA6LUddk8jvz36s/eqAhMuw/L7KU3
Fgd4vwU5qw5lgSEfKSkHednd4YDkc1dpTTzGIQ/L/ogfSqU3z1xp557VweGB3sjS
QJSyY/Gj+Fzs1SUi0J1ot3TNYHiwM/QrzfNFj2gQqi/T6EfBhbtNfkkn4fgWh/ob
dPXx6m3mB1MXMI69jy72v3Ejg9eqzmtv1uu2z7aoVU2vxhRKIN8y69oW+pMdbx5A
u1RlPeJMlQXs8lIuA9x+UN3FEuXvq1YZv7SQL+RQWzCBIdb1XE6OyyvIzGdHts/N
fJWo4PjnikpDk3zIPAdRdzvg+JjH8/7DwXxffC7uddeQ/rnKmL3y1OgVdjTeDuZv
f7HfAj6K8BDz3zTZhuGbuhpbPhifzw5kg3H83mm1QdXlAH2CLRfnWUtBuoCV+DbZ
1JyluvXr7PYlIFktmeWUMOyrYPeGbHIbrmbJGi3BGxN7csMkpAJ5
-----END AGE ENCRYPTED FILE-----
-15
View File
@@ -1,15 +0,0 @@
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IFZGY3c1ZyA1U0lS
N2NNc1ZNTVZNekNiN0RUeTFCcXd4b1p5ZFd1WW53Sm5SZHNJQXprCnVpUGR2VDBE
R1hZUFdHYjFOMUNGMDZ6cTQ4bHRtWHkxS2RaR1BTcDg4dDAKLT4gWDI1NTE5IHRO
QjAzcUN6UC9kZ0psV1VkMU0vNTNyYUYxb3FNRmtvUmFDQ1U4RnNhUzAKOUEyVzNm
TGlLUEpuOFR6ZmlGOUdueFpBNS9IN1pLcWh0Z0RadFJ1Mi9IYwotPiBYMjU1MTkg
Vm0wNXdrd2g1VkxUTHJGQVcrcHZlVGpES0xTaEMyVzl1Y2hqLzNFY3JoRQpqTnNi
dk1pOWowQ3JSa1FHTTV6MzdsM2Z1K1U2UC9rcXRnTCt5clJPaHZnCi0+IC08Ui1n
cmVhc2UgQk85bSJEMyA+Y2Ywb1oKTXJZK21pME03L1E0NDFQV2tWRTBzOUpzakVE
eGZpR2drbTFtNmltRnduamRHTlhWY2lHQUJ2awotLS0gNkdzZDVDUEVlOHpEazJG
SVdhd3RVRDduNmR0TkRaeFlBTUViOHFzT2Zmdwru/OT2cMuikwH9vsUoMQKv/Vw/
8GENAp13h4yh35bBbvkfMWAuuSu6r3BGyz7G2vytG+ntZFUO01QGVkphORqWd03Q
aqspunHGf6HXRH0BzS7npRQgFPkT9pTSpg7AFR6LXkj4uWliqw/m8YRPlG9Fifb2
20Jhh5zhAcPPdiiERK4U7s7D8DDsDAFpjNMeOXx9sAdT2fcWrA==
-----END AGE ENCRYPTED FILE-----
-13
View File
@@ -1,13 +0,0 @@
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IFZGY3c1ZyBvclJm
YnRLby9ubU5tcWVvbVFud0sweW9aYmowSWRSY2xWNjlGME40SUZNCkFkZmcyWG9O
SFlWWWtnMnduS1FSN3VCUHNzWUtPUitvTXNaZ0tLYy8xSlEKLT4gWDI1NTE5IDd2
UjcwOTNERFVwYWRnTXhyYWd1MUN0ZnRKNERrUjB2VTRrNzVLRU1RbU0KaXlFYXRN
MmFtRE1DNDNkNUMyaG1vR0lvRlk0OFkzUHlQMWZrWVJzYlY1QQotPiBYMjU1MTkg
SXlFUFR4WU9wUFhrRndOTUkvOGJsRHMxQ0VDOGxtRGNLVmNPaGJpcmxHYwpoUFJp
SVcveVIvT3REWjllaDVFRHpzeC92b1ViaDRURmN5UEJadk9scFVZCi0+IHtJZGAt
Z3JlYXNlICNoR1R2CkF0VlVtVTAwb0FFVXNBUEZ3QmtyNzk0czdSdUl1VHpVNlVL
ZUg2U0VUVEEwTGZKRAotLS0gc21CdkE3UDB0WmJqaDNER25oRGVvYkszMld3VkFX
UHoyaFRZVlA1ZHRIdwoq976vf2z9nu4ssEQ8S3+HSGf9BfXcH8Jrc+D83yYjy6Dp
lWMspu8Gr7y+nshtzXoyVu7GbmLNT6trsvOTIp6/tg==
-----END AGE ENCRYPTED FILE-----