about summary refs log tree commit diff
path: root/pkgs/by-name/di/dita-ot/package.nix
blob: a1e8931eacf3d14e015f6fa607fd317208cc6019 (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
{
  stdenv,
  fetchzip,
  openjdk17,
  lib,
  makeWrapper,
  testers,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "dita-ot";
  version = "4.2.3";

  nativeBuildInputs = [ makeWrapper ];
  buildInputs = [ openjdk17 ];

  src = fetchzip {
    url = "https://github.com/dita-ot/dita-ot/releases/download/${finalAttrs.version}/dita-ot-${finalAttrs.version}.zip";
    hash = "sha256-siHz81OuKVF77NsDpldAhq7YxzBFvo9RwGPe/mqkquQ=";
  };

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin $out/share/dita-ot/
    cp -r $src/* $out/share/dita-ot/

    makeWrapper "$out/share/dita-ot/bin/dita" "$out/bin/dita" \
      --prefix PATH : "${lib.makeBinPath [ openjdk17 ]}" \
      --set-default JDK_HOME "${openjdk17.home}" \
      --set-default JAVA_HOME "${openjdk17.home}"

    runHook postInstall
  '';

  passthru.tests.version = testers.testVersion { package = finalAttrs.finalPackage; };

  meta = {
    homepage = "https://dita-ot.org";
    changelog = "https://www.dita-ot.org/dev/release-notes/#v${finalAttrs.version}";
    description = "The open-source publishing engine for content authored in the Darwin Information Typing Architecture";
    license = lib.licenses.asl20;
    mainProgram = "dita";
    platforms = openjdk17.meta.platforms;
    sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
    maintainers = with lib.maintainers; [ robertrichter ];
  };
})