Latest pandoc does not build

I’d like to use the latest version of pandoc (2.19.2), which is in nixpkgs under haskellPackages.pandoc_2_19_2. But I get an error which it tries to build.

To reproduce:

nix-shell -p haskellPackages.pandoc_2_19_2  
# nix log output
@nix { "action": "setPhase", "phase": "setupCompilerEnvironmentPhase" }
Build with /nix/store/c3j80zym4506ljbs0kh25nz1rz4k3399-ghc-9.0.2.
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/f8rszwn09sabzq6g3handfsrsszhhjfk-pandoc-2.19.2.tar.gz
source root is pandoc-2.19.2
setting SOURCE_DATE_EPOCH to timestamp 1000000000 of file pandoc-2.19.2/trypandoc/trypandoc.js
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "compileBuildDriverPhase" }
setupCompileFlags: -package-db=/private/tmp/nix-build-pandoc-2.19.2.drv-0/tmp.Y49l2ForHT/setup-package.conf.d -j10 -threaded -rtsopts
[1 of 1] Compiling Main             ( Setup.hs, /private/tmp/nix-build-pandoc-2.19.2.drv-0/tmp.Y49l2ForHT/Main.o )
Linking Setup ...
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
@nix { "action": "setPhase", "phase": "configurePhase" }
configureFlags: --verbose --prefix=/nix/store/nl55vbpi9ihzx76lhl0fbqk17c799kdj-pandoc-2.19.2 --libdir=$prefix/lib/$compiler --libsubdir=$abi/$libname --datadir=/nix/store/4d8xkwyp8cfi9iss388l9vd8dcwy9anj-pandoc-2.19.2-data/share/ghc-9.0.2 --docdir=/nix/store/c6g81whspx8b4a72szlclaw02nzwj69c-pandoc-2.19.2-doc/share/doc/pandoc-2.19.2 --with-gcc=clang --package-db=/private/tmp/nix-build-pandoc-2.19.2.drv-0/tmp.Y49l2ForHT/package.conf.d --ghc-options=-j10 --disable-split-objs --disable-library-profiling --disable-profiling --enable-shared --disable-coverage --enable-static --disable-executable-dynamic --enable-tests --disable-benchmarks --enable-library-vanilla --disable-library-for-ghci --ghc-options=-haddock -f-trypandoc --extra-lib-dirs=/nix/store/ld46yjcvwbijb8k21ssd2rrzsh5k5x4z-ncurses-6.3-p20220507/lib --extra-lib-dirs=/nix/store/knb42fz7pxpvj81589dg6721d5hfmgaz-libffi-3.4.3/lib --extra-lib-dirs=/nix/store/l5mdd3mw23lll0mc5vaj3l01wipf565m-gmp-with-cxx-6.2.1/lib --extra-include-dirs=/nix/store/fb936lfq7ys7c67p45kb5c9sacx71gl8-libiconv-50/include --extra-lib-dirs=/nix/store/fb936lfq7ys7c67p45kb5c9sacx71gl8-libiconv-50/lib --extra-include-dirs=/nix/store/3k1xfvq27p84lf1i4hgi3ii36sj2nxf8-libcxx-11.1.0-dev/include --extra-lib-dirs=/nix/store/wgc1qzh7wppinld2b5h695bnwsr72q9l-libcxx-11.1.0/lib --extra-include-dirs=/nix/store/89iyd375r15p04x63j205jv02bj6i1jh-libcxxabi-11.1.0-dev/include --extra-lib-dirs=/nix/store/j8fhki0ds4g7x4rmzy8h7bfdm2irl82g-libcxxabi-11.1.0/lib --extra-lib-dirs=/nix/store/0ymp3pgykzsk3a6k5g9ddx9lvr2gjnjv-compiler-rt-libc-11.1.0/lib --extra-framework-dirs=/nix/store/9rb5qaba71mkgfgd8wfqg03cmi46xarg-apple-framework-CoreFoundation-11.0.0/Library/Frameworks --extra-include-dirs=/nix/store/jzid7pfrhv6gpiwqbx6763v0g9c3bdzb-libobjc-11.0.0/include --extra-lib-dirs=/nix/store/jzid7pfrhv6gpiwqbx6763v0g9c3bdzb-libobjc-11.0.0/lib
Using Parsec parser
Configuring pandoc-2.19.2...

Setup: Encountered missing or private dependencies:
citeproc >= && <0.9,
doclayout >=0.4 && <0.5,
gridtables >=0.0.3 && <0.1,
skylighting >=0.13 && <0.14,
skylighting-core >=0.13 && <0.14,
texmath >= && <0.12.6

Environment info:

  • Nix version: 2.9.1
  • System: aarch64-darwin
  • Channel: nixpkgs-unstable

Am I doing something wrong, or is there a way for me to fix this with an overlay?

Thank you!

The Haskell stuff in Nixpkgs is based on some stackage resolver, currently LTS-19. It is likely that the latest version of pandoc requires versions of a bunch of dependencies that aren’t in the latest LTS release.

There are generally two ways to work around this:

  1. Try doJailbreak on the latest version of pandoc and see if that is able to successfully compile. Grep for some examples of doJailbreak in pkgs/development/haskell-modules/configuration-common.nix the Nixpkgs repo.
  2. Try overriding these dependency versions that cabal is complaining about. I suggest using .overrideScope, like nixpkgs/configuration-common.nix at 4fe3556c48f684ed41d538058458ffb9ddbff68c · NixOS/nixpkgs · GitHub.

The foo_0_1_2_3 Haskell packages in Nixpkgs are for end-user convenience, but there are no guarantees that they work.

1 Like

Thank you! I didn’t know that about the versioned Haskell packages, so that’s good to know.

I was eventually able to get Pandoc working with the following overlay:

         (final: prev: {
            haskellPackages = prev.haskellPackages.override {
              overrides = hfinal: hprev: let
                inherit (final.haskell.lib) unmarkBroken appendPatch dontCheck;
                with hprev; {
                  citeproc = citeproc_0_8_0_2;
                  doclayout = doclayout_0_4;
                  doctemplates = doctemplates_0_10_0_2;
                  skylighting = skylighting_0_13_1;
                  skylighting-core = skylighting-core_0_13_1;
                  skylighting-format-ansi = unmarkBroken hprev.skylighting-format-ansi;
                  texmath = texmath_0_12_5_4;
                  hslua = hslua_2_2_1;
                  hslua-core = hslua-core_2_2_1;
                  hslua-aeson = hslua-aeson_2_2_1;
                  hslua-classes = hslua-classes_2_2_0;
                  hslua-packaging = hslua-packaging_2_2_1;
                  hslua-marshalling = hslua-marshalling_2_2_1;
                  hslua-objectorientation = hslua-objectorientation_2_2_1;
                  lua = lua_2_2_1;
                  pandoc = dontCheck (appendPatch pandoc_2_19_2 ./pandoc.patch);

pandoc.patch :

diff --git a/pandoc.cabal b/pandoc.cabal
index 3d6923f..fa68f9a 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -492,7 +492,7 @@ library
                  exceptions            >= 0.8      && < 0.11,
                  file-embed            >= 0.0      && < 0.1,
                  filepath              >= 1.1      && < 1.5,
-                 gridtables            >= 0.0.3    && < 0.1,
+                 gridtables            >= 0.1      && < 0.2,
                  haddock-library       >= 1.10     && < 1.12,
                  hslua-module-doclayout>= 1.0.4    && < 1.1,
                  hslua-module-path     >= 1.0.3    && < 1.1,

The only dependency I needed to fudge was gridtables, (nixpkgs version is actually too new, but pandoc upstream is already using the current nixpkgs one without issue so I think this is fine).

I know you recommended overrideScope, but when I tried that the overrides didn’t seem to recognize each other (e.g. hslua-classes still had the original hslua-core, not the overridden one). Maybe I was using it wrong?

Anyways, thank you very much for the pointers!

1 Like

Great, I’m glad you were able to get it working, and thanks for sharing your solution!

1 Like