openapi-generator-cli: set mainProgram and use finalAttrs (#284102)

* openapi-generator-cli: set mainProgram
* openapi-generator-cli: use finalAttrs
This commit is contained in:
Matthieu Coudron 2024-01-30 18:08:12 +01:00 committed by GitHub
parent d3c09ae008
commit dad88c029e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,17 +1,17 @@
{ callPackage, lib, stdenv, fetchurl, jre, makeWrapper }:
let this = stdenv.mkDerivation rec {
let this = stdenv.mkDerivation (finalAttrs: {
version = "7.2.0";
pname = "openapi-generator-cli";
jarfilename = "${pname}-${version}.jar";
jarfilename = "${finalAttrs.pname}-${finalAttrs.version}.jar";
nativeBuildInputs = [
makeWrapper
];
src = fetchurl {
url = "mirror://maven/org/openapitools/${pname}/${version}/${jarfilename}";
url = "mirror://maven/org/openapitools/${finalAttrs.pname}/${finalAttrs.version}/${finalAttrs.jarfilename}";
sha256 = "sha256-HPDIDeEsD9yFlCicGeQUtAIQjvELjdC/2hlTFRNBq10=";
};
@ -20,10 +20,10 @@ let this = stdenv.mkDerivation rec {
installPhase = ''
runHook preInstall
install -D "$src" "$out/share/java/${jarfilename}"
install -D "$src" "$out/share/java/${finalAttrs.jarfilename}"
makeWrapper ${jre}/bin/java $out/bin/${pname} \
--add-flags "-jar $out/share/java/${jarfilename}"
makeWrapper ${jre}/bin/java $out/bin/${finalAttrs.pname} \
--add-flags "-jar $out/share/java/${finalAttrs.jarfilename}"
runHook postInstall
'';
@ -31,14 +31,15 @@ let this = stdenv.mkDerivation rec {
meta = with lib; {
description = "Allows generation of API client libraries (SDK generation), server stubs and documentation automatically given an OpenAPI Spec";
homepage = "https://github.com/OpenAPITools/openapi-generator";
changelog = "https://github.com/OpenAPITools/openapi-generator/releases/tag/v${version}";
changelog = "https://github.com/OpenAPITools/openapi-generator/releases/tag/v${finalAttrs.version}";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.asl20;
maintainers = with maintainers; [ shou ];
mainProgram = "openapi-generator-cli";
};
passthru.tests.example = callPackage ./example.nix {
openapi-generator-cli = this;
};
};
});
in this