diff --git a/pkgs/by-name/nz/nzbhydra2/lombok-compiler-annotation.patch b/pkgs/by-name/nz/nzbhydra2/lombok-compiler-annotation.patch new file mode 100644 index 000000000000..407f4c8c7908 --- /dev/null +++ b/pkgs/by-name/nz/nzbhydra2/lombok-compiler-annotation.patch @@ -0,0 +1,25 @@ +--- a/pom.xml 1970-01-01 01:00:01.000000000 +0100 ++++ b/pom.xml 2025-12-02 21:04:01.739489000 +0100 +@@ -74,12 +74,13 @@ + 3.10.1 + + + -parameters ++ -proc:full + + 17 + 17 + + + + + +@@ -108,7 +109,7 @@ + 3.1.5 + 3.1.0 + 2.15.0 +- 1.18.30 ++ 1.18.42 + 1.5.21 + 23.0 + 4.13.2 diff --git a/pkgs/by-name/nz/nzbhydra2/package.nix b/pkgs/by-name/nz/nzbhydra2/package.nix index f997f0661bff..c4d7ec57773e 100644 --- a/pkgs/by-name/nz/nzbhydra2/package.nix +++ b/pkgs/by-name/nz/nzbhydra2/package.nix @@ -1,39 +1,91 @@ { lib, - stdenv, - fetchzip, makeWrapper, - openjdk17, python3, - unzip, nixosTests, + maven, + fetchFromGitHub, + jdk, }: -stdenv.mkDerivation rec { - pname = "nzbhydra2"; - version = "8.1.0"; - src = fetchzip { - url = "https://github.com/theotherp/nzbhydra2/releases/download/v${version}/nzbhydra2-${version}-generic.zip"; - hash = "sha256-00XlNTwn/7Ve6q0MrJyu/WzL1imbygHcWHb1Z4FiI6Y="; - stripRoot = false; +# Skip some plugins not required for NixOS packaging to reduce required dependencies. +# Also skip the integration tests because they don't work in the sandbox. +let + projectFilter = "--projects ${ + lib.concatMapStringsSep "," (x: "!org.nzbhydra:${x}") [ + "github-release-plugin" + "discordreleaser" + "releases" + "generic-release" + "linux-amd64-release" + "linux-arm64-release" + "windows-release" + "tests" + ] + },!org.nzbhydra.tests:system"; +in +maven.buildMavenPackage rec { + pname = "nzbhydra2"; + version = "8.1.2"; + + src = fetchFromGitHub { + owner = "theotherp"; + repo = pname; + tag = "v${version}"; + hash = "sha256-BD9bvbPaVz3MJam78EHqfFc9jbh1SpkIxTe0UK8Lh0w="; }; + patches = [ + # Older lombok versions are incompatible with newer JDK versions. + ./lombok-compiler-annotation.patch + ]; + + buildOffline = true; + + mvnJdk = jdk; + + mvnHash = "sha256-SXanl43Fpd7IdhuD1H2LpB5BwvzbbjRNyZYzBvV1XXY="; + + manualMvnArtifacts = [ + "org.springframework.boot:spring-boot-maven-plugin:4.0.0" + + "org.apache.maven.plugins:maven-antrun-plugin:3.1.0" + "org.apache.maven.plugins:maven-dependency-plugin:3.7.0" + "org.apache.maven.plugins:maven-release-plugin:3.0.1" + "org.apache.maven.plugins:maven-plugin-plugin:3.7.1" + "org.apache.maven.plugins:maven-install-plugin:3.1.4" + + # Dependencies for building and running tests are included below. + # The set of dependencies for successfully building and running the tests is different. + # For simplicity all dependencies are included here, independently of whether we're running the tests. + "org.apache.maven.plugins:maven-surefire-plugin:2.22.2" + "org.apache.maven.surefire:surefire-junit4:3.0.0-M2" + "org.apache.maven.surefire:surefire-junit-platform:2.22.2" + "org.apache.maven.surefire:surefire-junit-platform:3.0.0-M2" + "org.apache.maven.surefire:surefire-junit-platform:3.2.5" + "org.junit.platform:junit-platform-surefire-provider:1.3.2" + ]; + + doCheck = true; + + mvnDepsParameters = projectFilter; + mvnParameters = projectFilter; + nativeBuildInputs = [ - openjdk17 makeWrapper - unzip ]; installPhase = '' runHook preInstall - install -d -m 755 "$out/lib/nzbhydra2" - cp -dpr --no-preserve=ownership "lib" "readme.md" "$out/lib/nzbhydra2" - install -D -m 755 "nzbhydra2wrapperPy3.py" "$out/lib/nzbhydra2/nzbhydra2wrapperPy3.py" + install -d -m 755 "$out/lib/${pname}/lib" + cp -rt "$out/lib/${pname}/lib" core/target/*-exec.jar + touch "$out/lib/${pname}/readme.md" + install -D -m 755 "other/wrapper/nzbhydra2wrapperPy3.py" "$out/lib/nzbhydra2/nzbhydra2wrapperPy3.py" - makeWrapper ${python3}/bin/python $out/bin/nzbhydra2 \ + makeWrapper ${lib.getExe python3} "$out/bin/nzbhydra2" \ --add-flags "$out/lib/nzbhydra2/nzbhydra2wrapperPy3.py" \ - --prefix PATH ":" ${openjdk17}/bin + --prefix PATH ":" ${lib.getBin jdk}/bin runHook postInstall ''; @@ -46,7 +98,10 @@ stdenv.mkDerivation rec { description = "Usenet meta search"; homepage = "https://github.com/theotherp/nzbhydra2"; license = lib.licenses.asl20; - maintainers = with lib.maintainers; [ matteopacini ]; + maintainers = with lib.maintainers; [ + matteopacini + tmarkus + ]; platforms = lib.platforms.linux; mainProgram = "nzbhydra2"; };