about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/typesetting/asciidoctor/default.nix
blob: f875cc26311bdb0c8f09a016df19f1bd540d3143 (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
{ lib, bundlerApp, makeWrapper,
  # Optional dependencies, can be null
  epubcheck, kindlegen,
  bundlerUpdateScript
}:

let
  app = bundlerApp {
    pname = "asciidoctor";
    gemdir = ./.;

    exes = [
      "asciidoctor"
      "asciidoctor-pdf"
      "asciidoctor-safe"
      "asciidoctor-epub3"
    ];

    buildInputs = [ makeWrapper ];

    postBuild = ''
        wrapProgram "$out/bin/asciidoctor-epub3" \
          ${lib.optionalString (epubcheck != null) "--set EPUBCHECK ${epubcheck}/bin/epubcheck"} \
          ${lib.optionalString (kindlegen != null) "--set KINDLEGEN ${kindlegen}/bin/kindlegen"}
      '';

    passthru = {
      updateScript = bundlerUpdateScript "asciidoctor";
    };

    meta = with lib; {
      description = "A faster Asciidoc processor written in Ruby";
      homepage = "https://asciidoctor.org/";
      license = licenses.mit;
      maintainers = with maintainers; [ gpyh nicknovitski ];
      platforms = platforms.unix;
    };
  };
in
  app