Builds from the flake show the commit they are from in the version, like `0.3.0+2d59b59`, or `0.3.0+2d59b59-dirty` with uncommitted changes. It shows in the web app, in `--version`, which `slop` and `slop-broker` now take, and in the error for an old protocol. The commit is part of the build, so every commit rebuilds the package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
2.6 KiB
Nix
69 lines
2.6 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});
|
|
|
|
# The commit the package's version shows, if the flake is from Git
|
|
rev = self.shortRev or self.dirtyShortRev or null;
|
|
|
|
# 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 { inherit rev; };
|
|
default = slop-broker;
|
|
# The demo's VMs (see `docs/demo.md`)
|
|
demo = import ./nix/demo/agent.nix { inherit pkgs slop-broker; };
|
|
demo-box = import ./nix/demo/box.nix { inherit pkgs; };
|
|
});
|
|
|
|
overlays.default = final: _prev: {
|
|
slop-broker = final.callPackage ./nix/package.nix { inherit rev; };
|
|
};
|
|
|
|
nixosModules = {
|
|
slop-broker = withPackage ./nix/modules/nixos/broker.nix [ "services" "slop-broker" ];
|
|
slop-broker-builder = withPackage ./nix/modules/nixos/builder.nix [ "services" "slop-broker-builder" ];
|
|
slop-broker-cache = ./nix/modules/nixos/cache.nix;
|
|
default = {
|
|
imports = with self.nixosModules; [ slop-broker slop-broker-builder slop-broker-cache ];
|
|
};
|
|
};
|
|
|
|
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; };
|
|
} // import ./nix/lints.nix { inherit pkgs; 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);
|
|
};
|
|
}
|