HentaiAtHome: use default JDK with ZGC support

This patch uses default JDK for building/running HentaiAtHome, and
enables ZGC by default. The default Serial GC shipped with GraalVM
Community proves to be suboptimal for long-running servers. With this
change, my server quality rises above 8000 according to Hentai@Home
dashboard.
This commit is contained in:
Cheng Shao 2022-06-17 12:55:49 +00:00
parent 4d9b321b1a
commit 0ada41cd52

View file

@ -1,24 +1,43 @@
{ buildGraalvmNativeImage, fetchzip, graalvm17-ce, lib }: { buildPackages
, buildPlatform
buildGraalvmNativeImage rec { , fetchzip
, javaOpts ? "-XX:+UseZGC"
, jdk
, jre_headless
, lib
, makeWrapper
, stdenvNoCC
,
}:
stdenvNoCC.mkDerivation rec {
pname = "HentaiAtHome"; pname = "HentaiAtHome";
version = "1.6.1"; version = "1.6.1";
src = fetchzip { src = fetchzip {
url = "https://repo.e-hentai.org/hath/HentaiAtHome_${version}.zip"; url = "https://repo.e-hentai.org/hath/HentaiAtHome_${version}_src.zip";
hash = hash =
"sha512-nGGCuVovj4NJGrihKKYXnh0Ic9YD36o7r6wv9zSivZn22zm8lBYVXP85LnOw2z9DiJARivOctQGl48YFD7vxOQ=="; "sha512-j+B0kx6fjUibI3MjVJ5PVTq9xxtSOTTY/XizAJKjeNkpExJF9DIV4VCwf+sfLlg+7W4UBosnyb8hZNNoidRBKA==";
stripRoot = false; stripRoot = false;
}; };
jar = "${src}/HentaiAtHome.jar"; nativeBuildInputs = [ jdk makeWrapper ];
dontUnpack = true;
graalvmDrv = graalvm17-ce; LANG = "en_US.UTF-8";
extraNativeImageBuildArgs = [ LOCALE_ARCHIVE = lib.optionalString (buildPlatform.libc == "glibc")
"--enable-url-protocols=http,https" "${buildPackages.glibcLocales}/lib/locale/locale-archive";
"--install-exit-handlers"
"--no-fallback" buildPhase = ''
]; make all
'';
installPhase = ''
mkdir -p $out/share/java
cp build/HentaiAtHome.jar $out/share/java
mkdir -p $out/bin
makeWrapper ${jre_headless}/bin/java $out/bin/HentaiAtHome \
--add-flags "${javaOpts} -jar $out/share/java/HentaiAtHome.jar"
'';
doInstallCheck = true; doInstallCheck = true;
installCheckPhase = '' installCheckPhase = ''
@ -27,11 +46,12 @@ buildGraalvmNativeImage rec {
popd popd
''; '';
strictDeps = true;
meta = with lib; { meta = with lib; {
homepage = "https://ehwiki.org/wiki/Hentai@Home"; homepage = "https://ehwiki.org/wiki/Hentai@Home";
description = description =
"Hentai@Home is an open-source P2P gallery distribution system which reduces the load on the E-Hentai Galleries"; "Hentai@Home is an open-source P2P gallery distribution system which reduces the load on the E-Hentai Galleries";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.gpl3; license = licenses.gpl3;
maintainers = with maintainers; [ terrorjack ]; maintainers = with maintainers; [ terrorjack ];
}; };