Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 makeWrapper, 6 autoPatchelfHook, 7}: 8let 9 hostArch = 10 let 11 platform = stdenv.hostPlatform; 12 os = 13 if platform.isLinux then 14 "linux" 15 else if platform.isDarwin then 16 "osx" 17 else if platform.isWindows then 18 "windows" 19 else 20 throw "Unsupoprted OS \"${platform.parsed.kernel.name}\""; 21 arch = 22 if platform.isx86_32 then 23 "x86_32" 24 else if platform.isx86_64 then 25 "x86_64" 26 else if platform.isAarch64 then 27 "aarch_64" 28 else if platform.isPower64 && platform.isLittleEndian then 29 "ppcle_64" 30 else if platform.isS390x then 31 "s390_64" 32 else 33 throw "Unsupported CPU \"${platform.parsed.cpu.name}\""; 34 in 35 "${os}-${arch}"; 36in 37stdenv.mkDerivation (finalAttrs: { 38 pname = "protoc-gen-grpc-java"; 39 version = "1.73.0"; 40 src = fetchurl { 41 url = "https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/${finalAttrs.version}/protoc-gen-grpc-java-${finalAttrs.version}-${hostArch}.exe"; 42 hash = (import ./hashes.nix).${hostArch} or (throw "Unsuported host arch ${hostArch}"); 43 }; 44 dontUnpack = true; 45 dontConfigure = true; 46 dontBuild = true; 47 48 nativeBuildInputs = [ 49 makeWrapper 50 autoPatchelfHook 51 ]; 52 buildInputs = [ stdenv.cc.cc ]; 53 54 installPhase = '' 55 runHook preInstall 56 57 install -D $src $out/bin/protoc-gen-grpc-java 58 59 runHook postInstall 60 ''; 61 62 passthru.updateScript = ./update.sh; 63 64 meta = { 65 description = "gRPC Java Codegen Plugin for Protobuf Compiler"; 66 longDescription = '' 67 This generates the Java interfaces out of the service definition from a `.proto` file. 68 It works with the Protobuf Compiler (`protoc`). 69 ''; 70 changelog = "https://github.com/grpc/grpc-java/releases/tag/v${finalAttrs.version}"; 71 sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; 72 license = lib.licenses.asl20; 73 maintainers = [ lib.maintainers.progrm_jarvis ]; 74 homepage = "https://grpc.io/docs/languages/java/generated-code/"; 75 platforms = [ 76 # Linux 77 "x86_64-linux" 78 "i686-linux" 79 "aarch64-linux" 80 "powerpc64le-linux" 81 "s390x-linux" 82 # Darwin 83 "x86_64-darwin" 84 "aarch64-darwin" 85 # Windows 86 "x86_64-windows" 87 "i686-windows" 88 ]; 89 }; 90})