forked from
lass.pds.lassul.us/superconfig
This repository has no description
2.0 kB
92 lines
1{
2 generateProtobufCode,
3 jsDeps,
4 version,
5 zitadelRepo,
6}:
7
8{
9 lib,
10 stdenv,
11 callPackage,
12
13 grpc-gateway,
14 nodejs,
15 pnpmConfigHook,
16 protoc-gen-grpc-web,
17}:
18
19let
20 # console/buf.gen.yaml (`buf generate ../proto --include-imports
21 # --include-wkt` upstream), run against protoImage. It needs protoc-gen-js
22 # 4.0.2 to match the google-protobuf runtime of console/package.json.
23 consoleProtobufGenerated = generateProtobufCode {
24 pname = "zitadel-console";
25 inherit version;
26 nativeBuildInputs = [
27 grpc-gateway
28 protoc-gen-grpc-web
29 (callPackage ./protoc-gen-js.nix { })
30 ];
31 workDir = "console";
32 bufArgs = "--include-imports --include-wkt";
33 outputPath = "src/app/proto/generated";
34 };
35in
36stdenv.mkDerivation {
37 pname = "zitadel-console";
38 inherit version;
39
40 src = zitadelRepo;
41
42 inherit (jsDeps) pnpmDeps;
43 pnpmWorkspaces = [
44 "@zitadel/client"
45 "@zitadel/console"
46 "@zitadel/proto"
47 ];
48
49 nativeBuildInputs = [
50 nodejs
51 jsDeps.pnpm
52 pnpmConfigHook
53 ];
54
55 env.NODE_OPTIONS = "--max-old-space-size=8192";
56
57 preBuild = ''
58 cp -r ${jsDeps.protoPackageGenerated}/* packages/zitadel-proto/
59 mkdir -p console/src/app/proto
60 cp -r ${consoleProtobufGenerated} console/src/app/proto/generated
61 chmod -R u+w packages/zitadel-proto console/src/app/proto
62 '';
63
64 # The `build` scripts of the client package and the console, in the order
65 # nx.json's targetDefaults run them.
66 buildPhase = ''
67 runHook preBuild
68
69 pushd packages/zitadel-client
70 pnpm run build
71 popd
72
73 pushd console
74 pnpm run build
75 popd
76
77 runHook postBuild
78 '';
79
80 installPhase = ''
81 runHook preInstall
82 cp -r console/dist/console "$out"
83 runHook postInstall
84 '';
85
86 meta = {
87 description = "Management console for the ZITADEL identity and access management platform";
88 homepage = "https://zitadel.com/";
89 license = lib.licenses.agpl3Only;
90 platforms = lib.platforms.linux ++ lib.platforms.darwin;
91 };
92}