This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

pkgs.zitadel: init at 4.19.5

Based on nixpkgs PR 561044 (zitadel 4.17.3), built from source with
the console and protoc-gen-js 4.0.2; without the Login V2 app.

+462
+92
pkgs/zitadel/console.nix
··· 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 + 19 + let 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 + }; 35 + in 36 + stdenv.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 + }
+69
pkgs/zitadel/javascript.nix
··· 1 + { 2 + stdenv, 3 + 4 + buf, 5 + fetchPnpmDeps, 6 + nodejs, 7 + pnpm_10, 8 + pnpmConfigHook, 9 + 10 + protoImage, 11 + version, 12 + zitadelRepo, 13 + }: 14 + 15 + let 16 + pnpm = pnpm_10; 17 + 18 + # The workspace packages the console needs out of the repository-wide 19 + # pnpm-lock.yaml. 20 + pnpmDeps = fetchPnpmDeps { 21 + pname = "zitadel"; 22 + inherit version pnpm; 23 + src = zitadelRepo; 24 + fetcherVersion = 4; 25 + pnpmWorkspaces = [ 26 + "@zitadel/client" 27 + "@zitadel/console" 28 + "@zitadel/proto" 29 + ]; 30 + hash = "sha256-8eW45vFB295KGIxdGIu+gpC9YDwZj0V+CTBZjx3i8aU="; 31 + }; 32 + 33 + # packages/zitadel-proto, generated by @bufbuild/protoc-gen-es from its npm 34 + # dev dependencies against protoImage instead of the proto tree. 35 + protoPackageGenerated = stdenv.mkDerivation { 36 + pname = "zitadel-proto-buf-generated"; 37 + inherit version; 38 + 39 + src = zitadelRepo; 40 + 41 + inherit pnpmDeps; 42 + pnpmWorkspaces = [ "@zitadel/proto" ]; 43 + 44 + nativeBuildInputs = [ 45 + buf 46 + nodejs 47 + pnpm 48 + pnpmConfigHook 49 + ]; 50 + 51 + buildPhase = '' 52 + runHook preBuild 53 + cd packages/zitadel-proto 54 + export PATH="$PWD/node_modules/.bin:$PATH" 55 + HOME=$TMPDIR buf generate ${protoImage}#format=binpb 56 + runHook postBuild 57 + ''; 58 + 59 + installPhase = '' 60 + runHook preInstall 61 + mkdir -p $out 62 + cp -r es cjs types $out/ 63 + runHook postInstall 64 + ''; 65 + }; 66 + in 67 + { 68 + inherit pnpm pnpmDeps protoPackageGenerated; 69 + }
+214
pkgs/zitadel/package.nix
··· 1 + # Based on nixpkgs PR 561044 (https://github.com/NixOS/nixpkgs/pull/561044, 2 + # zitadel 4.17.3), without the separate Login V2 app. 3 + { 4 + stdenv, 5 + buildGoModule, 6 + callPackage, 7 + fetchFromGitHub, 8 + lib, 9 + 10 + buf, 11 + cacert, 12 + dart-sass, 13 + grpc-gateway, 14 + protoc-gen-connect-go, 15 + protoc-gen-go, 16 + protoc-gen-go-grpc, 17 + protoc-gen-validate, 18 + statik, 19 + }: 20 + 21 + let 22 + version = "4.19.5"; 23 + zitadelRepo = fetchFromGitHub { 24 + owner = "zitadel"; 25 + repo = "zitadel"; 26 + tag = "v${version}"; 27 + hash = "sha256-FFXsoBlbNTFT1FSxs/IomqTrtNGqsxq9Ck5TSDpSWHM="; 28 + }; 29 + goModulesHash = "sha256-8/TkV1JTKNSIknzEPbTDWzcOZQ6jCEkc6vSLLhdLYrs="; 30 + 31 + # protoc plugins inside the repository (`go install ./internal/protoc/...` 32 + # upstream) 33 + buildZitadelProtocGen = 34 + name: 35 + buildGoModule { 36 + pname = "protoc-gen-${name}"; 37 + inherit version; 38 + 39 + src = zitadelRepo; 40 + 41 + proxyVendor = true; 42 + vendorHash = goModulesHash; 43 + 44 + subPackages = [ "internal/protoc/protoc-gen-${name}" ]; 45 + 46 + doCheck = false; 47 + }; 48 + 49 + protoc-gen-authoption = buildZitadelProtocGen "authoption"; 50 + protoc-gen-zitadel = buildZitadelProtocGen "zitadel"; 51 + 52 + # Descriptor set of proto/. buf fetches the dependencies pinned in 53 + # proto/buf.lock from the Buf Schema Registry, so this is the one 54 + # fixed-output step; the code generators run offline against it. 55 + protoImage = stdenv.mkDerivation { 56 + pname = "zitadel-proto-image"; 57 + inherit version; 58 + 59 + src = zitadelRepo; 60 + 61 + nativeBuildInputs = [ 62 + buf 63 + cacert 64 + ]; 65 + 66 + buildPhase = '' 67 + runHook preBuild 68 + HOME=$TMPDIR buf build proto -o image.binpb 69 + runHook postBuild 70 + ''; 71 + 72 + installPhase = '' 73 + runHook preInstall 74 + cp image.binpb $out 75 + runHook postInstall 76 + ''; 77 + 78 + outputHashMode = "flat"; 79 + outputHash = "sha256-vsVaGO6ewwCMkK1Qh/8/JZblwICnszmfZxXAPFIAdOk="; 80 + }; 81 + 82 + generateProtobufCode = 83 + { 84 + pname, 85 + version, 86 + nativeBuildInputs ? [ ], 87 + bufArgs ? "", 88 + workDir ? ".", 89 + outputPath, 90 + }: 91 + stdenv.mkDerivation { 92 + pname = "${pname}-buf-generated"; 93 + inherit version; 94 + 95 + src = zitadelRepo; 96 + 97 + nativeBuildInputs = nativeBuildInputs ++ [ buf ]; 98 + 99 + buildPhase = '' 100 + runHook preBuild 101 + cd ${workDir} 102 + HOME=$TMPDIR buf generate ${protoImage}#format=binpb ${bufArgs} 103 + runHook postBuild 104 + ''; 105 + 106 + installPhase = '' 107 + runHook preInstall 108 + cp -r ${outputPath} $out 109 + runHook postInstall 110 + ''; 111 + }; 112 + 113 + jsDeps = callPackage ./javascript.nix { inherit protoImage version zitadelRepo; }; 114 + 115 + # the `generate-stubs` target of apps/api/project.json 116 + protobufGenerated = generateProtobufCode { 117 + pname = "zitadel"; 118 + inherit version; 119 + nativeBuildInputs = [ 120 + grpc-gateway 121 + protoc-gen-authoption 122 + protoc-gen-connect-go 123 + protoc-gen-go 124 + protoc-gen-go-grpc 125 + protoc-gen-validate 126 + protoc-gen-zitadel 127 + ]; 128 + outputPath = ".artifacts"; 129 + }; 130 + in 131 + buildGoModule (finalAttrs: { 132 + pname = "zitadel"; 133 + inherit version; 134 + 135 + src = zitadelRepo; 136 + 137 + nativeBuildInputs = [ 138 + dart-sass 139 + statik 140 + ]; 141 + 142 + postPatch = '' 143 + substituteInPlace internal/api/ui/login/static/resources/generate.go \ 144 + --replace-fail "pnpm sass" "sass" 145 + ''; 146 + 147 + proxyVendor = true; 148 + vendorHash = goModulesHash; 149 + ldflags = [ 150 + "-s" 151 + "-w" 152 + "-X 'github.com/zitadel/zitadel/cmd/build.version=${version}'" 153 + ]; 154 + 155 + # The other Go packages are docs snippets and test helpers. 156 + subPackages = [ "." ]; 157 + 158 + # The generate-stubs, generate-statik, generate-assets and build-console 159 + # targets of apps/api/project.json. 160 + preBuild = '' 161 + # zitadel warns on every invocation without a build date 162 + ldflags+=" -X github.com/zitadel/zitadel/cmd/build.date=$(date -u -d "@$SOURCE_DATE_EPOCH" +%Y-%m-%dT%H:%M:%SZ)" 163 + 164 + mkdir -p pkg/grpc 165 + cp -r ${protobufGenerated}/grpc/github.com/zitadel/zitadel/pkg/grpc/* pkg/grpc 166 + mkdir -p openapi/v2/zitadel 167 + cp -r ${protobufGenerated}/grpc/zitadel/ openapi/v2/zitadel 168 + 169 + go generate internal/api/ui/login/static/resources/generate.go 170 + go generate internal/api/ui/login/statik/generate.go 171 + go generate internal/notification/statik/generate.go 172 + go generate internal/statik/generate.go 173 + 174 + mkdir -p apps/docs/content/apis/assets 175 + go run internal/api/assets/generator/asset_generator.go \ 176 + -directory=internal/api/assets/generator/ \ 177 + -assets=apps/docs/content/apis/assets/assets.mdx 178 + 179 + find internal/api/ui/console/static -mindepth 1 ! -name gitkeep -delete 180 + cp -r ${finalAttrs.passthru.console}/* internal/api/ui/console/static 181 + ''; 182 + 183 + doCheck = false; 184 + 185 + installPhase = '' 186 + runHook preInstall 187 + install -Dm755 $GOPATH/bin/zitadel $out/bin/zitadel 188 + runHook postInstall 189 + ''; 190 + 191 + passthru = { 192 + console = callPackage (import ./console.nix { 193 + inherit 194 + generateProtobufCode 195 + jsDeps 196 + version 197 + zitadelRepo 198 + ; 199 + }) { }; 200 + inherit protoImage; 201 + inherit (jsDeps) pnpmDeps; 202 + }; 203 + 204 + meta = { 205 + description = "Identity and access management platform"; 206 + homepage = "https://zitadel.com/"; 207 + downloadPage = "https://github.com/zitadel/zitadel/releases"; 208 + changelog = "https://github.com/zitadel/zitadel/releases/tag/v${version}"; 209 + platforms = lib.platforms.linux ++ lib.platforms.darwin; 210 + license = lib.licenses.agpl3Only; 211 + sourceProvenance = [ lib.sourceTypes.fromSource ]; 212 + mainProgram = "zitadel"; 213 + }; 214 + })
+87
pkgs/zitadel/protoc-gen-js.nix
··· 1 + { 2 + stdenv, 3 + gcc14Stdenv, 4 + lib, 5 + buildBazelPackage, 6 + bazel_7, 7 + fetchFromGitHub, 8 + cctools, 9 + }: 10 + 11 + let 12 + # fails to build with gcc15, see https://github.com/NixOS/nixpkgs/issues/475586 13 + buildBazelPackage' = 14 + if stdenv.cc.isGNU then 15 + buildBazelPackage.override { 16 + stdenv = gcc14Stdenv; 17 + } 18 + else 19 + buildBazelPackage; 20 + 21 + # Since 4.0.0 the project resolves its dependencies with bzlmod. Bazel needs 22 + # the registry in the sandboxed build phase as well, so a checkout of the 23 + # Bazel Central Registry is pinned. 24 + registry = fetchFromGitHub { 25 + owner = "bazelbuild"; 26 + repo = "bazel-central-registry"; 27 + rev = "0f256a72067e42d62bb568cc2619f98deed139e2"; 28 + hash = "sha256-OcMLg0KiAQOJZLH8r+QkeQ9bxcEc4L0dCgyUv5PkLQk="; 29 + }; 30 + in 31 + buildBazelPackage' rec { 32 + pname = "protoc-gen-js"; 33 + version = "4.0.2"; 34 + 35 + src = fetchFromGitHub { 36 + owner = "protocolbuffers"; 37 + repo = "protobuf-javascript"; 38 + rev = "v${version}"; 39 + hash = "sha256-vFTR7dwquZht4st90bFQ9CJMYBPbL+DWO0uQ3xsXIBU="; 40 + }; 41 + 42 + bazel = bazel_7; 43 + bazelFlags = [ 44 + "--registry" 45 + "file://${registry}" 46 + ]; 47 + bazelTargets = [ "generator:protoc-gen-js" ]; 48 + bazelBuildFlags = lib.optionals stdenv.cc.isClang [ 49 + "--cxxopt=-x" 50 + "--cxxopt=c++" 51 + "--host_cxxopt=-x" 52 + "--host_cxxopt=c++" 53 + ]; 54 + removeRulesCC = false; 55 + 56 + env = lib.optionalAttrs stdenv.hostPlatform.isDarwin { 57 + LIBTOOL = "${cctools}/bin/libtool"; 58 + }; 59 + 60 + fetchAttrs = { 61 + # Repositories Bazel generates by inspecting the build host (store paths, 62 + # host CPU) stay out of the deps tarball; the build phase regenerates them. 63 + # With bzlmod their names carry the extension prefix (`~` on Bazel 7). 64 + preInstall = '' 65 + rm -rf "$bazelOut"/external/*[~+]{host_platform,local_config_*} 66 + ''; 67 + 68 + hash = "sha256-bc+VwWhHzXIblFGYf8gfRTZvAiBY4L9L9texuJlxRYI="; 69 + }; 70 + 71 + buildAttrs.installPhase = '' 72 + mkdir -p $out/bin 73 + install -Dm755 bazel-bin/generator/protoc-gen-js $out/bin/ 74 + ''; 75 + 76 + meta = { 77 + description = "Protobuf plugin for generating JavaScript code"; 78 + mainProgram = "protoc-gen-js"; 79 + homepage = "https://github.com/protocolbuffers/protobuf-javascript"; 80 + platforms = lib.platforms.linux ++ lib.platforms.darwin; 81 + license = with lib.licenses; [ 82 + asl20 83 + bsd3 84 + ]; 85 + sourceProvenance = [ lib.sourceTypes.fromSource ]; 86 + }; 87 + }