Requesters and approvers on other boxes log in to the broker's box as `slop`. Each key has a forced `slop-broker remote <role> <name>`, which joins the session to the broker through a socket only `slop` can open, so the broker trusts the name like it trusts a vsock CID. A key does one job: the module refuses a key used for both roles. `slop` and `slop-approve` take `ssh:<destination>` addresses, from `SLOP_BROKER` and `SLOP_APPROVE` or else `~/.config/slop/config.toml`, and an approver connection now carries many requests. The `programs.slop` home-manager module installs both clients, a `Host` entry per key and that config file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
61 lines
2.0 KiB
Nix
61 lines
2.0 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 ];
|
|
};
|
|
};
|
|
|
|
homeModules = rec {
|
|
slop = withPackage ./nix/modules/home-manager/slop.nix [ "programs" "slop" ];
|
|
default = slop;
|
|
};
|
|
|
|
# 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);
|
|
};
|
|
}
|