flake: Add slop-broker from its own repository
The broker, its NixOS and home-manager modules and the agents' guide now live in the `slop-broker` repository, which this flake takes as an input: its overlay provides `pkgs.slop-broker`, and the common modules import `services.slop-broker*` and `programs.slop`. What's specific to these boxes stays here: tmproot persistence for the broker and its builder, `my.agents.slop` and the devshell's `slop` commands, which `docs/slop-broker.md` describes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
75f6c1a064
commit
71ed076f12
10 files changed
+108
-4
No files matched your search
@@ -35,6 +35,27 @@ in
|
||||
help = "Remove home-manager flake.nix link";
|
||||
command = "rm -f ${homeFlake}";
|
||||
}
|
||||
{
|
||||
name = "slop";
|
||||
category = "utilities";
|
||||
help = "Ask slop-broker for privileged operations (`slop guide`); uses `.keys/slop-request.key` if present";
|
||||
# Built from this checkout, so it matches the branch. Without a key it uses `SLOP_BROKER`,
|
||||
# `~/.config/slop/config.toml` or vsock, as the installed client does.
|
||||
command = ''
|
||||
key="$PRJ_ROOT/.keys/slop-request.key"
|
||||
if [ -z "''${SLOP_BROKER-}" ] && [ -f "$key" ]; then
|
||||
export SLOP_BROKER=ssh:slop@palace.h.nul.ie
|
||||
export SLOP_SSH="ssh -i $key -o IdentitiesOnly=yes -o IdentityAgent=none"
|
||||
fi
|
||||
exec ${pkgs.slop-broker}/bin/slop "$@"
|
||||
'';
|
||||
}
|
||||
{
|
||||
name = "slop-approve";
|
||||
category = "utilities";
|
||||
help = "Answer slop-broker requests; its key stays outside the checkout, where agents can't read it";
|
||||
command = ''exec ${pkgs.slop-broker}/bin/slop-approve "$@"'';
|
||||
}
|
||||
{
|
||||
name = "ragenix";
|
||||
category = "utilities";
|
||||
|
||||
@@ -94,6 +94,7 @@ The laptop is indexed in [`mobile/README.md`](mobile/README.md).
|
||||
## Misc
|
||||
|
||||
- [`misc/installer.md`](misc/installer.md) — the custom NixOS installer image.
|
||||
- [`slop-broker.md`](slop-broker.md) — how these boxes use `slop-broker`, the agents' approval broker.
|
||||
|
||||
## A note on the assignment tables
|
||||
|
||||
|
||||
@@ -42,8 +42,8 @@ username/password provider. Its cookie domain is `.nul.ie`; gated vhosts include
|
||||
|
||||
[Pocket ID](https://pocket-id.org) (`services.pocket-id`) is a passkey-only OpenID Connect
|
||||
provider at `id.nul.ie`, for apps that sign in with OIDC (first the `slop-broker` approvals web
|
||||
app). It is meant to replace nginx-sso's Google sign-in later, with oauth2-proxy in front of apps
|
||||
that lack OIDC.
|
||||
app, see [`slop-broker.md`](../../../../slop-broker.md)). It is meant to replace nginx-sso's
|
||||
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`
|
||||
(persisted by `my.tmproot`). The `middleman/pocket-id-encryption-key` secret encrypts it.
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# slop-broker
|
||||
|
||||
[`slop-broker`](https://git.nul.ie/dev/slop-broker) carries out privileged operations (SSH
|
||||
commands, deploys, builds, and later secrets, DNS and previews) for the coding agents on
|
||||
[`slop-cannon`](sites/home/slop-cannon.md) and other boxes, under a policy and usually after Dev
|
||||
approves each one. Agents use the `slop` CLI.
|
||||
|
||||
The broker, its NixOS and home-manager modules, its design and the agents' guide live in its own
|
||||
repository, which this flake takes as the `slop-broker` input. This page covers how these boxes use
|
||||
it; for how it works, read the repository's
|
||||
[design](https://git.nul.ie/dev/slop-broker/src/branch/main/docs/design.md).
|
||||
|
||||
## In this flake
|
||||
|
||||
- **Input:** `slop-broker` in [`flake.nix`](../flake.nix). Its overlay provides `pkgs.slop-broker`,
|
||||
and the common modules import `services.slop-broker`, `services.slop-broker-builder`,
|
||||
`services.slop-broker-cache` and `programs.slop`. Update it with `nix flake update slop-broker`.
|
||||
- **Persistence:** [`tmproot.nix`](../nixos/modules/tmproot.nix) keeps `/var/lib/slop-broker` and
|
||||
the builder's home when those services are enabled.
|
||||
- **Agents:** `my.agents.slop` (in the shared `agents` home-manager module) installs `slop` and adds
|
||||
the guide (`share/slop-broker/slop-tools.md`) as a Claude rule (`~/.claude/rules/slop.md`) and
|
||||
as Codex's `AGENTS.md`.
|
||||
- **Devshell:** `slop` and `slop-approve`, built from the locked input. `slop` uses
|
||||
`.keys/slop-request.key` over SSH when that file exists; an approver key never goes in `.keys/`,
|
||||
because agents can read the checkout.
|
||||
Generated
+23
-1
@@ -1196,7 +1196,8 @@
|
||||
"openwrt-feeds": "openwrt-feeds",
|
||||
"openwrt-imagebuilder": "openwrt-imagebuilder",
|
||||
"paseo": "paseo",
|
||||
"ragenix": "ragenix"
|
||||
"ragenix": "ragenix",
|
||||
"slop-broker": "slop-broker"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
@@ -1241,6 +1242,27 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"slop-broker": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs-unstable"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1795563488,
|
||||
"narHash": "sha256-fTRKZn95BBANQpEGkhrmHSoPb9yTl59ZfvfzVbXeo5g=",
|
||||
"ref": "main",
|
||||
"rev": "21c2d4715ec3bcf4a90b41c16125db75c599b8b7",
|
||||
"revCount": 26,
|
||||
"type": "git",
|
||||
"url": "https://git.nul.ie/dev/slop-broker"
|
||||
},
|
||||
"original": {
|
||||
"ref": "main",
|
||||
"type": "git",
|
||||
"url": "https://git.nul.ie/dev/slop-broker"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
|
||||
@@ -77,6 +77,8 @@
|
||||
# Pinned to a release. Don't make it follow our nixpkgs: its npm dependency hash is tied to its
|
||||
# own nixpkgs pin.
|
||||
paseo.url = "github:getpaseo/paseo/v0.15.4";
|
||||
slop-broker.url = "git+https://git.nul.ie/dev/slop-broker?ref=main";
|
||||
slop-broker.inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
borgthin.url = "github:devplayer0/borg";
|
||||
# TODO: Update borgthin so this works
|
||||
# borgthin.inputs.nixpkgs.follows = "nixpkgs-mine";
|
||||
@@ -167,6 +169,7 @@
|
||||
|
||||
myPkgsOverlay
|
||||
determinateOverlay
|
||||
inputs.slop-broker.overlays.default
|
||||
inputs.devshell.overlays.default
|
||||
inputs.ragenix.overlays.default
|
||||
inputs.deploy-rs.overlays.default
|
||||
@@ -183,6 +186,7 @@
|
||||
|
||||
myPkgsOverlay
|
||||
determinateOverlay
|
||||
inputs.slop-broker.overlays.default
|
||||
];
|
||||
|
||||
config = {
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
{ lib, pkgs, inputs, config, options, ... }:
|
||||
let
|
||||
inherit (lib) mkIf optionalAttrs;
|
||||
inherit (lib) mkIf optional optionalAttrs;
|
||||
inherit (lib.my) mkBoolOpt';
|
||||
|
||||
cfg = config.my.agents;
|
||||
agentPkgs = inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system};
|
||||
slopGuide = "${pkgs.slop-broker}/share/slop-broker/slop-tools.md";
|
||||
in
|
||||
{
|
||||
options.my.agents = {
|
||||
enable = mkBoolOpt' false "Whether to install and configure coding agents (Claude Code, Codex).";
|
||||
slop.enable = mkBoolOpt' false "Whether agents use the `slop` client for privileged operations.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = optional cfg.slop.enable pkgs.slop-broker;
|
||||
|
||||
programs = {
|
||||
# TODO: Remove mutableSettings guard when Home Manager 26.11 releases; 26.05 lacks it.
|
||||
codex = {
|
||||
@@ -34,11 +38,16 @@ in
|
||||
};
|
||||
} // optionalAttrs (options.programs.codex ? mutableSettings) {
|
||||
mutableSettings = true;
|
||||
} // optionalAttrs cfg.slop.enable {
|
||||
context = slopGuide;
|
||||
};
|
||||
|
||||
claude-code = {
|
||||
enable = true;
|
||||
package = agentPkgs.claude-code;
|
||||
rules = optionalAttrs cfg.slop.enable {
|
||||
slop = slopGuide;
|
||||
};
|
||||
settings = {
|
||||
model = "opus";
|
||||
theme = "auto";
|
||||
|
||||
@@ -12,6 +12,7 @@ in
|
||||
{
|
||||
# Disabled: breaks `nix flake check` in CI (see flake.nix pi-agent note).
|
||||
# imports = [ inputs.pi-agent.homeModules.default ];
|
||||
imports = [ inputs.slop-broker.homeModules.slop ];
|
||||
|
||||
options = with lib.types; {
|
||||
my = {
|
||||
|
||||
@@ -17,6 +17,7 @@ in
|
||||
inputs.harmonia.nixosModules.harmonia
|
||||
inputs.bootvine.nixosModules.default
|
||||
inputs.paseo.nixosModules.paseo
|
||||
inputs.slop-broker.nixosModules.default
|
||||
];
|
||||
|
||||
config = mkMerge [
|
||||
|
||||
@@ -479,6 +479,26 @@ in
|
||||
})
|
||||
(persistSimpleSvc "headscale")
|
||||
(persistSimpleSvc "pocket-id")
|
||||
(mkIf config.services.slop-broker.enable {
|
||||
my.tmproot.persistence.config.directories = [
|
||||
{
|
||||
directory = "/var/lib/slop-broker";
|
||||
user = "slop-broker";
|
||||
group = "slop-broker";
|
||||
mode = "0700";
|
||||
}
|
||||
];
|
||||
})
|
||||
(mkIf config.services.slop-broker-builder.enable {
|
||||
my.tmproot.persistence.config.directories = [
|
||||
{
|
||||
directory = "/var/lib/slop-broker-build";
|
||||
user = "slop-broker-build";
|
||||
group = "slop-broker-build";
|
||||
mode = "0700";
|
||||
}
|
||||
];
|
||||
})
|
||||
(mkIf config.services.tailscale.enable {
|
||||
my.tmproot.persistence.config.directories = [ "/var/lib/tailscale" ];
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user