From d6b7b2a8cfa0803091a4689fa4d307c538ce6bf9 Mon Sep 17 00:00:00 2001 From: Michael Peyton Jones Date: Thu, 4 Jul 2019 14:55:02 +0100 Subject: [PATCH] asciidoctor: wrap asciidoctor-epub3 for epubcheck and kindlegen kindlegen is unfree, so we don't include it by default. The derivation can be overridden to include it. --- pkgs/tools/typesetting/asciidoctor/default.nix | 15 ++++++++++++++- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/typesetting/asciidoctor/default.nix b/pkgs/tools/typesetting/asciidoctor/default.nix index 0704600916aa..16ab64db257f 100644 --- a/pkgs/tools/typesetting/asciidoctor/default.nix +++ b/pkgs/tools/typesetting/asciidoctor/default.nix @@ -1,4 +1,9 @@ -{ lib, bundlerApp, mkShell, bundix }: +{ lib, bundlerApp, makeWrapper, + # Optional dependencies, can be null + epubcheck, kindlegen, + # For the update shell + mkShell, bundix +}: let app = bundlerApp { pname = "asciidoctor"; @@ -11,6 +16,14 @@ let app = bundlerApp { "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"} + ''; + meta = with lib; { description = "A faster Asciidoc processor written in Ruby"; homepage = https://asciidoctor.org/; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d2c1c10f5cf8..ee30358267b1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1922,7 +1922,7 @@ in enableExtraPlugins = true; }); - asciidoctor = callPackage ../tools/typesetting/asciidoctor { }; + asciidoctor = callPackage ../tools/typesetting/asciidoctor { kindlegen = null; }; asunder = callPackage ../applications/audio/asunder { };