diff --git a/pkgs/development/libraries/quarto/default.nix b/pkgs/development/libraries/quarto/default.nix index acdb76cc52b2f..75bab25e5f212 100644 --- a/pkgs/development/libraries/quarto/default.nix +++ b/pkgs/development/libraries/quarto/default.nix @@ -1,6 +1,6 @@ { stdenv , lib -, pandoc +, callPackage , typst , esbuild , deno @@ -17,6 +17,9 @@ , sysctl }: +let + pandoc = callPackage ./pandoc/package.nix {}; +in stdenv.mkDerivation (final: { pname = "quarto"; version = "1.6.33"; diff --git a/pkgs/development/libraries/quarto/pandoc/haskell-packages.nix b/pkgs/development/libraries/quarto/pandoc/haskell-packages.nix new file mode 100644 index 0000000000000..5e5d9cf960583 --- /dev/null +++ b/pkgs/development/libraries/quarto/pandoc/haskell-packages.nix @@ -0,0 +1,868 @@ +{ haskellPackages, lib }: +haskellPackages.override { + overrides = self: super: { + "pandoc" = self.callPackage ( + { + mkDerivation, + aeson, + aeson-pretty, + array, + attoparsec, + base, + base64-bytestring, + binary, + blaze-html, + blaze-markup, + bytestring, + case-insensitive, + citeproc, + commonmark, + commonmark-extensions, + commonmark-pandoc, + containers, + crypton, + crypton-connection, + crypton-x509-system, + data-default, + deepseq, + Diff, + directory, + djot, + doclayout, + doctemplates, + emojis, + exceptions, + file-embed, + filepath, + Glob, + gridtables, + haddock-library, + http-client, + http-client-tls, + http-types, + ipynb, + jira-wiki-markup, + JuicyPixels, + mime-types, + mtl, + network, + network-uri, + pandoc-types, + parsec, + pretty, + pretty-show, + process, + random, + safe, + scientific, + skylighting, + skylighting-core, + split, + syb, + tagsoup, + tasty, + tasty-bench, + tasty-golden, + tasty-hunit, + tasty-quickcheck, + temporary, + texmath, + text, + text-conversions, + time, + tls, + typst, + unicode-collation, + unicode-transforms, + unix, + vector, + xml, + xml-conduit, + xml-types, + yaml, + zip-archive, + zlib, + happy, + SHA, + }: + mkDerivation { + pname = "pandoc"; + version = "3.5"; + sha256 = "FF+pSiy4okgMQhohD0d8BESCwIDu0tvFA2Z11JuzQ1w="; + configureFlags = [ "-f-trypandoc" ]; + enableSeparateDataOutput = true; + libraryHaskellDepends = [ + aeson + aeson-pretty + array + attoparsec + base + base64-bytestring + binary + blaze-html + blaze-markup + bytestring + case-insensitive + citeproc + commonmark + commonmark-extensions + commonmark-pandoc + containers + crypton + crypton-connection + crypton-x509-system + data-default + deepseq + directory + djot + doclayout + doctemplates + emojis + exceptions + file-embed + filepath + Glob + gridtables + haddock-library + http-client + http-client-tls + http-types + ipynb + jira-wiki-markup + JuicyPixels + mime-types + mtl + network + network-uri + pandoc-types + parsec + pretty + pretty-show + process + random + safe + scientific + skylighting + skylighting-core + split + syb + tagsoup + temporary + texmath + text + text-conversions + time + tls + typst + unicode-collation + unicode-transforms + unix + vector + xml + xml-conduit + xml-types + yaml + zip-archive + zlib + happy + SHA + ]; + testHaskellDepends = [ + base + bytestring + containers + Diff + directory + doctemplates + filepath + Glob + mtl + pandoc-types + process + tasty + tasty-golden + tasty-hunit + tasty-quickcheck + temporary + text + time + xml + zip-archive + ]; + benchmarkHaskellDepends = [ + base + bytestring + deepseq + mtl + tasty-bench + text + ]; + doHaddock = false; + description = "Conversion between markup formats"; + license = lib.licenses.gpl2Plus; + hydraPlatforms = lib.platforms.none; + } + ) { }; + + "doclayout" = self.callPackage ( + { + mkDerivation, + base, + containers, + criterion, + deepseq, + emojis, + mtl, + safe, + tasty, + tasty-golden, + tasty-hunit, + tasty-quickcheck, + text, + }: + mkDerivation { + pname = "doclayout"; + version = "0.5"; + sha256 = "sDBBAkXZ3qch5b11URuVvAOA7+FZBm85FJFuOtKvJJY="; + enableSeparateDataOutput = true; + libraryHaskellDepends = [ + base + containers + emojis + mtl + safe + text + ]; + testHaskellDepends = [ + base + emojis + mtl + tasty + tasty-golden + tasty-hunit + tasty-quickcheck + text + ]; + benchmarkHaskellDepends = [ + base + criterion + deepseq + emojis + mtl + text + ]; + description = "A prettyprinting library for laying out text documents"; + license = lib.licenses.bsd3; + hydraPlatforms = lib.platforms.none; + } + ) { }; + + "doclayout_0_5" = self.callPackage ( + { + mkDerivation, + base, + containers, + criterion, + deepseq, + emojis, + mtl, + safe, + tasty, + tasty-golden, + tasty-hunit, + tasty-quickcheck, + text, + }: + mkDerivation { + pname = "doclayout"; + version = "0.5"; + sha256 = "15i4mz93lvli2hwny1jrw7pq00xwjldm2xdxwlhsgpnr8l142c5h"; + enableSeparateDataOutput = true; + libraryHaskellDepends = [ + base + containers + emojis + mtl + safe + text + ]; + testHaskellDepends = [ + base + emojis + mtl + tasty + tasty-golden + tasty-hunit + tasty-quickcheck + text + ]; + benchmarkHaskellDepends = [ + base + criterion + deepseq + emojis + mtl + text + ]; + description = "A prettyprinting library for laying out text documents"; + license = lib.licenses.bsd3; + hydraPlatforms = lib.platforms.none; + } + ) { }; + + "pandoc-cli" = self.callPackage ( + { + mkDerivation, + base, + hslua-cli, + pandoc, + pandoc-lua-engine, + pandoc-server, + safe, + temporary, + text, + wai-extra, + warp, + }: + mkDerivation { + pname = "pandoc-cli"; + version = "3.5"; + sha256 = "0q6zhwgzipfcy36fsdnq5mkqq25kirscvfb347n3drmc2lnw5lmr"; + isLibrary = false; + isExecutable = true; + executableHaskellDepends = [ + base + hslua-cli + pandoc + pandoc-lua-engine + pandoc-server + safe + temporary + text + wai-extra + warp + ]; + description = "Conversion between documentation formats"; + license = lib.licenses.gpl2Plus; + hydraPlatforms = lib.platforms.none; + mainProgram = "pandoc"; + } + ) { }; + + "tls" = self.callPackage ( + { + mkDerivation, + asn1-encoding, + asn1-types, + async, + base, + base16-bytestring, + bytestring, + cereal, + crypton, + crypton-x509, + crypton-x509-store, + crypton-x509-validation, + data-default-class, + hourglass, + hspec, + hspec-discover, + memory, + mtl, + network, + QuickCheck, + serialise, + transformers, + unix-time, + }: + mkDerivation { + pname = "tls"; + version = "2.0.6"; + sha256 = "07cznhk0jf2ffkpmq3q9iz9r4zcls8rkh32s3qqwaahp8lnvmsm3"; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + asn1-encoding + asn1-types + async + base + base16-bytestring + bytestring + cereal + crypton + crypton-x509 + crypton-x509-store + crypton-x509-validation + data-default-class + memory + mtl + network + serialise + transformers + unix-time + ]; + testHaskellDepends = [ + asn1-types + async + base + bytestring + crypton + crypton-x509 + crypton-x509-validation + data-default-class + hourglass + hspec + QuickCheck + serialise + ]; + testToolDepends = [ hspec-discover ]; + description = "TLS protocol native implementation"; + license = lib.licenses.bsd3; + hydraPlatforms = lib.platforms.none; + } + ) { }; + + "toml-parser" = self.callPackage ( + { + mkDerivation, + alex, + array, + base, + containers, + happy, + hspec, + hspec-discover, + markdown-unlit, + prettyprinter, + template-haskell, + text, + time, + transformers, + }: + mkDerivation { + pname = "toml-parser"; + version = "2.0.1.0"; + sha256 = "1qcpcrcalds3a2gdx83iynpj3hvkg6hbyza8al0f7jdsg9r6sdh3"; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + array + base + containers + prettyprinter + text + time + transformers + ]; + libraryToolDepends = [ + alex + happy + ]; + testHaskellDepends = [ + base + containers + hspec + template-haskell + text + time + ]; + testToolDepends = [ + hspec-discover + markdown-unlit + ]; + description = "TOML 1.0.0 parser"; + license = lib.licenses.isc; + hydraPlatforms = lib.platforms.none; + } + ) { }; + + "typst-symbols" = self.callPackage ( + { + mkDerivation, + base, + text, + }: + mkDerivation { + pname = "typst-symbols"; + version = "0.1.6"; + sha256 = "sha256-lH/yoJVJpqA4cyfmsVySGZR75n6+X7GQ0fuYSV1+Qp0="; + libraryHaskellDepends = [ + base + text + ]; + description = "Symbol and emoji lookup for typst language"; + license = lib.licenses.mit; + hydraPlatforms = lib.platforms.none; + } + ) { }; + + "typst" = self.callPackage ( + { + mkDerivation, + aeson, + array, + base, + bytestring, + cassava, + containers, + directory, + filepath, + mtl, + ordered-containers, + parsec, + pretty, + pretty-show, + regex-tdfa, + scientific, + tasty, + tasty-golden, + text, + time, + toml-parser, + typst-symbols, + vector, + xml-conduit, + yaml, + }: + mkDerivation { + pname = "typst"; + version = "0.6"; + sha256 = "oR842EM4ZuKmLLIhzvRgk36vHvXKhPEfWH3niU9vVyQ="; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + aeson + array + base + bytestring + cassava + containers + directory + filepath + mtl + ordered-containers + parsec + pretty + regex-tdfa + scientific + text + time + toml-parser + typst-symbols + vector + xml-conduit + yaml + ]; + testHaskellDepends = [ + base + bytestring + directory + filepath + pretty-show + tasty + tasty-golden + text + time + ]; + description = "Parsing and evaluating typst syntax"; + license = lib.licenses.bsd3; + hydraPlatforms = lib.platforms.none; + } + ) { }; + + "texmath" = self.callPackage ( + { + mkDerivation, + base, + bytestring, + containers, + directory, + filepath, + mtl, + pandoc-types, + parsec, + pretty-show, + split, + syb, + tagged, + tasty, + tasty-golden, + text, + typst-symbols, + xml, + }: + mkDerivation { + pname = "texmath"; + version = "0.12.8.11"; + sha256 = "0yyxr5bdl1shsp3ir9d9a2hwah3cz6p3pvak27k4fvk1idisds7z"; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + base + containers + mtl + pandoc-types + parsec + split + syb + text + typst-symbols + xml + ]; + testHaskellDepends = [ + base + bytestring + directory + filepath + pretty-show + tagged + tasty + tasty-golden + text + xml + ]; + description = "Conversion between math formats"; + license = lib.licenses.gpl2Only; + hydraPlatforms = lib.platforms.none; + } + ) { }; + + "gridtables" = self.callPackage ( + { + mkDerivation, + array, + base, + containers, + doclayout, + parsec, + tasty, + tasty-hunit, + text, + }: + mkDerivation { + pname = "gridtables"; + version = "0.1.0.0"; + sha256 = "1smhbb2jxysbqhxww5rikjfnhsdbf0gq3kgnn6ikjzcrqwdk9b6n"; + revision = "1"; + editedCabalFile = "0ay4ywi8w5kk4blf8jqxhivzprp1ivpdlw6racr1692psyizmxi0"; + libraryHaskellDepends = [ + array + base + containers + doclayout + parsec + text + ]; + testHaskellDepends = [ + array + base + parsec + tasty + tasty-hunit + text + ]; + description = "Parser for reStructuredText-style grid tables"; + license = lib.licenses.mit; + } + ) { }; + + "pandoc-lua-engine" = self.callPackage ( + { + mkDerivation, + aeson, + base, + bytestring, + citeproc, + containers, + crypton, + data-default, + directory, + doclayout, + doctemplates, + exceptions, + filepath, + hslua, + hslua-module-doclayout, + hslua-module-path, + hslua-module-system, + hslua-module-text, + hslua-module-version, + hslua-module-zip, + hslua-repl, + lpeg, + mtl, + pandoc, + pandoc-lua-marshal, + pandoc-types, + parsec, + tasty, + tasty-golden, + tasty-hunit, + tasty-lua, + text, + }: + mkDerivation { + pname = "pandoc-lua-engine"; + version = "0.3.3"; + sha256 = "0jzddmg2qnbdv83hrfmxhfibp8p1mm9j32vxm89kg6fbx688n5hw"; + libraryHaskellDepends = [ + aeson + base + bytestring + citeproc + containers + crypton + data-default + doclayout + doctemplates + exceptions + hslua + hslua-module-doclayout + hslua-module-path + hslua-module-system + hslua-module-text + hslua-module-version + hslua-module-zip + hslua-repl + lpeg + mtl + pandoc + pandoc-lua-marshal + pandoc-types + parsec + text + ]; + testHaskellDepends = [ + base + bytestring + data-default + directory + exceptions + filepath + hslua + pandoc + pandoc-types + tasty + tasty-golden + tasty-hunit + tasty-lua + text + ]; + description = "Lua engine to power custom pandoc conversions"; + license = lib.licenses.gpl2Plus; + hydraPlatforms = lib.platforms.none; + } + ) { }; + + "hslua-module-doclayout" = self.callPackage ( + { + mkDerivation, + base, + doclayout, + hslua, + tasty, + tasty-hunit, + tasty-lua, + text, + }: + mkDerivation { + pname = "hslua-module-doclayout"; + version = "1.2.0"; + sha256 = "1x3znkdz1l8p8gsvazz85936p107xscsaah1ac3padyiswhair1j"; + libraryHaskellDepends = [ + base + doclayout + hslua + text + ]; + testHaskellDepends = [ + base + doclayout + hslua + tasty + tasty-hunit + tasty-lua + text + ]; + description = "Lua module wrapping Text.DocLayout."; + license = lib.licenses.mit; + hydraPlatforms = lib.platforms.none; + } + ) { }; + + "lpeg" = self.callPackage ( + { + mkDerivation, + base, + lua, + tasty, + tasty-hunit, + }: + mkDerivation { + pname = "lpeg"; + version = "1.1.0"; + sha256 = "0yav34yxrkbgnkcd3870smay5s3cypyd28m0fsg2jhlikgmhj5a1"; + libraryHaskellDepends = [ + base + lua + ]; + testHaskellDepends = [ + base + lua + tasty + tasty-hunit + ]; + description = "LPeg – Parsing Expression Grammars For Lua"; + license = lib.licenses.mit; + hydraPlatforms = lib.platforms.none; + } + ) { }; + + "pandoc-server" = self.callPackage ( + { + mkDerivation, + aeson, + base, + base64-bytestring, + bytestring, + containers, + data-default, + doctemplates, + pandoc, + pandoc-types, + servant-server, + skylighting, + text, + unicode-collation, + wai, + wai-cors, + }: + mkDerivation { + pname = "pandoc-server"; + version = "0.1.0.9"; + sha256 = "1bdfd0lq0vdrr8rvjxin6j011jg4kn210zzpz2lixvc8wfcw66w8"; + libraryHaskellDepends = [ + aeson + base + base64-bytestring + bytestring + containers + data-default + doctemplates + pandoc + pandoc-types + servant-server + skylighting + text + unicode-collation + wai + wai-cors + ]; + description = "Pandoc document conversion as an HTTP servant-server"; + license = lib.licenses.gpl2Plus; + hydraPlatforms = lib.platforms.none; + } + ) { }; + + }; +} diff --git a/pkgs/development/libraries/quarto/pandoc/package.nix b/pkgs/development/libraries/quarto/pandoc/package.nix new file mode 100644 index 0000000000000..92e4aabf35765 --- /dev/null +++ b/pkgs/development/libraries/quarto/pandoc/package.nix @@ -0,0 +1,50 @@ +{ + stdenv, + lib, + haskellPackages, + haskell, + removeReferencesTo, + installShellFiles, +}: + +let + # Since pandoc 3.0 the pandoc binary resides in the pandoc-cli package. + haskellPackagesPatched = (import ./haskell-packages.nix { inherit haskellPackages lib; }); + static = haskell.lib.compose.justStaticExecutables haskellPackagesPatched.pandoc-cli; +in +(haskell.lib.compose.overrideCabal (drv: { + configureFlags = drv.configureFlags or [ ] ++ [ "-fembed_data_files" ]; + buildDepends = drv.buildDepends or [ ] ++ [ haskellPackages.file-embed ]; + buildTools = (drv.buildTools or [ ]) ++ [ + removeReferencesTo + installShellFiles + ]; + + # Normally, the static linked executable shouldn't refer to any library or the compiler. + # This is not always the case when the dependency has Paths_* module generated by Cabal, + # where bindir, datadir, and libdir contain the path to the library, and thus make the + # executable indirectly refer to GHC. However, most Haskell programs only use Paths_*.version for + # getting the version at runtime, so it's safe to remove the references to them. + # This is true so far for pandoc-types and warp. + # For details see: https://github.com/NixOS/nixpkgs/issues/34376 + postInstall = + drv.postInstall or "" + + '' + remove-references-to \ + -t ${haskellPackagesPatched.pandoc-types} \ + $out/bin/pandoc + remove-references-to \ + -t ${haskellPackagesPatched.warp} \ + $out/bin/pandoc + remove-references-to \ + -t ${haskellPackagesPatched.pandoc} \ + $out/bin/pandoc + '' + + lib.optionalString (stdenv.buildPlatform == stdenv.hostPlatform) '' + mkdir -p $out/share/bash-completion/completions + $out/bin/pandoc --bash-completion > $out/share/bash-completion/completions/pandoc + '' + + '' + installManPage man/* + ''; +}) static)