nzbhydra2: build JAR from source

This commit is contained in:
Tobias M
2025-12-06 13:45:33 +01:00
parent 6b5debfd8d
commit 0eda65a462
2 changed files with 99 additions and 19 deletions
@@ -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 @@
<version>3.10.1</version>
<configuration>
<compilerArgs>
<arg>-parameters</arg>
+ <arg>-proc:full</arg>
</compilerArgs>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
</plugins>
</build>
@@ -108,7 +109,7 @@
<spring-data-commons.version>3.1.5</spring-data-commons.version>
<jakarta.persistence-api.version>3.1.0</jakarta.persistence-api.version>
<jackson.version>2.15.0</jackson.version>
- <lombok.version>1.18.30</lombok.version>
+ <lombok.version>1.18.42</lombok.version>
<logback.version>1.5.21</logback.version>
<guava.version>23.0</guava.version>
<junit.version>4.13.2</junit.version>
+74 -19
View File
@@ -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";
};