@@ -13,6 +13,7 @@ import Data.Set ( Set )
13import qualified Data.Set as Set
13import qualified Data.Set as Set
14import Distribution.Nixpkgs.Haskell
14import Distribution.Nixpkgs.Haskell
15import Distribution.Nixpkgs.Meta
15import Distribution.Nixpkgs.Meta
16+import Distribution.Nixpkgs.License
16import Distribution.Package
17import Distribution.Package
17import Distribution.System
18import Distribution.System
18import Distribution.Text
19import Distribution.Text
@@ -21,7 +22,7 @@ import Language.Nix
22postProcess :: Derivation -> Derivation
23postProcess :: Derivation -> Derivation
23postProcess deriv =
24postProcess 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 ]
25 . fixGtkBuilds
26 . fixGtkBuilds
26 . fixBuildDependsForTools
27 . fixBuildDependsForTools
@@ -55,7 +56,7 @@ fixGtkBuilds drv = drv & dependencies . pkgconfig %~ Set.filter (not . collidesW
55-- for a while packages scraped from Hackage will continue to improperly use
56-- for a while packages scraped from Hackage will continue to improperly use
56-- `build-depends: package-for-tool` instead of `build-tool-depends` (which does
57-- `build-depends: package-for-tool` instead of `build-tool-depends` (which does
57-- also work for Stack). Until that changes, we provide do this to work around
58-- also work for Stack). Until that changes, we provide do this to work around
58−-- those package's brokeness.
59+-- those package's brokenness.
59fixBuildDependsForTools :: Derivation -> Derivation
60fixBuildDependsForTools :: Derivation -> Derivation
60fixBuildDependsForTools = foldr (.) id
61fixBuildDependsForTools = foldr (.) id
61 [ fmap snd $ runState $ do
62 [ fmap snd $ runState $ do
@@ -78,25 +79,33 @@ hooks =
78 , ("alsa-core", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux)))
79 , ("alsa-core", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux)))
79 , ("bindings-GLFW", over (libraryDepends . system) (Set.union (Set.fromList [bind "pkgs.xorg.libXext", bind "pkgs.xorg.libXfixes"])))
80 , ("bindings-GLFW", over (libraryDepends . system) (Set.union (Set.fromList [bind "pkgs.xorg.libXext", bind "pkgs.xorg.libXfixes"])))
80 , ("bindings-lxc", over (metaSection . platforms) (Set.filter (\(Platform _ os) -> os == Linux)))
81 , ("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)
82 , ("Cabal", set doCheck False) -- test suite doesn't work in Nix
83 , ("Cabal", set doCheck False) -- test suite doesn't work in Nix
83 , ("Cabal >2.2", over (setupDepends . haskell) (Set.union (Set.fromList [self "mtl", self "parsec"]))) -- https://github.com/haskell/cabal/issues/5391
84 , ("Cabal >2.2", over (setupDepends . haskell) (Set.union (Set.fromList [self "mtl", self "parsec"]))) -- https://github.com/haskell/cabal/issues/5391
84 , ("cabal-helper", set doCheck False) -- https://github.com/DanielG/cabal-helper/issues/17
85 , ("cabal-helper", set doCheck False) -- https://github.com/DanielG/cabal-helper/issues/17
85 , ("cabal-install", set doCheck False . set phaseOverrides cabalInstallPostInstall)
86 , ("cabal-install", set doCheck False . set phaseOverrides cabalInstallPostInstall)
87+ , ("cabal2nix > 2", cabal2nixOverrides)
86 , ("darcs", set phaseOverrides darcsInstallPostInstall . set doCheck False)
88 , ("darcs", set phaseOverrides darcsInstallPostInstall . set doCheck False)
87 , ("dbus", set doCheck False) -- don't execute tests that try to access the network
89 , ("dbus", set doCheck False) -- don't execute tests that try to access the network
88 , ("dns", set testTarget "spec") -- don't execute tests that try to access the network
90 , ("dns", set testTarget "spec") -- don't execute tests that try to access the network
89 , ("eventstore", over (metaSection . platforms) (Set.filter (\(Platform arch _) -> arch == X86_64)))
91 , ("eventstore", over (metaSection . platforms) (Set.filter (\(Platform arch _) -> arch == X86_64)))
90 , ("freenect < 1.2.1", over configureFlags (Set.union (Set.fromList ["--extra-include-dirs=${pkgs.freenect}/include/libfreenect", "--extra-lib-dirs=${pkgs.freenect}/lib"])))
92 , ("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.
91 , ("gf", set phaseOverrides gfPhaseOverrides . set doCheck False)
94 , ("gf", set phaseOverrides gfPhaseOverrides . set doCheck False)
92 , ("gi-cairo", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
95 , ("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 )
93 , ("gi-gst", giGstLibOverrides "gstreamer") -- https://github.com/haskell-gi/haskell-gi/issues/36
99 , ("gi-gst", giGstLibOverrides "gstreamer") -- https://github.com/haskell-gi/haskell-gi/issues/36
94 , ("gi-gstaudio", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
100 , ("gi-gstaudio", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
95 , ("gi-gstbase", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
101 , ("gi-gstbase", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
96 , ("gi-gstvideo", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
102 , ("gi-gstvideo", giGstLibOverrides "gst-plugins-base") -- https://github.com/haskell-gi/haskell-gi/issues/36
103+ , ("gi-gtk", set runHaddock True )
97 , ("gi-javascriptcore < 4.0.0.0", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
104 , ("gi-javascriptcore < 4.0.0.0", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
98 , ("gi-pango", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
105 , ("gi-pango", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
106+ , ("gi-pango", set runHaddock True )
99 , ("gi-pangocairo", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
107 , ("gi-pangocairo", giCairoPhaseOverrides) -- https://github.com/haskell-gi/haskell-gi/issues/36
108+ , ("gi-vte", set runHaddock True )
100 , ("gi-webkit", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
109 , ("gi-webkit", webkitgtk24xHook) -- https://github.com/haskell-gi/haskell-gi/issues/36
101 , ("gio", set (libraryDepends . pkgconfig . contains "system-glib = pkgs.glib") True)
110 , ("gio", set (libraryDepends . pkgconfig . contains "system-glib = pkgs.glib") True)
102 , ("git", set doCheck False) -- https://github.com/vincenthz/hit/issues/33
111 , ("git", set doCheck False) -- https://github.com/vincenthz/hit/issues/33
@@ -107,6 +116,7 @@ hooks =
107 , ("GlomeVec", set (libraryDepends . pkgconfig . contains (bind "self.llvmPackages.llvm")) True)
116 , ("GlomeVec", set (libraryDepends . pkgconfig . contains (bind "self.llvmPackages.llvm")) True)
108 , ("graphviz", set (testDepends . system . contains (pkg "graphviz")) True)
117 , ("graphviz", set (testDepends . system . contains (pkg "graphviz")) True)
109 , ("gtk3", gtk3Hook)
118 , ("gtk3", gtk3Hook)
119+ , ("gtkglext", gtkglextHook)
110 , ("haddock", haddockHook) -- https://github.com/haskell/haddock/issues/511
120 , ("haddock", haddockHook) -- https://github.com/haskell/haddock/issues/511
111 , ("hakyll", set (testDepends . tool . contains (pkg "utillinux")) True) -- test suite depends on "rev"
121 , ("hakyll", set (testDepends . tool . contains (pkg "utillinux")) True) -- test suite depends on "rev"
112 , ("haskell-src-exts", set doCheck False)
122 , ("haskell-src-exts", set doCheck False)
@@ -138,9 +148,10 @@ hooks =
138 , ("network-attoparsec", set doCheck False) -- test suite requires network access
148 , ("network-attoparsec", set doCheck False) -- test suite requires network access
139 , ("numeric-qq", set doCheck False) -- test suite doesn't finish even after 1+ days
149 , ("numeric-qq", set doCheck False) -- test suite doesn't finish even after 1+ days
140 , ("opencv", opencvOverrides)
150 , ("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
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
142− , ("pandoc", set jailbreak False) -- jailbreak-cabal break the build
152+ , ("pandoc < 2.6", pandocPre26Overrides)
153+ , ("pandoc >= 2.6", pandocOverrides)
143− , ("pandoc-citeproc", set doCheck False) -- https://github.com/jgm/pandoc-citeproc/issues/172
154+ , ("pandoc-citeproc", set doCheck False) -- https://github.com/jgm/pandoc-citeproc/issues/369
144 , ("purescript", set doCheck False) -- test suite doesn't cope with Nix build env
155 , ("purescript", set doCheck False) -- test suite doesn't cope with Nix build env
145 , ("proto-lens-protobuf-types", set (libraryDepends . tool . contains (pkg "protobuf")) True)
156 , ("proto-lens-protobuf-types", set (libraryDepends . tool . contains (pkg "protobuf")) True)
146 , ("proto-lens-protoc", set (libraryDepends . tool . contains (pkg "protobuf")) True)
157 , ("proto-lens-protoc", set (libraryDepends . tool . contains (pkg "protobuf")) True)
@@ -173,6 +184,7 @@ hooks =
173 , ("xmonad >= 0.14.2", set phaseOverrides xmonadPostInstall)
184 , ("xmonad >= 0.14.2", set phaseOverrides xmonadPostInstall)
174 , ("zip-archive < 0.3.1", over (testDepends . tool) (replace (self "zip") (pkg "zip")))
185 , ("zip-archive < 0.3.1", over (testDepends . tool) (replace (self "zip") (pkg "zip")))
175 , ("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
186 , ("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)
178pkg :: Identifier -> Binding
190pkg :: Identifier -> Binding
@@ -218,13 +230,12 @@ gitAnnexHook = set phaseOverrides gitAnnexOverrides
219 gitAnnexOverrides = unlines
231 gitAnnexOverrides = unlines
220 [ "preConfigure = \"export HOME=$TEMPDIR; patchShebangs .\";"
232 [ "preConfigure = \"export HOME=$TEMPDIR; patchShebangs .\";"
221− , "installPhase = \"make PREFIX=$out BUILDER=: install\";"
233+ , "postBuild = ''"
223 , " ln -sf dist/build/git-annex/git-annex git-annex"
234 , " ln -sf dist/build/git-annex/git-annex git-annex"
224 , " ln -sf git-annex git-annex-shell"
235 , " ln -sf git-annex git-annex-shell"
225− , " export PATH+=\":$PWD\""
237+ , "installPhase = \"make PREFIX=$out BUILDER=: install install-completions\";"
238+ , "checkPhase = ''PATH+=\":$PWD\" git-annex test'';"
228 , "enableSharedExecutables = false;"
239 , "enableSharedExecutables = false;"
230 buildInputs = pkgs ["git","rsync","gnupg","curl","wget","lsof","openssh","which","bup","perl"]
241 buildInputs = pkgs ["git","rsync","gnupg","curl","wget","lsof","openssh","which","bup","perl"]
@@ -245,7 +256,7 @@ gfPhaseOverrides = unlines
245 , " sed -i \"s|numJobs (bf bi)++||\" ./Setup.hs"
256 , " sed -i \"s|numJobs (bf bi)++||\" ./Setup.hs"
246 -- Parallel compilation fails. Disable it.
257 -- Parallel compilation fails. Disable it.
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'';"
249 -- The build step itself, after having built the library, needs to be able
260 -- The build step itself, after having built the library, needs to be able
250 -- to find the library it just built in order to compile grammar files.
261 -- to find the library it just built in order to compile grammar files.
@@ -281,8 +292,8 @@ darcsInstallPostInstall = unlines
281xmonadPostInstall :: String
292xmonadPostInstall :: String
282xmonadPostInstall = unlines
293xmonadPostInstall = unlines
283 [ "postInstall = ''"
294 [ "postInstall = ''"
284− , " install -D man/xmonad.1 $doc/share/man/man1/xmonad.1"
295+ , " install -D man/xmonad.1 ''${!outputDoc}/share/man/man1/xmonad.1"
285− , " install -D man/xmonad.hs $doc/share/doc/$name/sample-xmonad.hs"
296+ , " install -D man/xmonad.hs ''${!outputDoc}/share/doc/$name/sample-xmonad.hs"
@@ -349,8 +360,50 @@ webkitgtk24xHook = set (libraryDepends . pkgconfig . contains (pkg "webkitgtk24x
349opencvOverrides :: Derivation -> Derivation
360opencvOverrides :: Derivation -> Derivation
350opencvOverrides = set phaseOverrides "hardeningDisable = [ \"bindnow\" ];"
361opencvOverrides = set phaseOverrides "hardeningDisable = [ \"bindnow\" ];"
351 . over (libraryDepends . pkgconfig) (replace (pkg "opencv") (pkg "opencv3"))
362 . over (libraryDepends . pkgconfig) (replace (pkg "opencv") (pkg "opencv3"))
352− . set (configureFlags . contains "--with-gcc=${stdenv.cc}/bin/c++") True
353− . set (configureFlags . contains "--with-ld=${stdenv.cc}/bin/c++") True
355hspecCoreOverrides :: Derivation -> Derivation -- https://github.com/hspec/hspec/issues/330
364hspecCoreOverrides :: Derivation -> Derivation -- https://github.com/hspec/hspec/issues/330
356hspecCoreOverrides = set phaseOverrides "testTarget = \"--test-option=--skip --test-option='Test.Hspec.Core.Runner.hspecResult runs specs in parallel'\";"
365hspecCoreOverrides = set phaseOverrides "testTarget = \"--test-option=--skip --test-option='Test.Hspec.Core.Runner.hspecResult runs specs in parallel'\";"
367+cabal2nixOverrides :: Derivation -> Derivation
368+cabal2nixOverrides = set phaseOverrides $ unlines
370+ , " export PATH=\"$PWD/dist/build/cabal2nix:$PATH\""
371+ , " export HOME=\"$TMPDIR/home\""
375+gtkglextHook :: Derivation -> Derivation
376+gtkglextHook = over (libraryDepends . system) (Set.union (Set.fromList deps))
379+ deps = bind <$> [ "pkgs.gtk2"
382+ , "pkgs.xorg.libICE"
384+ , "pkgs.xorg.libXmu"
387+pandocPre26Overrides :: Derivation -> Derivation
388+pandocPre26Overrides = set phaseOverrides postInstall
390+ postInstall = unlines [ "postInstall = ''"
391+ , " mkdir -p $out/share"
392+ , " mv $data/*/*/man $out/share/"
396+pandocOverrides :: Derivation -> Derivation
397+pandocOverrides = set phaseOverrides postInstall
399+ postInstall = unlines [ "postInstall = ''"
400+ , " mkdir -p $out/share/man/man1"
401+ , " mv \"man/\"*.1 $out/share/man/man1/"
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