diff options
Diffstat (limited to 'tvix/store-go/default.nix')
-rw-r--r-- | tvix/store-go/default.nix | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tvix/store-go/default.nix b/tvix/store-go/default.nix new file mode 100644 index 000000000000..e4c3efd7add1 --- /dev/null +++ b/tvix/store-go/default.nix @@ -0,0 +1,31 @@ +{ 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/regenerate" + echo "-----------------------------" + git status -unormal + exit 1 + fi + ''; + alwaysRun = true; + }; + }; + passthru.regenerate = regenerate; +}) |