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-10-17 22:30:29 +02:00
|
|
|
vendorHash = "sha256-EoxvI1J+w0R+oACAVx9FhUG5VhDyzXuN2Vu2iEhgh94=";
|
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 "-----------------------------"
|
2023-10-17 22:00:00 +02:00
|
|
|
echo ".pb.go files need to be updated, mg run //tvix/store-go/generate"
|
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
|
|
|
})
|