From 3c70b00f18e907547a7e7e118cc2e55d1509a8e0 Mon Sep 17 00:00:00 2001 From: Ryan Hendrickson Date: Sat, 7 Jan 2023 19:28:19 -0500 Subject: [PATCH] nailgun: split into client and server --- pkgs/development/tools/nailgun/default.nix | 73 +++++++++++++++------- 1 file changed, 51 insertions(+), 22 deletions(-) diff --git a/pkgs/development/tools/nailgun/default.nix b/pkgs/development/tools/nailgun/default.nix index d5799b599a2a..2d8b075a685c 100644 --- a/pkgs/development/tools/nailgun/default.nix +++ b/pkgs/development/tools/nailgun/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchMavenArtifact, fetchFromGitHub, jre, makeWrapper }: +{ lib, stdenv, stdenvNoCC, fetchMavenArtifact, fetchFromGitHub, jre, makeWrapper, symlinkJoin }: let version = "1.0.0"; @@ -8,33 +8,62 @@ let inherit version; sha256 = "1mk8pv0g2xg9m0gsb96plbh6mc24xrlyrmnqac5mlbl4637l4q95"; }; -in -stdenv.mkDerivation { - pname = "nailgun"; - inherit version; - src = fetchFromGitHub { - owner = "facebook"; - repo = "nailgun"; - rev = "nailgun-all-v${version}"; - sha256 = "1syyk4ss5vq1zf0ma00svn56lal53ffpikgqgzngzbwyksnfdlh6"; + commonMeta = { + license = lib.licenses.asl20; + homepage = "http://www.martiansoftware.com/nailgun/"; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ ]; }; - makeFlags = [ "PREFIX=$(out)" ]; + server = stdenvNoCC.mkDerivation { + pname = "nailgun-server"; + inherit version; - nativeBuildInputs = [ makeWrapper ]; + nativeBuildInputs = [ makeWrapper ]; - postInstall = '' - makeWrapper ${jre}/bin/java $out/bin/ng-server \ - --add-flags '-classpath ${nailgun-server.jar}:$CLASSPATH com.facebook.nailgun.NGServer' - ''; + dontUnpack = true; + installPhase = '' + runHook preInstall - meta = with lib; { + makeWrapper ${jre}/bin/java $out/bin/ng-server \ + --add-flags '-classpath ${nailgun-server.jar}:$CLASSPATH com.facebook.nailgun.NGServer' + + runHook postInstall + ''; + + meta = commonMeta // { + description = "Server for running Java programs from the command line without incurring the JVM startup overhead"; + sourceProvenance = with lib.sourceTypes; [ binaryBytecode ]; + }; + }; + + client = stdenv.mkDerivation { + pname = "nailgun-client"; + inherit version; + + src = fetchFromGitHub { + owner = "facebook"; + repo = "nailgun"; + rev = "nailgun-all-v${version}"; + sha256 = "1syyk4ss5vq1zf0ma00svn56lal53ffpikgqgzngzbwyksnfdlh6"; + }; + + makeFlags = [ "PREFIX=$(out)" ]; + + meta = commonMeta // { + description = "Client for running Java programs from the command line without incurring the JVM startup overhead"; + }; + }; +in +symlinkJoin rec { + pname = "nailgun"; + inherit client server version; + + name = "${pname}-${version}"; + paths = [ client server ]; + + meta = commonMeta // { description = "Client, protocol, and server for running Java programs from the command line without incurring the JVM startup overhead"; - homepage = "http://www.martiansoftware.com/nailgun/"; - sourceProvenance = with sourceTypes; [ binaryBytecode ]; - license = licenses.asl20; - platforms = platforms.linux; - maintainers = with maintainers; [ ]; }; }