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

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 = {
      inherit updateShell;
    };

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

  updateShell = mkShell {
    inputsFrom = lib.attrValues app.gems;
    buildInputs = [ bundix ];
  };
in
  app