reposilite-bin: 3.5.8 -> 3.5.10; reduce closure size; pick up java_home from drv

This commit is contained in:
raf 2024-04-09 22:29:56 +03:00
parent c5d4a7c214
commit 474fd115f8
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29

View file

@ -1,30 +1,35 @@
{ {
pkgs,
lib, lib,
javaJdk, stdenvNoCC,
makeWrapper,
openjdk_headless,
javaJdk ? openjdk_headless,
maxMemory ? "40m",
... ...
}: let }: let
inherit (pkgs) stdenv;
jdk = javaJdk; jdk = javaJdk;
in in
stdenv.mkDerivation (finalAttrs: { stdenvNoCC.mkDerivation (finalAttrs: {
pname = "reposilite-bin"; pname = "reposilite-bin";
version = "3.5.8"; version = "3.5.10";
src = builtins.fetchurl {
jar = builtins.fetchurl {
url = "https://maven.reposilite.com/releases/com/reposilite/reposilite/${finalAttrs.version}/reposilite-${finalAttrs.version}-all.jar"; url = "https://maven.reposilite.com/releases/com/reposilite/reposilite/${finalAttrs.version}/reposilite-${finalAttrs.version}-all.jar";
sha256 = "sha256:1skbbdfcbdhlhyrg1y1fimm87kq1ws6g5xy0sxaglgky9j218c0p"; sha256 = "1wqgy94sslg3jm2lzzzzl6m6x24q2z70dprl1si9mid6r74jxlh5";
}; };
dontUnpack = true; nativeBuildInputs = [makeWrapper];
nativeBuildInputs = [pkgs.makeWrapper]; phases = ["installPhase"];
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
# wrap the reposilite jar with the JAVA_HOME environment variable and memory flags
# maxMemory should be in megabytes. 40m is a reasonable defeat, but you may increase
# it if you experience a higher load
makeWrapper ${jdk}/bin/java $out/bin/reposilite \ makeWrapper ${jdk}/bin/java $out/bin/reposilite \
--add-flags "-Xmx40m -jar $jar" \ --set JAVA_HOME ${jdk.home} \
--set JAVA_HOME ${jdk} --add-flags "-Xmx${maxMemory}m -jar $src/reposilite-${finalAttrs.version}-all.jar"
runHook postInstall runHook postInstall
''; '';
@ -32,7 +37,7 @@ in
description = "A lightweight repository manager for Maven artifacts"; description = "A lightweight repository manager for Maven artifacts";
homepage = "https://reposilite.com"; homepage = "https://reposilite.com";
license = lib.licenses.asl20; license = lib.licenses.asl20;
mainProgram = "reposilite"; # we don't inherit pname here because it contains the -bin suffix, which the resulting binary won't have mainProgram = "reposilite";
maintainers = with lib.maintainers; [NotAShelf]; maintainers = with lib.maintainers; [NotAShelf];
}; };
}) })