diff --git a/cabal2nix.cabal b/cabal2nix.cabal
--- a/cabal2nix.cabal
+++ b/cabal2nix.cabal
@@ -1,5 +1,5 @@
 name:               cabal2nix
-version:            2.12
+version:            2.13
 synopsis:           Convert Cabal files into Nix build instructions.
 description:
   Convert Cabal files into Nix build instructions. Users of Nix can install the latest
@@ -74,7 +74,7 @@
                     Александр Цамутали
 maintainer:         Peter Simons <simons@cryp.to>
 stability:          stable
-tested-with:        GHC == 8.4.4, GHC == 8.6.2
+tested-with:        GHC == 8.4.4, GHC == 8.6.3
 category:           Distribution, Nix
 homepage:           https://github.com/nixos/cabal2nix#readme
 bug-reports:        https://github.com/nixos/cabal2nix/issues
@@ -200,5 +200,7 @@
   default-extensions: MonadFailDesugaring
   build-tools:        cabal2nix
   ghc-options:        -Wall -Wcompat -Wincomplete-uni-patterns -Wincomplete-record-updates
-                      -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
-                      -with-rtsopts=-K1K
+                      -Wredundant-constraints -threaded -with-rtsopts=-K64K
+                      -- TODO: This ought to be 1K!                     ^^^
+                      --       https://github.com/NixOS/cabal2nix/issues/398
+                      --       https://github.com/feuerbach/tasty/issues/234
diff --git a/src/Cabal2nix.hs b/src/Cabal2nix.hs
--- a/src/Cabal2nix.hs
+++ b/src/Cabal2nix.hs
@@ -49,6 +49,7 @@
   , optHpack :: Bool
   , optDoCheck :: Bool
   , optJailbreak :: Bool
+  , optDoBenchmark :: Bool
   , optRevision :: Maybe String
   , optHyperlinkSource :: Bool
   , optEnableLibraryProfiling :: Bool
@@ -76,6 +77,7 @@
           <*> switch (long "hpack" <> help "run hpack before configuring this package (only non-hackage packages)")
           <*> flag True False (long "no-check" <> help "don't run regression test suites of this package")
           <*> switch (long "jailbreak" <> help "disregard version restrictions on build inputs")
+          <*> switch (long "benchmark" <> help "enable benchmarks for this package")
           <*> optional (strOption $ long "revision" <> help "revision to use when fetching from VCS")
           <*> flag True False (long "no-hyperlink-source" <> help "don't generate pretty-printed source code for the documentation")
           <*> switch (long "enable-library-profiling" <> help "enable library profiling in the generated build")
@@ -228,6 +230,7 @@
               & metaSection.maintainers .~ Set.fromList (map (review ident) optMaintainer)
 --            & metaSection.platforms .~ Set.fromList optPlatform
               & doCheck &&~ optDoCheck
+              & doBenchmark ||~ optDoBenchmark
               & extraFunctionArgs %~ Set.union (Set.fromList ("inherit stdenv":map (fromString . ("inherit " ++)) optExtraArgs))
 
       shell :: Doc
diff --git a/src/Distribution/Nixpkgs/Haskell/Derivation.hs b/src/Distribution/Nixpkgs/Haskell/Derivation.hs
--- a/src/Distribution/Nixpkgs/Haskell/Derivation.hs
+++ b/src/Distribution/Nixpkgs/Haskell/Derivation.hs
@@ -7,7 +7,7 @@
 module Distribution.Nixpkgs.Haskell.Derivation
   ( Derivation, nullDerivation, pkgid, revision, src, subpath, isLibrary, isExecutable
   , extraFunctionArgs, libraryDepends, executableDepends, testDepends, configureFlags
-  , cabalFlags, runHaddock, jailbreak, doCheck, testTarget, hyperlinkSource, enableSplitObjs
+  , cabalFlags, runHaddock, jailbreak, doCheck, doBenchmark, testTarget, hyperlinkSource, enableSplitObjs
   , enableLibraryProfiling, enableExecutableProfiling, phaseOverrides, editedCabalFile, metaSection
   , dependencies, setupDepends, benchmarkDepends, enableSeparateDataOutput
   )
@@ -55,6 +55,7 @@
   , _runHaddock                 :: Bool
   , _jailbreak                  :: Bool
   , _doCheck                    :: Bool
+  , _doBenchmark                :: Bool
   , _testTarget                 :: String
   , _hyperlinkSource            :: Bool
   , _enableLibraryProfiling     :: Bool
@@ -86,6 +87,7 @@
   , _runHaddock = error "undefined Derivation.runHaddock"
   , _jailbreak = error "undefined Derivation.jailbreak"
   , _doCheck = error "undefined Derivation.doCheck"
+  , _doBenchmark = error "undefined Derivation.doBenchmark"
   , _testTarget = error "undefined Derivation.testTarget"
   , _hyperlinkSource = error "undefined Derivation.hyperlinkSource"
   , _enableLibraryProfiling = error "undefined Derivation.enableLibraryProfiling"
@@ -131,6 +133,7 @@
       , boolattr "doHaddock" (not _runHaddock) _runHaddock
       , boolattr "jailbreak" _jailbreak _jailbreak
       , boolattr "doCheck" (not _doCheck) _doCheck
+      , boolattr "doBenchmark" _doBenchmark _doBenchmark
       , onlyIf (not (null _testTarget)) $ attr "testTarget" $ string _testTarget
       , boolattr "hyperlinkSource" (not _hyperlinkSource) _hyperlinkSource
       , onlyIf (not (null _phaseOverrides)) $ vcat ((map text . lines) _phaseOverrides)
diff --git a/src/Distribution/Nixpkgs/Haskell/FromCabal.hs b/src/Distribution/Nixpkgs/Haskell/FromCabal.hs
--- a/src/Distribution/Nixpkgs/Haskell/FromCabal.hs
+++ b/src/Distribution/Nixpkgs/Haskell/FromCabal.hs
@@ -91,6 +91,7 @@
     & runHaddock .~ doHaddockPhase
     & jailbreak .~ False
     & doCheck .~ True
+    & doBenchmark .~ False
     & testTarget .~ mempty
     & hyperlinkSource .~ True
     & enableSplitObjs .~ True
diff --git a/src/Distribution/Nixpkgs/Haskell/FromCabal/Flags.hs b/src/Distribution/Nixpkgs/Haskell/FromCabal/Flags.hs
--- a/src/Distribution/Nixpkgs/Haskell/FromCabal/Flags.hs
+++ b/src/Distribution/Nixpkgs/Haskell/FromCabal/Flags.hs
@@ -22,24 +22,16 @@
  | name == "fltkhs"             = [enable "opengl"]
  | name == "folds"              = [disable "test-hlint"]
  | name == "git-annex"          = [ enable "assistant"
-                                  , enable "cryptonite"
+                                  , disable "benchmark"
                                   , enable "dbus"
-                                  , enable "desktopnotify"
-                                  , enable "dns"
-                                  , enable "feed"
-                                  , enable "inotify"
+                                  , disable "debuglocks"
+                                  , enable "magicmime"
                                   , enable "pairing"
                                   , enable "production"
-                                  , enable "quvi"
-                                  , disable "s3"
-                                  , enable "tahoe"
-                                  , enable "tdfa"
-                                  , ("testsuite", version `withinRange` "< 6.20170925 || >= 6.20171214")
+                                  , enable "s3"
                                   , enable "torrentparser"
-                                  , disable "webapp"
-                                  , disable "webapp-secure"
+                                  , enable "webapp"
                                   , enable "webdav"
-                                  , enable "xmpp"
                                   ]
  | name == "haskeline"          = [enable "terminfo"]
  | name == "haste-compiler"     = [enable "portable"]
diff --git a/src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs b/src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs
--- a/src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs
+++ b/src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs
@@ -59,7 +59,7 @@
 libNixName "gnome-vfs-2.0"                      = return "gnome-vfs"
 libNixName "gnome-vfs-module-2.0"               = return "gnome-vfs_module"
 libNixName "gobject-2.0"                        = return "glib"
-libNixName "gobject-introspection-1.0"          = return "gobjectIntrospection"
+libNixName "gobject-introspection-1.0"          = return "gobject-introspection"
 libNixName "gstreamer-audio-0.10"               = return "gst-plugins-base"
 libNixName "gstreamer-audio-1.0"                = return "gst-plugins-base"
 libNixName "gstreamer-base-0.10"                = return "gst-plugins-base"
diff --git a/src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs b/src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs
--- a/src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs
+++ b/src/Distribution/Nixpkgs/Haskell/FromCabal/PostProcess.hs
@@ -147,9 +147,9 @@
   , ("network-attoparsec", set doCheck False) -- test suite requires network access
   , ("numeric-qq", set doCheck False) -- test suite doesn't finish even after 1+ days
   , ("opencv", opencvOverrides)
-  , ("pandoc >= 1.16.0.2", set doCheck False) -- https://github.com/jgm/pandoc/issues/2709 and https://github.com/fpco/stackage/issues/1332
-  , ("pandoc", set jailbreak False) -- jailbreak-cabal break the build
-  , ("pandoc-citeproc", set doCheck False) -- https://github.com/jgm/pandoc-citeproc/issues/172
+  , ("pandoc >= 1.16.0.2 && < 2.5", set doCheck False) -- https://github.com/jgm/pandoc/issues/2709 and https://github.com/fpco/stackage/issues/1332
+  , ("pandoc", pandocOverrides)
+  , ("pandoc-citeproc", set doCheck False) -- https://github.com/jgm/pandoc-citeproc/issues/369
   , ("purescript", set doCheck False) -- test suite doesn't cope with Nix build env
   , ("proto-lens-protobuf-types", set (libraryDepends . tool . contains (pkg "protobuf")) True)
   , ("proto-lens-protoc", set (libraryDepends . tool . contains (pkg "protobuf")) True)
@@ -381,3 +381,12 @@
                     , "pkgs.xorg.libXt"
                     , "pkgs.xorg.libXmu"
                     ]
+
+pandocOverrides :: Derivation -> Derivation
+pandocOverrides = set phaseOverrides postInstall
+  where
+    postInstall = unlines [ "postInstall = ''"
+                          , "  mkdir -p $out/share"
+                          , "  mv $data/*/*/man $out/share/"
+                          , "'';"
+                          ]
diff --git a/src/Distribution/Nixpkgs/Haskell/PackageSourceSpec.hs b/src/Distribution/Nixpkgs/Haskell/PackageSourceSpec.hs
--- a/src/Distribution/Nixpkgs/Haskell/PackageSourceSpec.hs
+++ b/src/Distribution/Nixpkgs/Haskell/PackageSourceSpec.hs
@@ -216,7 +216,10 @@
   case mPackage of
     Left err -> liftIO $ hPutStrLn stderr ("*** hpack error: " ++ show err ++ ". Exiting.") >> exitFailure
     Right r -> do
-      let hpackOutput = encodeUtf8 $ Hpack.renderPackage [] (Hpack.decodeResultPackage r)
+      let hpackOutput =
+            let body = Hpack.renderPackage [] (Hpack.decodeResultPackage r)
+                cabalVersion = Hpack.decodeResultCabalVersion r
+            in encodeUtf8 $ cabalVersion ++ body
           hash = printSHA256 $ digest (digestByName "sha256") hpackOutput
       case runParseGenericPackageDescription "<hpack output>" hpackOutput of
         Left msg -> liftIO $ do
diff --git a/test/Main.hs b/test/Main.hs
--- a/test/Main.hs
+++ b/test/Main.hs
@@ -99,14 +99,6 @@
 -- * Helper functions
 -------------------------------------------------------------------------------
 
--- | Find all *files* in the given directory. This function does not recurse,
--- nor does it include the special entries @'.'@ or @'..'@ in the result.
-
-listDirectoryFiles :: FilePath -> IO [FilePath]
-listDirectoryFiles dirPath = do
-  entries <- listDirectory dirPath
-  filterM doesFileExist (map (dirPath </>) entries)
-
 -- | Find all *files* in the given directory that end with the given suffix.
 -- This function does not recurse, nor does it include the special entries
 -- @'.'@ or @'..'@ in the result.
@@ -119,9 +111,9 @@
 -- we prefer our own simpler code.
 
 listDirectoryFilesBySuffix :: String -> FilePath -> IO [FilePath]
-listDirectoryFilesBySuffix suff =
-  fmap (filter ((suff ==) . takeExtension)) . listDirectoryFiles
-
+listDirectoryFilesBySuffix suff dirPath = do
+  entries <- listDirectory dirPath
+  filterM doesFileExist [ dirPath </> e | e <- entries, takeExtension e == suff ]
 
 -- | A variant of 'writeFile' that appends a newline to the end of the buffer
 -- before writing.
