diff --git a/pkgs/by-name/mu/mustang-cli/package.nix b/pkgs/by-name/mu/mustang-cli/package.nix new file mode 100644 index 000000000000..e0a2dfb28658 --- /dev/null +++ b/pkgs/by-name/mu/mustang-cli/package.nix @@ -0,0 +1,67 @@ +{ + lib, + fetchFromGitHub, + maven, + jre_minimal, + jdk_headless, + makeWrapper, + stripJavaArchivesHook, + nix-update-script, +}: +let + jre = jre_minimal.override { + modules = [ + "java.base" + "java.desktop" + "java.logging" + ]; + jdk = jdk_headless; + }; +in +maven.buildMavenPackage (finalAttrs: { + version = "2.23.1"; + pname = "mustang-cli"; + + src = fetchFromGitHub { + owner = "ZUGFeRD"; + repo = "mustangproject"; + tag = "core-${finalAttrs.version}"; + hash = "sha256-HhNcmXXwnR2u1hjSeNYfU+j9EdJ+tbXhgWHj1k4eSuw="; + }; + + strictDeps = true; + __structuredAttrs = true; + + mvnHash = "sha256-ekSgGKY3OMFAEM3bNByBXrU3tpbDcbJ0fmCTRz7NIkA="; + + nativeBuildInputs = [ + makeWrapper + stripJavaArchivesHook + ]; + + installPhase = '' + mkdir -p $out/bin $out/share/Mustang-CLI + + # Upstream hardcodes an incorrect version string in the generated JAR filename, use a glob to match it. + # Use correct version when https://github.com/ZUGFeRD/mustangproject/issues/1131 is fixed. + install -Dm644 Mustang-CLI/target/Mustang-CLI-*-SNAPSHOT.jar $out/share/Mustang-CLI/Mustang-CLI.jar + + makeWrapper ${jre}/bin/java $out/bin/mustang-cli \ + --add-flags "-jar $out/share/Mustang-CLI/Mustang-CLI.jar" + ''; + + passthru.updateScript = nix-update-script { + extraArgs = [ + "--version-regex=core-(.*)" + ]; + }; + + meta = { + mainProgram = "mustang-cli"; + description = "Open Source Java e-Invoicing library, validator and tool (Factur-X/ZUGFeRD, UNCEFACT/CII XRechnung)"; + homepage = "https://www.mustangproject.org"; + changelog = "https://github.com/ZUGFeRD/mustangproject/releases/tag/${finalAttrs.src.tag}"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ angelodlfrtr ]; + }; +})