diff options
author | Florian Klink <flokli@flokli.de> | 2023-12-09T14·28+0200 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-12-11T21·43+0000 |
commit | a1b2dc8aaf87b73025f4090308c9649e8bf66a99 (patch) | |
tree | c97cbc4bda657a98b99348b1d3b02f7026b1a821 /tvix/build-go/default.nix | |
parent | fd27d8ddc3a27fd89a3a132343c6a1ad8da3671c (diff) |
feat(tvix/build-go): init r/7152
This adds the generated golang bindings for tvix-build. Change-Id: I2eb0d1cc38bc2fa34afd7c904eea05c5ee192cce Reviewed-on: https://cl.tvl.fyi/c/depot/+/10242 Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de> Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Diffstat (limited to 'tvix/build-go/default.nix')
-rw-r--r-- | tvix/build-go/default.nix | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tvix/build-go/default.nix b/tvix/build-go/default.nix new file mode 100644 index 000000000000..62cd01b0f932 --- /dev/null +++ b/tvix/build-go/default.nix @@ -0,0 +1,31 @@ +{ depot, pkgs, ... }: + +let + regenerate = pkgs.writeShellScript "regenerate" '' + (cd $(git rev-parse --show-toplevel)/tvix/build-go && rm *.pb.go && cp ${depot.tvix.build.protos.go-bindings}/*.pb.go . && chmod +w *.pb.go) + ''; +in +(pkgs.buildGoModule { + name = "build-go"; + src = depot.third_party.gitignoreSource ./.; + vendorHash = "sha256-BprOPkgyT1F6TNToCN2uSHlkCXMdmv/QK+lTvA6O/rM="; +}).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/build-go/regenerate" + echo "-----------------------------" + git status -unormal + exit 1 + fi + ''; + alwaysRun = true; + }; + }; + passthru.regenerate = regenerate; +}) |