diff --git a/cabal2nix.cabal b/cabal2nix.cabal
--- a/cabal2nix.cabal
+++ b/cabal2nix.cabal
@@ -1,5 +1,5 @@
 Name:                   cabal2nix
-Version:                1.61
+Version:                1.63
 Copyright:              Peter Simons, Andres Loeh
 License:                BSD3
 License-File:           LICENSE
@@ -10,7 +10,7 @@
 Synopsis:               Convert Cabal files into Nix build instructions
 Cabal-Version:          >= 1.8
 Build-Type:             Custom
-Tested-With:            GHC >= 6.12.3 && <= 7.6.3
+Tested-With:            GHC >= 6.10.4 && <= 7.8.2
 Data-files:             README.md
 Description:
   The @cabal2nix@ utility converts Cabal files into Nix build instructions. The
@@ -34,8 +34,8 @@
   .
   The only required argument is the path to the cabal file. For example:
   .
-  > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.61/cabal2nix.cabal
-  > cabal2nix cabal://cabal2nix-1.61
+  > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.63/cabal2nix.cabal
+  > cabal2nix cabal://cabal2nix-1.63
   .
   If the @--sha256@ option has not been specified, cabal2nix calls
   @nix-prefetch-url@ to determine the hash automatically. This causes
diff --git a/src/Cabal2Nix/Flags.hs b/src/Cabal2Nix/Flags.hs
--- a/src/Cabal2Nix/Flags.hs
+++ b/src/Cabal2Nix/Flags.hs
@@ -15,7 +15,7 @@
  | name == "idris"              = [enable "llvm", enable "gmp", enable "ffi"]
  | name == "io-streams"         = [enable "NoInteractiveTests"]
  | name == "reactive-banana-wx" = [disable "buildExamples"]
- | name == "xmobar"             = [enable "with_xft", enable "with_iwlib", enable "with_alsa"]
+ | name == "xmobar"             = [enable "all_extensions"]
  | name == "xmonad-extras"      = [disable "with_hlist", enable "with_split", enable "with_parsec"]
  | name == "yi"                 = [enable "pango"]
  | otherwise                    = []
diff --git a/src/Cabal2Nix/Generate.hs b/src/Cabal2Nix/Generate.hs
--- a/src/Cabal2Nix/Generate.hs
+++ b/src/Cabal2Nix/Generate.hs
@@ -20,6 +20,7 @@
   , sha256         = "cabal2nix left the sha256 field undefined"
   , isLibrary      = isJust (Cabal.library tpkg)
   , isExecutable   = not (null (Cabal.executables tpkg))
+  , extraFunctionArgs = []
   , buildDepends   = map unDep deps
   , testDepends    = map unDep tstDeps ++ concatMap Cabal.extraLibs tests
   , buildTools     = map unDep tools
diff --git a/src/Cabal2Nix/Hackage.hs b/src/Cabal2Nix/Hackage.hs
--- a/src/Cabal2Nix/Hackage.hs
+++ b/src/Cabal2Nix/Hackage.hs
@@ -76,7 +76,7 @@
 
 fetchUrl :: String -> IO String
 fetchUrl url = do
-  (_,rsp) <- Network.Browser.browse $ do
+  (_,rsp) <- browse $ do
      setCheckForProxy True
      setDebugLog Nothing
      setOutHandler (\_ -> return ())
diff --git a/src/Cabal2Nix/Name.hs b/src/Cabal2Nix/Name.hs
--- a/src/Cabal2Nix/Name.hs
+++ b/src/Cabal2Nix/Name.hs
@@ -20,10 +20,12 @@
 libNixName "adns"                               = return "adns"
 libNixName "alsa"                               = return "alsaLib"
 libNixName "asound"                             = return "alsaLib"
+libNixName "bz2"                                = return "bzip2"
 libNixName "cairo-pdf"                          = return "cairo"
 libNixName "cairo-ps"                           = return "cairo"
 libNixName "cairo"                              = return "cairo"
 libNixName "cairo-svg"                          = return "cairo"
+libNixName "crypt"                              = []  -- provided by glibc
 libNixName "crypto"                             = return "openssl"
 libNixName "dl"                                 = []  -- provided by glibc
 libNixName "gconf-2.0"                          = return "gconf"
@@ -54,6 +56,7 @@
 libNixName "idn"                                = return "libidn"
 libNixName "IL"                                 = return "libdevil"
 libNixName "iw"                                 = return "wirelesstools"
+libNixName "jack"                               = return "jackaudio"
 libNixName "jpeg"                               = return "libjpeg"
 libNixName "libglade-2.0"                       = return "libglade"
 libNixName "libgsasl"                           = return "gsasl"
@@ -84,6 +87,7 @@
 libNixName "Xrandr"                             = return "libXrandr"
 libNixName "Xss"                                = return "libXScrnSaver"
 libNixName "Xtst"                               = return "libXtst"
+libNixName "Xxf86vm"                            = return "libXxf86vm"
 libNixName "zmq"                                = return "zeromq"
 libNixName "z"                                  = return "zlib"
 libNixName x                                    = return x
diff --git a/src/Cabal2Nix/PostProcess.hs b/src/Cabal2Nix/PostProcess.hs
--- a/src/Cabal2Nix/PostProcess.hs
+++ b/src/Cabal2Nix/PostProcess.hs
@@ -14,6 +14,7 @@
                                 = deriv { buildTools = "perl":buildTools }
   | pname == "alex" && version >= Version [3,1] []
                                 = deriv { buildTools = "perl":"happy":buildTools }
+  | pname == "bindings-GLFW"    = deriv { extraLibs = "libXext":"libXfixes":extraLibs }
   | pname == "cabal2nix"        = deriv { doCheck = True, phaseOverrides = cabal2nixDoCheckHook }
   | pname == "cabal-install" && version >= Version [0,14] []
                                 = deriv { phaseOverrides = cabalInstallPostInstall }
@@ -36,19 +37,25 @@
   | pname == "gloss-raster"     = deriv { extraLibs = "llvm":extraLibs }
   | pname == "GLUT"             = deriv { extraLibs = "glut":"libSM":"libICE":"libXmu":"libXi":"mesa":extraLibs }
   | pname == "gtk"              = deriv { extraLibs = "pkgconfig":"libc":extraLibs, buildDepends = delete "gio" buildDepends }
+  | pname == "gtk2hs-buildtools"= deriv { buildDepends = "hashtables":buildDepends }
   | pname == "gtksourceview2"   = deriv { extraLibs = "pkgconfig":"libc":extraLibs }
-  | pname == "haddock"          = deriv { buildTools = "alex":"happy":buildTools }
+  | pname == "haddock" && version < Version [2,14] []
+                                = deriv { buildTools = "alex":"happy":buildTools }
   | pname == "happy"            = deriv { buildTools = "perl":buildTools }
   | pname == "haskeline"        = deriv { buildDepends = "utf8String":buildDepends }
   | pname == "haskell-src"      = deriv { buildTools = "happy":buildTools }
   | pname == "haskell-src-meta" = deriv { buildDepends = "uniplate":buildDepends }
   | pname == "hflags"           = deriv { metaSection = metaSection { license = Unknown (Just "Apache-2.0") } }
+  | pname == "hfsevents"        = deriv { buildTools = "gccApple":buildTools, phaseOverrides = "configureFlags = \"--ghc-option=-pgmc=${gccApple}/bin/gcc\";" }
   | pname == "HFuse"            = deriv { phaseOverrides = hfusePreConfigure }
   | pname == "highlighting-kate"= highlightingKatePostProcessing deriv
   | pname == "HList"            = deriv { buildTools = "diffutils":buildTools }
   | pname == "hmatrix"          = deriv { extraLibs = "gsl":"liblapack":"blas":extraLibs }
   | pname == "hoogle"           = deriv { testTarget = "--test-option=--no-net" }
   | pname == "hspec"            = deriv { doCheck = False }
+  | pname == "HTTP" && version >= Version [4000,2,14] []
+                                = deriv { runHaddock = True, phaseOverrides = httpNoHaddock }
+  | pname == "GlomeVec"         = deriv { buildTools = "llvm":buildTools }
   | pname == "idris"            = deriv { buildTools = "happy":buildTools, extraLibs = "gmp":"boehmgc":extraLibs }
   | pname == "language-c-quote" = deriv { buildTools = "alex":"happy":buildTools }
   | pname == "language-java"    = deriv { buildDepends = "syb":buildDepends }
@@ -58,8 +65,10 @@
   | pname == "llvm-base"        = deriv { extraLibs = "llvm":extraLibs }
   | pname == "llvm-general"     = deriv { doCheck = False }
   | pname == "llvm-general-pure"= deriv { doCheck = False }
+  | pname == "MFlow"            = deriv { buildTools = "cpphs":buildTools }
   | pname == "markdown-unlit"   = deriv { runHaddock = True, phaseOverrides = markdownUnlitNoHaddock }
   | pname == "multiarg"         = deriv { buildDepends = "utf8String":buildDepends }
+  | pname == "mime-mail"        = deriv { extraFunctionArgs = ["sendmail ? \"sendmail\""], phaseOverrides = mimeMailConfigureFlags }
   | pname == "mysql"            = deriv { buildTools = "mysqlConfig":buildTools, extraLibs = "zlib":extraLibs }
   | pname == "ncurses"          = deriv { phaseOverrides = ncursesPatchPhase }
   | pname == "OpenAL"           = deriv { extraLibs = "openal":extraLibs }
@@ -69,17 +78,27 @@
   | pname == "pcap"             = deriv { extraLibs = "libpcap":extraLibs }
   | pname == "persistent"       = deriv { extraLibs = "sqlite3":extraLibs }
   | pname == "poppler"          = deriv { extraLibs = "libc":extraLibs }
+  | pname == "QuickCheck" && version >= Version [2,7,3] []
+                                = deriv { runHaddock = True, phaseOverrides = quickCheckNoHaddock }
   | pname == "repa-algorithms"  = deriv { extraLibs = "llvm":extraLibs }
   | pname == "repa-examples"    = deriv { extraLibs = "llvm":extraLibs }
   | pname == "SDL-image"        = deriv { extraLibs = "SDL_image":extraLibs }
   | pname == "SDL-mixer"        = deriv { extraLibs = "SDL_mixer":extraLibs }
   | pname == "SDL-ttf"          = deriv { extraLibs = "SDL_ttf":extraLibs }
   | pname == "sloane"           = deriv { phaseOverrides = sloanePostInstall }
+  | pname == "split" && version == Version [0,2,2] []
+                                = deriv { doCheck = True, phaseOverrides = splitDoCheck }
   | pname == "structured-haskell-mode" = deriv { buildTools = "emacs":buildTools, phaseOverrides = structuredHaskellModePostInstall }
   | pname == "svgcairo"         = deriv { extraLibs = "libc":extraLibs }
+  | pname == "syb" && version == Version [0,4,2] []
+                                = deriv { doCheck = True, phaseOverrides = sybDoCheck }
+  | pname == "tar"              = deriv { runHaddock = True, phaseOverrides = tarNoHaddock }
   | pname == "terminfo"         = deriv { extraLibs = "ncurses":extraLibs }
+  | pname == "text-icu"         = deriv { doCheck = True, phaseOverrides = textIcuDoCheckHook }
   | pname == "threadscope"      = deriv { configureFlags = "--ghc-options=-rtsopts":configureFlags }
-  | pname == "trifecta"         = deriv { phaseOverrides = trifectaPostPatch }
+  | pname == "transformers" && version >= Version [0,4,1] []
+                                = deriv { runHaddock = True, phaseOverrides = transformersNoHaddock }
+  | pname == "tz"               = deriv { extraFunctionArgs = ["pkgs_tzdata"], phaseOverrides = "preConfigure = \"export TZDIR=${pkgs_tzdata}/share/zoneinfo\";" }
   | pname == "unix-time"        = deriv { phaseOverrides = unixTimeConfigureFlags }
   | pname == "vacuum"           = deriv { extraLibs = "ghcPaths":extraLibs }
   | pname == "wxc"              = deriv { extraLibs = "wxGTK":"mesa":"libX11":extraLibs, phaseOverrides = wxcPostInstall }
@@ -122,7 +141,8 @@
 
 ghcModPostInstall :: String
 ghcModPostInstall = unlines
-  [ "postInstall = ''"
+  [ "configureFlags = \"--datasubdir=${self.pname}-${self.version}\";"
+  , "postInstall = ''"
   , "  cd $out/share/$pname-$version"
   , "  make"
   , "  rm Makefile"
@@ -165,7 +185,7 @@
 
 highlightingKatePostProcessing :: Derivation -> Derivation
 highlightingKatePostProcessing deriv@(MkDerivation {..}) = deriv
-  { phaseOverrides = "prePatch = \"sed -i -e 's|regex-pcre-builtin|regex-pcre|' highlighting-kate.cabal\";"
+  { phaseOverrides = "prePatch = \"sed -i -e 's|regex-pcre-builtin >= .*|regex-pcre|' highlighting-kate.cabal\";"
   , buildDepends = "regex-pcre" : filter (/="regex-pcre-builtin") buildDepends
   }
 
@@ -227,21 +247,6 @@
 ncursesPatchPhase :: String
 ncursesPatchPhase = "patchPhase = \"find . -type f -exec sed -i -e 's|ncursesw/||' {} \\\\;\";"
 
-trifectaPostPatch :: String
-trifectaPostPatch = unlines
-  [ "postPatch = ''"
-  , "  substituteInPlace trifecta.cabal \\"
-  , "    --replace \"blaze-html           >= 0.5     && < 0.6,\" \"blaze-html           >= 0.5     && < 0.8,\" \\"
-  , "    --replace \"blaze-html           >= 0.5     && < 0.7,\" \"blaze-html           >= 0.5     && < 0.8,\" \\"
-  , "    --replace \"blaze-markup         >= 0.5     && < 0.6,\" \"blaze-markup         >= 0.5     && < 0.7,\" \\"
-  , "    --replace \"hashable             >= 1.2.1   && < 1.3,\" \"hashable             >= 1.1     && < 1.3,\" \\"
-  , "    --replace \"hashable             >= 1.2     && < 1.3,\" \"hashable             >= 1.1     && < 1.3,\" \\"
-  , "    --replace \"fingertree           >= 0.0.1   && < 0.1,\" \"fingertree           >= 0.0.1   && < 0.2,\" \\"
-  , "    --replace \"comonad              == 3.*,\"              \"comonad              >= 3       && < 5,\" \\"
-  , "    --replace \"comonad              >= 3       && < 4,\"   \"comonad              >= 3       && < 5,\""
-  , "'';"
-  ]
-
 doctestNoHaddock, markdownUnlitNoHaddock :: String
 markdownUnlitNoHaddock = "noHaddock = self.stdenv.lib.versionOlder self.ghc.version \"7.4\";"
 doctestNoHaddock = markdownUnlitNoHaddock
@@ -249,9 +254,18 @@
 cabal2nixDoCheckHook :: String
 cabal2nixDoCheckHook = "doCheck = self.stdenv.lib.versionOlder \"7.6\" self.ghc.version;"
 
+textIcuDoCheckHook :: String
+textIcuDoCheckHook = "doCheck = !self.stdenv.isDarwin;"
+
 eitherNoHaddock :: String
 eitherNoHaddock = "noHaddock = self.stdenv.lib.versionOlder self.ghc.version \"7.6\";"
 
+httpNoHaddock, quickCheckNoHaddock, tarNoHaddock :: String
+httpNoHaddock = "noHaddock = self.stdenv.lib.versionOlder self.ghc.version \"6.11\";"
+quickCheckNoHaddock = httpNoHaddock
+tarNoHaddock = httpNoHaddock
+transformersNoHaddock = httpNoHaddock
+
 agdaPostInstall :: String
 agdaPostInstall = unlines
   [ "postInstall = ''"
@@ -279,3 +293,12 @@
   , "  cp sloane.1 $out/share/man/man1/"
   , "'';"
   ]
+
+mimeMailConfigureFlags :: String
+mimeMailConfigureFlags = unlines
+  [ "configureFlags = \"--ghc-option=-DMIME_MAIL_SENDMAIL_PATH=\\\"${sendmail}\\\"\";"
+  ]
+
+sybDoCheck, splitDoCheck :: String
+sybDoCheck = "doCheck = self.stdenv.lib.versionOlder self.ghc.version \"7.9\";"
+splitDoCheck = sybDoCheck
diff --git a/src/Distribution/NixOS/Derivation/Cabal.hs b/src/Distribution/NixOS/Derivation/Cabal.hs
--- a/src/Distribution/NixOS/Derivation/Cabal.hs
+++ b/src/Distribution/NixOS/Derivation/Cabal.hs
@@ -46,6 +46,7 @@
   , sha256              :: String
   , isLibrary           :: Bool
   , isExecutable        :: Bool
+  , extraFunctionArgs   :: [String]
   , buildDepends        :: [String]
   , testDepends         :: [String]
   , buildTools          :: [String]
@@ -97,7 +98,7 @@
   ]
   where
     inputs = nub $ sortBy (compare `on` map toLower) $ filter (/="cabal") $ filter (not . isPrefixOf "self.") $
-              buildDepends deriv ++ testDepends deriv ++ buildTools deriv ++ extraLibs deriv ++ pkgConfDeps deriv
+              buildDepends deriv ++ testDepends deriv ++ buildTools deriv ++ extraLibs deriv ++ pkgConfDeps deriv ++ extraFunctionArgs deriv
     renderedFlags =  [ text "-f" <> (if enable then empty else char '-') <> text f | (FlagName f, enable) <- cabalFlags deriv ]
                   ++ map text (configureFlags deriv)
 
@@ -124,6 +125,7 @@
                   , sha256         = sha
                   , isLibrary      = False
                   , isExecutable   = False
+                  , extraFunctionArgs = []
                   , buildDepends   = []
                   , testDepends    = []
                   , buildTools     = []
diff --git a/src/cabal2nix.hs b/src/cabal2nix.hs
--- a/src/cabal2nix.hs
+++ b/src/cabal2nix.hs
@@ -42,7 +42,7 @@
 options :: [OptDescr (Configuration -> Configuration)]
 options =
   [ Option "h" ["help"]       (NoArg (\o -> o { optPrintHelp = True }))                                  "show this help text"
-  , Option ""  ["sha256"]     (ReqArg (\x o -> o { optSha256 = Just x }) "HASH")                              "sha256 hash of source tarball"
+  , Option ""  ["sha256"]     (ReqArg (\x o -> o { optSha256 = Just x }) "HASH")                         "sha256 hash of source tarball"
   , Option "m" ["maintainer"] (ReqArg (\x o -> o { optMaintainer = x : optMaintainer o }) "MAINTAINER")  "maintainer of this package (may be specified multiple times)"
   , Option "p" ["platform"]   (ReqArg (\x o -> o { optPlatform = x : optPlatform o }) "PLATFORM")        "supported build platforms (may be specified multiple times)"
   , Option ""  ["no-haddock"] (NoArg (\o -> o { optHaddock = False }))                                   "don't run Haddock when building this package"
diff --git a/src/hackage4nix.hs b/src/hackage4nix.hs
--- a/src/hackage4nix.hs
+++ b/src/hackage4nix.hs
@@ -228,4 +228,14 @@
                   , "top-level/all-packages.nix", "top-level/haskell-packages.nix"
                     -- This build is way too complicated to maintain it automatically.
                   , "pkgs/development/compilers/pakcs/default.nix"
+                    -- Requires platform-specific magic that I don't want to add to cabal2nix.
+                  , "pkgs/development/libraries/haskell/fsnotify/default.nix"
+                    -- Not registered on Hackage.
+                  , "pkgs/development/compilers/agda/stdlib.nix"
+                  , "pkgs/development/compilers/cryptol/1.8.x.nix"
+                  , "pkgs/development/compilers/cryptol/2.0.x.nix"
+                  , "pkgs/development/compilers/jhc/default.nix"
+                  , "pkgs/development/tools/haskell/cabal-delete/default.nix"
+                  , "pkgs/tools/networking/sproxy-web/default.nix"
+                  , "pkgs/tools/networking/sproxy/default.nix"
                   ]
