summary refs log tree commit diff
path: root/pkgs/tools/typesetting/asciidoctor
diff options
context:
space:
mode:
authorMichael Peyton Jones <me@michaelpj.com>2019-07-04 12:39:29 +0100
committerMichael Peyton Jones <me@michaelpj.com>2019-07-04 13:16:03 +0100
commit5f0c43dea417cf3b3d8d4a5c268fc49fc4141296 (patch)
treec97b9820ebc38c09cf2def67fab7adff073931ba /pkgs/tools/typesetting/asciidoctor
parent73392e79aa62e406683d6a732eb4f4101f4732be (diff)
downloadnixpkgs-5f0c43dea417cf3b3d8d4a5c268fc49fc4141296.tar
nixpkgs-5f0c43dea417cf3b3d8d4a5c268fc49fc4141296.tar.gz
nixpkgs-5f0c43dea417cf3b3d8d4a5c268fc49fc4141296.tar.bz2
nixpkgs-5f0c43dea417cf3b3d8d4a5c268fc49fc4141296.tar.lz
nixpkgs-5f0c43dea417cf3b3d8d4a5c268fc49fc4141296.tar.xz
nixpkgs-5f0c43dea417cf3b3d8d4a5c268fc49fc4141296.tar.zst
nixpkgs-5f0c43dea417cf3b3d8d4a5c268fc49fc4141296.zip
asciidoctor: move mathematical gem config to default gemset config
This has two benefits:
- Anyone else using the `mathematical` gem will benefit from the config.
- The gem config overrides the default one, so we were losing the fixes
for other gems.

I had to change how the update script works. Now it looks at the `gems`
passthru from `bundlerApp`.
Diffstat (limited to 'pkgs/tools/typesetting/asciidoctor')
-rw-r--r--pkgs/tools/typesetting/asciidoctor/default.nix72
-rwxr-xr-xpkgs/tools/typesetting/asciidoctor/update.sh4
2 files changed, 22 insertions, 54 deletions
diff --git a/pkgs/tools/typesetting/asciidoctor/default.nix b/pkgs/tools/typesetting/asciidoctor/default.nix
index 0f9bb0ef7de..9da0d291727 100644
--- a/pkgs/tools/typesetting/asciidoctor/default.nix
+++ b/pkgs/tools/typesetting/asciidoctor/default.nix
@@ -1,59 +1,27 @@
-{ stdenv, lib, bundlerApp, ruby, bundix, mkShell
-  # Dependencies of the 'mathematical' package
-, cmake, bison, flex, glib, pkgconfig, cairo
-, pango, gdk_pixbuf, libxml2, python3, patchelf
-}:
+{ lib, bundlerApp, mkShell, bundix, defaultGemConfig }:
 
-bundlerApp rec {
-  inherit ruby;
-  pname = "asciidoctor";
-  gemdir = ./.;
+let app = bundlerApp {
+    pname = "asciidoctor";
+    gemdir = ./.;
 
-  exes = [
-    "asciidoctor"
-    "asciidoctor-pdf"
-    "asciidoctor-safe"
-  ];
-
-  gemConfig = {
-    mathematical = attrs: {
-      buildInputs = [
-        cmake
-        bison
-        flex
-        glib
-        pkgconfig
-        cairo
-        pango
-        gdk_pixbuf
-        libxml2
-        python3
-      ];
-
-      # The ruby build script takes care of this
-      dontUseCmakeConfigure = true;
+    exes = [
+      "asciidoctor"
+      "asciidoctor-pdf"
+      "asciidoctor-safe"
+    ];
 
-      # For some reason 'mathematical.so' is missing cairo and glib in its RPATH, add them explicitly here
-      postFixup = lib.optionalString stdenv.isLinux ''
-        soPath="$out/${ruby.gemPath}/gems/mathematical-${attrs.version}/lib/mathematical/mathematical.so"
-        ${patchelf}/bin/patchelf \
-          --set-rpath "${lib.makeLibraryPath [ glib cairo ]}:$(${patchelf}/bin/patchelf --print-rpath "$soPath")" \
-          "$soPath"
-      '';
+    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;
     };
   };
 
-  passthru.updateShell = mkShell {
-    buildInputs = (gemConfig.mathematical {}).buildInputs ++ [
-      bundix
-    ];
-  };
-
-  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;
+  shell = mkShell { 
+    buildInputs = 
+      app.gems.mathematical.buildInputs ++ 
+      [ bundix ]; 
   };
-}
+in app.overrideAttrs (attrs: { passthru = attrs.passthru // { updateShell = shell; }; })
diff --git a/pkgs/tools/typesetting/asciidoctor/update.sh b/pkgs/tools/typesetting/asciidoctor/update.sh
index db7511330be..1f7e5541cee 100755
--- a/pkgs/tools/typesetting/asciidoctor/update.sh
+++ b/pkgs/tools/typesetting/asciidoctor/update.sh
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
-rm gemset.nix Gemfile.lock
 nix-shell ../../../.. -A asciidoctor.updateShell --run '
+  rm gemset.nix Gemfile.lock
   bundix -m --bundle-pack-path $TMPDIR/asciidoctor-ruby-bundle
+  rm -r .bundle
 '
-rm -r .bundle