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>
38 lines
1.2 KiB
Nix
38 lines
1.2 KiB
Nix
# `rev` is the commit the build is from, like `2d59b59` or `2d59b59-dirty`, which the version
|
|
# shows. It's part of the build, so every commit rebuilds the package.
|
|
{ lib, rustPlatform, pkg-config, openssl, sqlite, rev ? null }:
|
|
let
|
|
inherit (lib.fileset) toSource unions;
|
|
inherit ((builtins.fromTOML (builtins.readFile ../Cargo.toml)).package) version;
|
|
in
|
|
rustPlatform.buildRustPackage {
|
|
pname = "slop-broker";
|
|
inherit version;
|
|
|
|
src = toSource {
|
|
root = ../.;
|
|
fileset = unions [ ../Cargo.toml ../Cargo.lock ../askama.toml ../src ../templates ../tests ../slop-tools.md ];
|
|
};
|
|
cargoLock.lockFile = ../Cargo.lock;
|
|
|
|
# OpenSSL for Web Push's payload encryption, SQLite for the web app's sessions
|
|
nativeBuildInputs = [ pkg-config ];
|
|
buildInputs = [ openssl sqlite ];
|
|
|
|
env = lib.optionalAttrs (rev != null) {
|
|
SLOP_BROKER_VERSION = "${version}+${rev}";
|
|
};
|
|
|
|
postInstall = ''
|
|
ln -s slop-broker $out/bin/slop-approve
|
|
install -Dm644 slop-tools.md $out/share/slop-broker/slop-tools.md
|
|
'';
|
|
|
|
meta = {
|
|
description = "Approval broker that runs privileged operations for coding agents";
|
|
license = lib.licenses.mit;
|
|
mainProgram = "slop";
|
|
platforms = lib.platforms.linux;
|
|
};
|
|
}
|