about summary refs log tree commit diff
path: root/ops/gerrit-tvl/default.nix
blob: f3bec7a3a242a111e05f777e16328d439067eb2f (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
{ depot, pkgs, lib, ... }:

let
  classPath = lib.concatStringsSep ":" [
    "${depot.third_party.gerrit}/share/api/extension-api_deploy.jar"
  ];
in
pkgs.stdenvNoCC.mkDerivation rec {
  name = "${pname}-${version}.jar";
  pname = "gerrit-tvl";
  version = "0.0.1";

  src = ./.;

  nativeBuildInputs = with pkgs; [
    jdk
  ];

  buildPhase = ''
    mkdir $NIX_BUILD_TOP/build

    # Build Java components.
    export JAVAC="javac -cp ${classPath} -d $NIX_BUILD_TOP/build --release 11"
    $JAVAC ./HttpModule.java

    # Install static files.
    cp -R static $NIX_BUILD_TOP/build/static
  '';

  installPhase = ''
    jar --create --file $out --manifest $src/MANIFEST.MF -C $NIX_BUILD_TOP/build .
  '';
}