summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Portnov | PROgrm_JARvis <mrjarviscraft+nix@gmail.com>2025-06-15 17:35:33 +0300
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2025-07-30 14:12:11 +0000
commit1fc4e150ed415250163a6c604a8f4120980c567b (patch)
tree1ac1d56bea9b9ad2a3b4e90da2ce9fce7d790ee1
parent[Backport release-25.05] iperf3: 3.19 -> 3.19.1 (#429580) (diff)
downloadnixpkgs-1fc4e150ed415250163a6c604a8f4120980c567b.tar.gz
protoc-gen-grpc-java: init at 1.73.0 (#415329)
(cherry picked from commit dbae6575d6b114bc87414b7676b7660791ecf2e3)
-rw-r--r--pkgs/by-name/pr/protoc-gen-grpc-java/hashes.nix11
-rw-r--r--pkgs/by-name/pr/protoc-gen-grpc-java/package.nix90
-rwxr-xr-xpkgs/by-name/pr/protoc-gen-grpc-java/update.sh33
3 files changed, 134 insertions, 0 deletions
diff --git a/pkgs/by-name/pr/protoc-gen-grpc-java/hashes.nix b/pkgs/by-name/pr/protoc-gen-grpc-java/hashes.nix
new file mode 100644
index 000000000000..da9182e6d068
--- /dev/null
+++ b/pkgs/by-name/pr/protoc-gen-grpc-java/hashes.nix
@@ -0,0 +1,11 @@
+{
+ linux-aarch_64 = "sha256-sgdZoaSM7LgK4DbbKPJO3FdBA37YAX86meaKDLQiOmg=";
+ linux-ppcle_64 = "sha256-k4nQGJNwtd8W4nJLyWPRhqjikczy7p7ffDIrWxkcUTA=";
+ linux-s390_64 = "sha256-fcuNlJeUmduFzqt5WaefYk3lFVmdHeSFIEkbwT2I1O0=";
+ linux-x86_32 = "sha256-KNvqGkeERd2UxzhjO/Fp6Uv7DGBt15rPGviRmH7pmno=";
+ linux-x86_64 = "sha256-7LI115E3BOz3jnHavkQBbN0hsjKuSbnXNAjXFw/D14I=";
+ osx-aarch_64 = "sha256-gAo2bcsivjDVFX5cUvzngoHgqTAPt+3Hiuynd17/KTo=";
+ osx-x86_64 = "sha256-gAo2bcsivjDVFX5cUvzngoHgqTAPt+3Hiuynd17/KTo=";
+ windows-x86_32 = "sha256-ERbksXFy4AFhZSFG9G4AMOi68EzEScBvDJFF9+rnPnU=";
+ windows-x86_64 = "sha256-wZU6on7A84fPm8xwD8pBgSk8+fkB14LdvWZXEniz8LU=";
+}
diff --git a/pkgs/by-name/pr/protoc-gen-grpc-java/package.nix b/pkgs/by-name/pr/protoc-gen-grpc-java/package.nix
new file mode 100644
index 000000000000..277a914bfc7b
--- /dev/null
+++ b/pkgs/by-name/pr/protoc-gen-grpc-java/package.nix
@@ -0,0 +1,90 @@
+{
+ lib,
+ stdenv,
+ fetchurl,
+ makeWrapper,
+ autoPatchelfHook,
+}:
+let
+ hostArch =
+ let
+ platform = stdenv.hostPlatform;
+ os =
+ if platform.isLinux then
+ "linux"
+ else if platform.isDarwin then
+ "osx"
+ else if platform.isWindows then
+ "windows"
+ else
+ throw "Unsupoprted OS \"${platform.parsed.kernel.name}\"";
+ arch =
+ if platform.isx86_32 then
+ "x86_32"
+ else if platform.isx86_64 then
+ "x86_64"
+ else if platform.isAarch64 then
+ "aarch_64"
+ else if platform.isPower64 && platform.isLittleEndian then
+ "ppcle_64"
+ else if platform.isS390x then
+ "s390_64"
+ else
+ throw "Unsupported CPU \"${platform.parsed.cpu.name}\"";
+ in
+ "${os}-${arch}";
+in
+stdenv.mkDerivation (finalAttrs: {
+ pname = "protoc-gen-grpc-java";
+ version = "1.73.0";
+ src = fetchurl {
+ url = "https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/${finalAttrs.version}/protoc-gen-grpc-java-${finalAttrs.version}-${hostArch}.exe";
+ hash = (import ./hashes.nix).${hostArch} or (throw "Unsuported host arch ${hostArch}");
+ };
+ dontUnpack = true;
+ dontConfigure = true;
+ dontBuild = true;
+
+ nativeBuildInputs = [
+ makeWrapper
+ autoPatchelfHook
+ ];
+ buildInputs = [ stdenv.cc.cc ];
+
+ installPhase = ''
+ runHook preInstall
+
+ install -D $src $out/bin/protoc-gen-grpc-java
+
+ runHook postInstall
+ '';
+
+ passthru.updateScript = ./update.sh;
+
+ meta = {
+ description = "gRPC Java Codegen Plugin for Protobuf Compiler";
+ longDescription = ''
+ This generates the Java interfaces out of the service definition from a `.proto` file.
+ It works with the Protobuf Compiler (`protoc`).
+ '';
+ changelog = "https://github.com/grpc/grpc-java/releases/tag/v${finalAttrs.version}";
+ sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
+ license = lib.licenses.asl20;
+ maintainers = [ lib.maintainers.progrm_jarvis ];
+ homepage = "https://grpc.io/docs/languages/java/generated-code/";
+ platforms = [
+ # Linux
+ "x86_64-linux"
+ "i686-linux"
+ "aarch64-linux"
+ "powerpc64le-linux"
+ "s390x-linux"
+ # Darwin
+ "x86_64-darwin"
+ "aarch64-darwin"
+ # Windows
+ "x86_64-windows"
+ "i686-windows"
+ ];
+ };
+})
diff --git a/pkgs/by-name/pr/protoc-gen-grpc-java/update.sh b/pkgs/by-name/pr/protoc-gen-grpc-java/update.sh
new file mode 100755
index 000000000000..a7e62e72cea1
--- /dev/null
+++ b/pkgs/by-name/pr/protoc-gen-grpc-java/update.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash -p curl jq gnused nix
+
+set -euo pipefail
+
+ARCHS=(
+ 'linux-aarch_64'
+ 'linux-ppcle_64'
+ 'linux-s390_64'
+ 'linux-x86_32'
+ 'linux-x86_64'
+ 'osx-aarch_64'
+ 'osx-x86_64'
+ 'windows-x86_32'
+ 'windows-x86_64'
+)
+HASHES_FILE=pkgs/by-name/pr/protoc-gen-grpc-java/hashes.nix
+
+version="$(
+ curl --silent --location --fail \
+ ${GITHUB_TOKEN:+-u ":${GITHUB_TOKEN}"} \
+ https://api.github.com/repos/grpc/grpc-java/releases/latest |
+ jq -r '.tag_name' |
+ sed 's/^v//'
+)"
+
+echo '{' >"${HASHES_FILE}"
+for arch in "${ARCHS[@]}"; do
+ url="https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/${version}/protoc-gen-grpc-java-${version}-${arch}.exe"
+ hash=$(nix hash convert --hash-algo sha256 --to sri "$(nix-prefetch-url "${url}")")
+ echo " ${arch} = \"${hash}\";" >>"${HASHES_FILE}"
+done
+echo '}' >>"${HASHES_FILE}"