2023-10-17 14:42:58 +02:00
|
|
|
{ depot, pkgs, ... }:
|
|
|
|
|
2023-10-17 22:00:00 +02:00
|
|
|
let
|
2023-11-05 13:36:47 +01:00
|
|
|
regenerate = pkgs.writeShellScript "regenerate" ''
|
2023-10-17 22:00:00 +02:00
|
|
|
(cd $(git rev-parse --show-toplevel)/tvix/store-go && rm *.pb.go && cp ${depot.tvix.store.protos.go-bindings}/*.pb.go . && chmod +w *.pb.go)
|
|
|
|
'';
|
|
|
|
in
|
2023-10-17 14:42:58 +02:00
|
|
|
(pkgs.buildGoModule {
|
|
|
|
name = "store-go";
|
|
|
|
src = depot.third_party.gitignoreSource ./.;
|
2023-11-05 13:27:01 +01:00
|
|
|
vendorHash = "sha256-JAxjSI4efCwbAUbvS7AQ5ZbVlf3ebGDBzDFMTK7dvl4=";
|
2023-10-17 14:42:58 +02:00
|
|
|
}).overrideAttrs (_: {
|
|
|
|
meta.ci.extraSteps = {
|
|
|
|
check = {
|
|
|
|
label = ":water_buffalo: ensure generated protobuf files match";
|
|
|
|
needsOutput = true;
|
|
|
|
command = pkgs.writeShellScript "pb-go-check" ''
|
2023-10-17 22:00:00 +02:00
|
|
|
${regenerate}
|
2023-10-17 14:42:58 +02:00
|
|
|
if [[ -n "$(git status --porcelain -unormal)" ]]; then
|
|
|
|
echo "-----------------------------"
|
2024-01-13 19:21:34 +01:00
|
|
|
echo ".pb.go files need to be updated, mg run //tvix/store-go/regenerate"
|
2023-10-17 14:42:58 +02:00
|
|
|
echo "-----------------------------"
|
|
|
|
git status -unormal
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
alwaysRun = true;
|
|
|
|
};
|
|
|
|
};
|
2023-10-17 22:00:00 +02:00
|
|
|
passthru.regenerate = regenerate;
|
2023-10-17 14:42:58 +02:00
|
|
|
})
|