about summary refs log tree commit diff
path: root/tvix/castore-go
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/castore-go')
-rw-r--r--tvix/castore-go/default.nix10
1 files changed, 8 insertions, 2 deletions
diff --git a/tvix/castore-go/default.nix b/tvix/castore-go/default.nix
index 09bbb77f81d4..c5fe2f5d7834 100644
--- a/tvix/castore-go/default.nix
+++ b/tvix/castore-go/default.nix
@@ -1,5 +1,10 @@
 { depot, pkgs, ... }:
 
+let
+  regenerate = pkgs.writeShellScriptBin "regenerate" ''
+    (cd $(git rev-parse --show-toplevel)/tvix/castore-go && rm *.pb.go && cp ${depot.tvix.castore.protos.go-bindings}/*.pb.go . && chmod +w *.pb.go)
+  '';
+in
 (pkgs.buildGoModule {
   name = "castore-go";
   src = depot.third_party.gitignoreSource ./.;
@@ -10,10 +15,10 @@
       label = ":water_buffalo: ensure generated protobuf files match";
       needsOutput = true;
       command = pkgs.writeShellScript "pb-go-check" ''
-        ${depot.tvix.castore-go-generate}
+        ${regenerate}
         if [[ -n "$(git status --porcelain -unormal)" ]]; then
             echo "-----------------------------"
-            echo ".pb.go files need to be updated, run //tvix:castore-go-generate"
+            echo ".pb.go files need to be updated, mg run //tvix/castore-go/regenerate"
             echo "-----------------------------"
             git status -unormal
             exit 1
@@ -22,4 +27,5 @@
       alwaysRun = true;
     };
   };
+  passthru.regenerate = regenerate;
 })