From 474fd115f81884688848b912129c3c7c94e8a49d Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 9 Apr 2024 22:29:56 +0300 Subject: [PATCH] reposilite-bin: 3.5.8 -> 3.5.10; reduce closure size; pick up java_home from drv --- .../networking/reposilite-bin/default.nix | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/pkgs/applications/networking/reposilite-bin/default.nix b/pkgs/applications/networking/reposilite-bin/default.nix index 883c2f4..d86e4cb 100644 --- a/pkgs/applications/networking/reposilite-bin/default.nix +++ b/pkgs/applications/networking/reposilite-bin/default.nix @@ -1,30 +1,35 @@ { - pkgs, lib, - javaJdk, + stdenvNoCC, + makeWrapper, + openjdk_headless, + javaJdk ? openjdk_headless, + maxMemory ? "40m", ... }: let - inherit (pkgs) stdenv; - jdk = javaJdk; in - stdenv.mkDerivation (finalAttrs: { + stdenvNoCC.mkDerivation (finalAttrs: { pname = "reposilite-bin"; - version = "3.5.8"; - - jar = builtins.fetchurl { + version = "3.5.10"; + src = builtins.fetchurl { 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 = '' 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 \ - --add-flags "-Xmx40m -jar $jar" \ - --set JAVA_HOME ${jdk} + --set JAVA_HOME ${jdk.home} \ + --add-flags "-Xmx${maxMemory}m -jar $src/reposilite-${finalAttrs.version}-all.jar" + runHook postInstall ''; @@ -32,7 +37,7 @@ in description = "A lightweight repository manager for Maven artifacts"; homepage = "https://reposilite.com"; 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]; }; })