@@ -13,6 +13,7 @@ import Data.Set ( Set )
1313import qualified Data.Set as Set
1414import Distribution.Nixpkgs.Haskell
1515import Distribution.Nixpkgs.Meta
16+import Distribution.Nixpkgs.License
1617import Distribution.Package
1718import Distribution.System
1819import Distribution.Text
@@ -21,7 +22,7 @@ import Language.Nix
2122
2223postProcess :: Derivation -> Derivation
2324postProcess deriv =
24− foldr (.) id [ f | (Dependency n vr, f) <- hooks, packageName deriv == n, packageVersion deriv `withinRange` vr ]
25+ foldr (.) id [ f | (Dependency n vr _, f) <- hooks, packageName deriv == n, packageVersion deriv `withinRange` vr ]
2526 . fixGtkBuilds
2627 . fixBuildDependsForTools
2728 $ deriv
@@ -55,7 +56,7 @@ fixGtkBuilds drv = drv & dependencies . pkgconfig %~ Set.filter (not . collidesW
5556-- for a while packages scraped from Hackage will continue to improperly use
5657-- `build-depends: package-for-tool` instead of `build-tool-depends` (which does
5758-- also work for Stack). Until that changes, we provide do this to work around
58−-- those package's brokeness.
59+-- those package's brokenness.
5960fixBuildDependsForTools :: Derivation -> Derivation
6061fixBuildDependsForTools = foldr (.) id
6162 [ fmap snd $ runState $ do
@@ -78,25 +79,33 @@ hooks =
7879 , ("alsa-core", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux)))
7980 , ("bindings-GLFW", over (libraryDepends . system) (Set.union (Set.fromList [bind "pkgs.xorg.libXext", bind "pkgs.xorg.libXfixes"])))
8081 , ("bindings-lxc", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux)))
81− , ("bustle", set (libraryDepends . pkgconfig . contains "system-glib = pkgs.glib") True)
82+ , ("bustle", bustleOverrides)
8283 , ("Cabal", set doCheck False) -- test suite doesn't work in Nix
8384 , ("Cabal >2.2", over (setupDepends . haskell) (Set.union (Set.fromList [self "mtl", self "parsec"]))) -- https://github.com/haskell/cabal/issues/5391
8485 , ("cabal-helper", set doCheck False) -- https://github.com/DanielG/cabal-helper/issues/17
8586 , ("cabal-install", set doCheck False . set phaseOverrides cabalInstallPostInstall)
87+ , ("cabal2nix > 2", cabal2nixOverrides)
8688 , ("darcs", set phaseOverrides darcsInstallPostInstall . set doCheck False)
8789 , ("dbus", set doCheck False) -- don't execute tests that try to access the network
8890 , ("dns", set testTarget "spec") -- don't execute tests that try to access the network
8991 , ("eventstore", over (metaSection . platforms) (Set.filter (\(Platform arch _) -> arch == X86_64)))
9092 , ("freenect < 1.2.1", over configureFlags (Set.union (Set.fromList ["--extra-include-dirs=${pkgs.freenect}/include/libfreenect", "--extra-lib-dirs=${pkgs.freenect}/lib"])))
93+ , ("fltkhs", set (libraryDepends . system . contains (pkg "fltk14")) True . over (libraryDepends . pkgconfig) (Set.union (pkgs ["libGLU", "libGL"]))) -- TODO: fltk14 belongs into the *setup* dependencies.
9194 , ("gf", set phaseOverrides gfPhaseOverrides . set doCheck False)
9295 , ("gi-cairo", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
96+ , ("gi-gdk", set runHaddock True )
97+ , ("gi-gio", set runHaddock True )
98+ , ("gi-glib", set runHaddock True )
9399 , ("gi-gst", giGstLibOverrides "gstreamer") -- https://github.com/haskell-gi/haskell-gi/issues/36
94100 , ("gi-gstaudio", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
95101 , ("gi-gstbase", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
96102 , ("gi-gstvideo", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
103+ , ("gi-gtk", set runHaddock True )
97104 , ("gi-javascriptcore < 4.0.0.0", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
98105 , ("gi-pango", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
106+ , ("gi-pango", set runHaddock True )
99107 , ("gi-pangocairo", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
108+ , ("gi-vte", set runHaddock True )
100109 , ("gi-webkit", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
101110 , ("gio", set (libraryDepends . pkgconfig . contains "system-glib = pkgs.glib") True)
102111 , ("git", set doCheck False) -- https://github.com/vincenthz/hit/issues/33
@@ -107,6 +116,7 @@ hooks =
107116 , ("GlomeVec", set (libraryDepends . pkgconfig . contains (bind "self.llvmPackages.llvm")) True)
108117 , ("graphviz", set (testDepends . system . contains (pkg "graphviz")) True)
109118 , ("gtk3", gtk3Hook)
119+ , ("gtkglext", gtkglextHook)
110120 , ("haddock", haddockHook) -- https://github.com/haskell/haddock/issues/511
111121 , ("hakyll", set (testDepends . tool . contains (pkg "utillinux")) True) -- test suite depends on "rev"
112122 , ("haskell-src-exts", set doCheck False)
@@ -138,9 +148,10 @@ hooks =
138148 , ("network-attoparsec", set doCheck False) -- test suite requires network access
139149 , ("numeric-qq", set doCheck False) -- test suite doesn't finish even after 1+ days
140150 , ("opencv", opencvOverrides)
141− , ("pandoc >= 1.16.0.2", set doCheck False) -- https://github.com/jgm/pandoc/issues/2709 and https://github.com/fpco/stackage/issues/1332
142− , ("pandoc", set jailbreak False) -- jailbreak-cabal break the build
143− , ("pandoc-citeproc", set doCheck False) -- https://github.com/jgm/pandoc-citeproc/issues/172
151+ , ("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
152+ , ("pandoc < 2.6", pandocPre26Overrides)
153+ , ("pandoc >= 2.6", pandocOverrides)
154+ , ("pandoc-citeproc", set doCheck False) -- https://github.com/jgm/pandoc-citeproc/issues/369
144155 , ("purescript", set doCheck False) -- test suite doesn't cope with Nix build env
145156 , ("proto-lens-protobuf-types", set (libraryDepends . tool . contains (pkg "protobuf")) True)
146157 , ("proto-lens-protoc", set (libraryDepends . tool . contains (pkg "protobuf")) True)
@@ -170,9 +181,10 @@ hooks =
170181 , ("wxc", wxcHook)
171182 , ("wxcore", set (libraryDepends . pkgconfig . contains (pkg "wxGTK")) True)
172183 , ("X11", over (libraryDepends . system) (Set.union (Set.fromList $ map bind ["pkgs.xorg.libXinerama","pkgs.xorg.libXext","pkgs.xorg.libXrender","pkgs.xorg.libXScrnSaver"])))
173− , ("xmonad", set phaseOverrides xmonadPostInstall)
184+ , ("xmonad >= 0.14.2", set phaseOverrides xmonadPostInstall)
174185 , ("zip-archive < 0.3.1", over (testDepends . tool) (replace (self "zip") (pkg "zip")))
175186 , ("zip-archive >= 0.3.1 && < 0.3.2.3", over (testDepends . tool) (Set.union (Set.fromList [pkg "zip", pkg "unzip"]))) -- https://github.com/jgm/zip-archive/issues/35
187+ , ("zip-archive >= 0.4", set (testDepends . tool . contains (pkg "which")) True)
176188 ]
177189
178190pkg :: Identifier -> Binding
@@ -218,13 +230,12 @@ gitAnnexHook = set phaseOverrides gitAnnexOverrides
218230 where
219231 gitAnnexOverrides = unlines
220232 [ "preConfigure = \"export HOME=$TEMPDIR; patchShebangs .\";"
221− , "installPhase = \"make PREFIX=$out BUILDER=: install\";"
222− , "checkPhase = ''"
233+ , "postBuild = ''"
223234 , " ln -sf dist/build/git-annex/git-annex git-annex"
224235 , " ln -sf git-annex git-annex-shell"
225− , " export PATH+=\":$PWD\""
226− , " git-annex test"
227236 , "'';"
237+ , "installPhase = \"make PREFIX=$out BUILDER=: install install-completions\";"
238+ , "checkPhase = ''PATH+=\":$PWD\" git-annex test'';"
228239 , "enableSharedExecutables = false;"
229240 ]
230241 buildInputs = pkgs ["git","rsync","gnupg","curl","wget","lsof","openssh","which","bup","perl"]
@@ -245,7 +256,7 @@ gfPhaseOverrides = unlines
245256 , " sed -i \"s|numJobs (bf bi)++||\" ./Setup.hs"
246257 -- Parallel compilation fails. Disable it.
247258 , "'';"
248− , "preBuild = ''export LD_LIBRARY_PATH=`pwd`/dist/build:$LD_LIBRARY_PATH'';"
259+ , "preBuild = ''export LD_LIBRARY_PATH=`pwd`/dist/build''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH'';"
249260 -- The build step itself, after having built the library, needs to be able
250261 -- to find the library it just built in order to compile grammar files.
251262 ]
@@ -281,10 +292,8 @@ darcsInstallPostInstall = unlines
281292xmonadPostInstall :: String
282293xmonadPostInstall = unlines
283294 [ "postInstall = ''"
284− , " shopt -s globstar"
285− , " mkdir -p $doc/share/man/man1"
286− , " mv \"$data/\"**\"/man/\"*[0-9] $doc/share/man/man1/"
287− , " rm \"$data/\"**\"/man/\"*"
295+ , " install -D man/xmonad.1 ''${!outputDoc}/share/man/man1/xmonad.1"
296+ , " install -D man/xmonad.hs ''${!outputDoc}/share/doc/$name/sample-xmonad.hs"
288297 , "'';"
289298 ]
290299
@@ -351,8 +360,50 @@ webkitgtk24xHook = set (libraryDepends . pkgconfig . contains (pkg "webkitgtk24x
351360opencvOverrides :: Derivation -> Derivation
352361opencvOverrides = set phaseOverrides "hardeningDisable = [ \"bindnow\" ];"
353362 . over (libraryDepends . pkgconfig) (replace (pkg "opencv") (pkg "opencv3"))
354− . set (configureFlags . contains "--with-gcc=${stdenv.cc}/bin/c++") True
355− . set (configureFlags . contains "--with-ld=${stdenv.cc}/bin/c++") True
356363
357364hspecCoreOverrides :: Derivation -> Derivation -- https://github.com/hspec/hspec/issues/330
358365hspecCoreOverrides = set phaseOverrides "testTarget = \"--test-option=--skip --test-option='Test.Hspec.Core.Runner.hspecResult runs specs in parallel'\";"
366+
367+cabal2nixOverrides :: Derivation -> Derivation
368+cabal2nixOverrides = set phaseOverrides $ unlines
369+ [ "preCheck = ''"
370+ , " export PATH=\"$PWD/dist/build/cabal2nix:$PATH\""
371+ , " export HOME=\"$TMPDIR/home\""
372+ , "'';"
373+ ]
374+
375+gtkglextHook :: Derivation -> Derivation
376+gtkglextHook = over (libraryDepends . system) (Set.union (Set.fromList deps))
377+ where
378+ deps :: [Binding]
379+ deps = bind <$> [ "pkgs.gtk2"
380+ , "pkgs.libGLU"
381+ , "pkgs.xorg.libSM"
382+ , "pkgs.xorg.libICE"
383+ , "pkgs.xorg.libXt"
384+ , "pkgs.xorg.libXmu"
385+ ]
386+
387+pandocPre26Overrides :: Derivation -> Derivation
388+pandocPre26Overrides = set phaseOverrides postInstall
389+ where
390+ postInstall = unlines [ "postInstall = ''"
391+ , " mkdir -p $out/share"
392+ , " mv $data/*/*/man $out/share/"
393+ , "'';"
394+ ]
395+
396+pandocOverrides :: Derivation -> Derivation
397+pandocOverrides = set phaseOverrides postInstall
398+ where
399+ postInstall = unlines [ "postInstall = ''"
400+ , " mkdir -p $out/share/man/man1"
401+ , " mv \"man/\"*.1 $out/share/man/man1/"
402+ , "'';"
403+ ]
404+
405+bustleOverrides :: Derivation -> Derivation
406+bustleOverrides = set (libraryDepends . pkgconfig . contains "system-glib = pkgs.glib") True
407+ . set (executableDepends . pkgconfig . contains "gio-unix = null") False
408+ . set (metaSection . license) (Known "stdenv.lib.licenses.lgpl21Plus")
409+ . set (metaSection . hydraPlatforms) allKnownPlatforms