summary refs log tree commit diff
path: root/pkgs/development/tools/nailgun/default.nix
blob: 2d8b075a685c49c5f2745d9589f6186407ca4ccd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{ lib, stdenv, stdenvNoCC, fetchMavenArtifact, fetchFromGitHub, jre, makeWrapper, symlinkJoin }:

let
  version = "1.0.0";
  nailgun-server = fetchMavenArtifact {
    groupId = "com.facebook";
    artifactId = "nailgun-server";
    inherit version;
    sha256 = "1mk8pv0g2xg9m0gsb96plbh6mc24xrlyrmnqac5mlbl4637l4q95";
  };

  commonMeta = {
    license = lib.licenses.asl20;
    homepage = "http://www.martiansoftware.com/nailgun/";
    platforms = lib.platforms.linux;
    maintainers = with lib.maintainers; [ ];
  };

  server = stdenvNoCC.mkDerivation {
    pname = "nailgun-server";
    inherit version;

    nativeBuildInputs = [ makeWrapper ];

    dontUnpack = true;
    installPhase = ''
      runHook preInstall

      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";
  };
}