`slop-broker` runs privileged operations for coding agents under named policies (auto, ask or deny per operation), which requesters can share, with approvals from `slop-approve` or Home Assistant notifications and optional leases. The broker and the `slop` client talk over vsock, so a VM needs no network path to it. Messages are typed enums shared by both, CBOR-encoded and framed with `LengthDelimitedCodec`; decoding validates every value, and requests carry a protocol version. The first operation is `slop ssh`. The `services.slop-broker` NixOS module runs the broker as a hardened service from generated TOML, and a VM test exercises it over vsock loopback. devenv provides the development environment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
56 lines
1.9 KiB
Nix
56 lines
1.9 KiB
Nix
{
|
|
description = "Approval broker that runs privileged operations for coding agents";
|
|
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
outputs = { self, nixpkgs }:
|
|
let
|
|
inherit (nixpkgs) lib;
|
|
|
|
systems = [ "x86_64-linux" "aarch64-linux" ];
|
|
forSystems = f: lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
|
|
|
|
# Each module defaults its `package` to this flake's build for the system it's used on
|
|
withPackage = path: option: { lib, pkgs, ... }: {
|
|
imports = [ path ];
|
|
config = lib.setAttrByPath (option ++ [ "package" ])
|
|
(lib.mkDefault self.packages.${pkgs.stdenv.hostPlatform.system}.default);
|
|
};
|
|
in
|
|
{
|
|
packages = forSystems (pkgs: rec {
|
|
slop-broker = pkgs.callPackage ./nix/package.nix { };
|
|
default = slop-broker;
|
|
});
|
|
|
|
overlays.default = final: _prev: {
|
|
slop-broker = final.callPackage ./nix/package.nix { };
|
|
};
|
|
|
|
nixosModules = {
|
|
slop-broker = withPackage ./nix/modules/nixos/broker.nix [ "services" "slop-broker" ];
|
|
default = {
|
|
imports = with self.nixosModules; [ slop-broker ];
|
|
};
|
|
};
|
|
|
|
# The VM test needs KVM
|
|
checks = forSystems (pkgs: {
|
|
package = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
|
vm = pkgs.callPackage ./nix/vm-test.nix { slop-broker = self.packages.${pkgs.stdenv.hostPlatform.system}.default; };
|
|
});
|
|
|
|
# A plain alternative to the devenv shell, for `nix develop`: the toolchain and the build's
|
|
# inputs, without devenv's scripts or the demo
|
|
devShells = forSystems (pkgs: {
|
|
default = pkgs.mkShell {
|
|
inputsFrom = [ self.packages.${pkgs.stdenv.hostPlatform.system}.default ];
|
|
packages = with pkgs; [ clippy rustfmt rust-analyzer git nixpkgs-fmt ];
|
|
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
|
|
};
|
|
});
|
|
|
|
formatter = forSystems (pkgs: pkgs.nixpkgs-fmt);
|
|
};
|
|
}
|