about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRuby Iris Juric <ruby@srxl.me>2023-12-30 13:19:24 +1100
committerRuby Iris Juric <ruby@srxl.me>2024-01-01 18:38:00 +1100
commitdd38622bab55b9eb96ecc26f0be5d38ee1b89fe0 (patch)
tree411d8cd511f63291ee68375009753ccf98389fd0
parent067c1958fa35b2b994944da7f4fe3fc7f326e418 (diff)
zitadel: use local plugins for console protobuf generation
Previously, the console portion of ZITADEL used Buf remote plugins to generate
sources. This resulted in the hash for the protobuf generated code changing
whenever the remote builders changed. This change patches the console
configuration to use local plugins from Nixpkgs instead of remote ones, to
ensure the output isn't influenced by remote changes.
-rw-r--r--pkgs/by-name/zi/zitadel/console-use-local-protobuf-plugins.patch21
-rw-r--r--pkgs/by-name/zi/zitadel/console.nix11
-rw-r--r--pkgs/by-name/zi/zitadel/package.nix1
3 files changed, 32 insertions, 1 deletions
diff --git a/pkgs/by-name/zi/zitadel/console-use-local-protobuf-plugins.patch b/pkgs/by-name/zi/zitadel/console-use-local-protobuf-plugins.patch
new file mode 100644
index 0000000000000..4babb92b25f9d
--- /dev/null
+++ b/pkgs/by-name/zi/zitadel/console-use-local-protobuf-plugins.patch
@@ -0,0 +1,21 @@
+diff --git a/console/buf.gen.yaml b/console/buf.gen.yaml
+index 1737c2ded..d6affa8bc 100644
+--- a/console/buf.gen.yaml
++++ b/console/buf.gen.yaml
+@@ -3,12 +3,12 @@ version: v1
+ managed:
+   enabled: true
+ plugins:
+-  - plugin: buf.build/protocolbuffers/js
++  - plugin: js
+     out: src/app/proto/generated
+     opt: import_style=commonjs,binary
+-  - plugin: buf.build/grpc/web
++  - plugin: grpc-web
+     out: src/app/proto/generated
+     opt: import_style=typescript,mode=grpcweb
+-  - plugin: buf.build/grpc-ecosystem/openapiv2
++  - plugin: openapiv2
+     out: src/app/proto/generated
+     opt: allow_delete_body
+\ No newline at end of file
diff --git a/pkgs/by-name/zi/zitadel/console.nix b/pkgs/by-name/zi/zitadel/console.nix
index b9ec209dda730..bd67c47e57430 100644
--- a/pkgs/by-name/zi/zitadel/console.nix
+++ b/pkgs/by-name/zi/zitadel/console.nix
@@ -6,15 +6,24 @@
 { mkYarnPackage
 , fetchYarnDeps
 , lib
+
+, grpc-gateway
+, protoc-gen-grpc-web
+, protoc-gen-js
 }:
 
 let
   protobufGenerated = generateProtobufCode {
     pname = "zitadel-console";
+    nativeBuildInputs = [
+      grpc-gateway
+      protoc-gen-grpc-web
+      protoc-gen-js
+    ];
     workDir = "console";
     bufArgs = "../proto --include-imports --include-wkt";
     outputPath = "src/app/proto";
-    hash = "sha256-NmlKjKWxmqatyR6OitlQ7bfl6U6PS6KWqTALwX42HS4=";
+    hash = "sha256-Bpoe1UZGLTxUqdLbvOod6/77R4CsYQ4PirMfqvI9Lz8=";
   };
 in
 mkYarnPackage rec {
diff --git a/pkgs/by-name/zi/zitadel/package.nix b/pkgs/by-name/zi/zitadel/package.nix
index 03216c406209f..aa2a0be622eb0 100644
--- a/pkgs/by-name/zi/zitadel/package.nix
+++ b/pkgs/by-name/zi/zitadel/package.nix
@@ -62,6 +62,7 @@ let
       name = "${pname}-buf-generated";
 
       src = zitadelRepo;
+      patches = [ ./console-use-local-protobuf-plugins.patch ];
 
       nativeBuildInputs = nativeBuildInputs ++ [ buf ];