23 , withData ? true, poppler_data
24 , qt5Support ? false, qt6Support ? false, qtbase ? null
25 , introspectionSupport ? false, gobject-introspection ? null
26 , gpgmeSupport ? false, gpgme ? null
27 , utils ? false, nss ? null
33 mkFlag = optset: flag: "-DENABLE_${flag}=${if optset then "on" else "off"}";
35 # unclear relationship between test data repo versions and poppler
36 # versions, though files don't appear to be updated after they're
37 # added, so it's probably safe to just always use the latest available
39 testData = fetchFromGitLab {
40 domain = "gitlab.freedesktop.org";
43 rev = "e3cdc82782941a8d7b8112f83b4a81b3d334601a";
44 hash = "sha256-i/NjVWC/PXAXnv88qNaHFBQQNEjRgjdV224NgENaESo=";
47 stdenv.mkDerivation (finalAttrs: rec {
48 pname = "poppler-${suffix}";
49 version = "23.11.0"; # beware: updates often break cups-filters build, check scribus too!
51 outputs = [ "out" "dev" ];
54 url = "https://poppler.freedesktop.org/poppler-${version}.tar.xz";
55 hash = "sha256-+ZzKZ5nLnLbJL8Hg63hUe2EctzN1CrfLBHyw5sJGU5w=";
69 ] ++ lib.optionals withData [
73 # TODO: reduce propagation to necessary libs
74 propagatedBuildInputs = [
80 ] ++ lib.optionals (!minimal) [
85 ] ++ lib.optionals (qt5Support || qt6Support) [
87 ] ++ lib.optionals introspectionSupport [
89 ] ++ lib.optionals gpgmeSupport [
94 (mkFlag true "UNSTABLE_API_ABI_HEADERS") # previously "XPDF_HEADERS"
95 (mkFlag (!minimal) "GLIB")
96 (mkFlag (!minimal) "CPP")
97 (mkFlag (!minimal) "LIBCURL")
98 (mkFlag (!minimal) "LCMS")
99 (mkFlag (!minimal) "LIBTIFF")
100 (mkFlag (!minimal) "NSS3")
101 (mkFlag utils "UTILS")
102 (mkFlag qt5Support "QT5")
103 (mkFlag qt6Support "QT6")
104 (mkFlag gpgmeSupport "GPGME")
105 ] ++ lib.optionals finalAttrs.doCheck [
106 "-DTESTDATADIR=${testData}"
108 disallowedReferences = lib.optional finalAttrs.doCheck testData;
110 dontWrapQtApps = true;
113 preConfigure = lib.optionalString stdenv.isDarwin ''
114 sed -i -e '1i cmake_policy(SET CMP0025 NEW)' CMakeLists.txt
117 # Work around gpgme trying to write to $HOME during qt5 and qt6 tests:
118 preCheck = lib.optionalString gpgmeSupport ''
120 export HOME="$(mktemp -d)"
123 postCheck = lib.optionalString gpgmeSupport ''
124 export HOME="$HOME_orig"
133 # These depend on internal poppler code that frequently changes.
134 inherit inkscape cups-filters scribus;
139 homepage = "https://poppler.freedesktop.org/";
140 description = "A PDF rendering library";
142 Poppler is a PDF rendering library based on the xpdf-3.0 code base. In
143 addition it provides a number of tools that can be installed separately.
145 license = licenses.gpl2Plus;
146 platforms = platforms.all;
147 maintainers = with maintainers; [ ttuegel ] ++ teams.freedesktop.members;