tvl-depot/tvix/store-go/default.nix
Florian Klink 72760b7716 chore(tvix/store-go): bump castore-go
Change-Id: I740251785f4ffb6c9305f430e0f2c3418dfaa15d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9957
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
2023-11-05 20:32:34 +00:00

31 lines
1,022 B
Nix

{ depot, pkgs, ... }:
let
regenerate = pkgs.writeShellScript "regenerate" ''
(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
(pkgs.buildGoModule {
name = "store-go";
src = depot.third_party.gitignoreSource ./.;
vendorHash = "sha256-JAxjSI4efCwbAUbvS7AQ5ZbVlf3ebGDBzDFMTK7dvl4=";
}).overrideAttrs (_: {
meta.ci.extraSteps = {
check = {
label = ":water_buffalo: ensure generated protobuf files match";
needsOutput = true;
command = pkgs.writeShellScript "pb-go-check" ''
${regenerate}
if [[ -n "$(git status --porcelain -unormal)" ]]; then
echo "-----------------------------"
echo ".pb.go files need to be updated, mg run //tvix/store-go/generate"
echo "-----------------------------"
git status -unormal
exit 1
fi
'';
alwaysRun = true;
};
};
passthru.regenerate = regenerate;
})