1{-# LANGUAGE RecordWildCards #-}
3module Cabal2Nix.PostProcess ( postProcess ) where
5import Distribution.NixOS.Derivation.Cabal
8postProcess :: Derivation -> Derivation
9postProcess deriv@(MkDerivation {..})
10 | pname == "aeson" && version > Version [0,7] []
11 = deriv { buildDepends = "blazeBuilder":buildDepends }
12 | pname == "Agda" = deriv { buildTools = "emacs":buildTools, phaseOverrides = agdaPostInstall }
13 | pname == "alex" && version < Version [3,1] []
14 = deriv { buildTools = "perl":buildTools }
15 | pname == "alex" && version >= Version [3,1] []
16 = deriv { buildTools = "perl":"happy":buildTools }
17 | pname == "bindings-GLFW" = deriv { extraLibs = "libXext":"libXfixes":extraLibs }
18 | pname == "cabal2nix" = deriv { doCheck = True, phaseOverrides = cabal2nixDoCheckHook }
19 | pname == "cabal-install" && version >= Version [0,14] []
20 = deriv { phaseOverrides = cabalInstallPostInstall }
21 | pname == "cairo" = deriv { extraLibs = "pkgconfig":"libc":"cairo":"zlib":extraLibs }
22 | pname == "cuda" = deriv { phaseOverrides = cudaConfigurePhase, extraLibs = "cudatoolkit":"nvidia_x11":"self.stdenv.gcc":extraLibs }
23 | pname == "darcs" = deriv { phaseOverrides = darcsInstallPostInstall }
24 | pname == "dns" = deriv { testTarget = "spec" }
25 | pname == "doctest" = deriv { runHaddock = True, phaseOverrides = doctestNoHaddock }
26 | pname == "editline" = deriv { extraLibs = "libedit":extraLibs }
27 | pname == "epic" = deriv { extraLibs = "gmp":"boehmgc":extraLibs, buildTools = "happy":buildTools }
28 | pname == "either" = deriv { runHaddock = True, phaseOverrides = eitherNoHaddock }
29 | pname == "ghc-heap-view" = deriv { phaseOverrides = ghciPostInstall }
30 | pname == "ghc-mod" = deriv { phaseOverrides = ghcModPostInstall, buildTools = "emacs":buildTools }
31 | pname == "ghc-paths" = deriv { phaseOverrides = ghcPathsPatches }
32 | pname == "ghc-vis" = deriv { phaseOverrides = ghciPostInstall }
33 | pname == "git-annex" = deriv { phaseOverrides = gitAnnexOverrides, buildTools = "git":"rsync":"gnupg1":"curl":"lsof":"openssh":"which":"bup":"perl":buildTools }
34 | pname == "github-backup" = deriv { buildTools = "git":buildTools }
35 | pname == "glade" = deriv { extraLibs = "pkgconfig":"libc":extraLibs, pkgConfDeps = "gtkC":delete "gtk" pkgConfDeps }
36 | pname == "glib" = deriv { extraLibs = "pkgconfig":"libc":extraLibs }
37 | pname == "gloss-raster" = deriv { extraLibs = "llvm":extraLibs }
38 | pname == "GLUT" = deriv { extraLibs = "glut":"libSM":"libICE":"libXmu":"libXi":"mesa":extraLibs }
39 | pname == "gtk" = deriv { extraLibs = "pkgconfig":"libc":extraLibs, buildDepends = delete "gio" buildDepends }
40 | pname == "gtkglext" = deriv { pkgConfDeps = "pangox_compat":pkgConfDeps }
41 | pname == "gtk2hs-buildtools"= deriv { buildDepends = "hashtables":buildDepends }
42 | pname == "gtksourceview2" = deriv { extraLibs = "pkgconfig":"libc":extraLibs }
43 | pname == "haddock" && version < Version [2,14] []
44 = deriv { buildTools = "alex":"happy":buildTools }
45 | pname == "happy" = deriv { buildTools = "perl":buildTools }
46 | pname == "haskeline" = deriv { buildDepends = "utf8String":buildDepends }
47 | pname == "haskell-src" = deriv { buildTools = "happy":buildTools }
48 | pname == "haskell-src-meta" = deriv { buildDepends = "uniplate":buildDepends }
49 | pname == "hflags" = deriv { metaSection = metaSection { license = Unknown (Just "Apache-2.0") } }
50 | pname == "hfsevents" = deriv { buildTools = "gccApple":buildTools, phaseOverrides = "configureFlags = \"--ghc-option=-pgmc=${gccApple}/bin/gcc\";" }
51 | pname == "HFuse" = deriv { phaseOverrides = hfusePreConfigure }
52 | pname == "highlighting-kate"= highlightingKatePostProcessing deriv
53 | pname == "hlibgit2" = deriv { testDepends = "git":testDepends }
54 | pname == "HList" = deriv { buildTools = "diffutils":buildTools }
55 | pname == "hmatrix" = deriv { extraLibs = "gsl":"liblapack":"blas":extraLibs }
56 | pname == "hoogle" = deriv { testTarget = "--test-option=--no-net" }
57 | pname == "hspec" = deriv { doCheck = False }
58 | pname == "HTTP" && version >= Version [4000,2,14] []
59 = deriv { runHaddock = True, phaseOverrides = httpNoHaddock }
60 | pname == "GlomeVec" = deriv { buildTools = "llvm":buildTools }
61 | pname == "idris" = deriv { buildTools = "happy":buildTools, extraLibs = "gmp":"boehmgc":extraLibs }
62 | pname == "language-c-quote" = deriv { buildTools = "alex":"happy":buildTools }
63 | pname == "language-java" = deriv { buildDepends = "syb":buildDepends }
64 | pname == "leksah-server" = deriv { buildDepends = "process-leksah":buildDepends }
65 | pname == "lhs2tex" = deriv { extraLibs = "texLive":extraLibs, phaseOverrides = lhs2texPostInstall }
66 | pname == "libffi" = deriv { extraLibs = delete "ffi" extraLibs }
67 | pname == "llvm-base" = deriv { extraLibs = "llvm":extraLibs }
68 | pname == "llvm-general" = deriv { doCheck = False }
69 | pname == "llvm-general-pure"= deriv { doCheck = False }
70 | pname == "MFlow" = deriv { buildTools = "cpphs":buildTools }
71 | pname == "markdown-unlit" = deriv { runHaddock = True, phaseOverrides = markdownUnlitNoHaddock }
72 | pname == "multiarg" = deriv { buildDepends = "utf8String":buildDepends }
73 | pname == "mime-mail" = deriv { extraFunctionArgs = ["sendmail ? \"sendmail\""], phaseOverrides = mimeMailConfigureFlags }
74 | pname == "mysql" = deriv { buildTools = "mysqlConfig":buildTools, extraLibs = "zlib":extraLibs }
75 | pname == "ncurses" = deriv { phaseOverrides = ncursesPatchPhase }
76 | pname == "OpenAL" = deriv { extraLibs = "openal":extraLibs }
77 | pname == "OpenGL" = deriv { extraLibs = "mesa":"libX11":extraLibs }
78 | pname == "pandoc" = deriv { buildDepends = "alex":"happy":buildDepends }
79 | pname == "pango" = deriv { extraLibs = "pkgconfig":"libc":extraLibs }
80 | pname == "pcap" = deriv { extraLibs = "libpcap":extraLibs }
81 | pname == "persistent" = deriv { extraLibs = "sqlite3":extraLibs }
82 | pname == "poppler" = deriv { extraLibs = "libc":extraLibs }
83 | pname == "QuickCheck" && version >= Version [2,7,3] []
84 = deriv { runHaddock = True, phaseOverrides = quickCheckNoHaddock }
85 | pname == "repa-algorithms" = deriv { extraLibs = "llvm":extraLibs }
86 | pname == "repa-examples" = deriv { extraLibs = "llvm":extraLibs }
87 | pname == "SDL-image" = deriv { extraLibs = "SDL_image":extraLibs }
88 | pname == "SDL-mixer" = deriv { extraLibs = "SDL_mixer":extraLibs }
89 | pname == "SDL-ttf" = deriv { extraLibs = "SDL_ttf":extraLibs }
90 | pname == "sloane" = deriv { phaseOverrides = sloanePostInstall }
91 | pname == "split" && version == Version [0,2,2] []
92 = deriv { doCheck = True, phaseOverrides = splitDoCheck }
93 | pname == "structured-haskell-mode" = deriv { buildTools = "emacs":buildTools, phaseOverrides = structuredHaskellModePostInstall }
94 | pname == "svgcairo" = deriv { extraLibs = "libc":extraLibs }
95 | pname == "syb" && version == Version [0,4,2] []
96 = deriv { doCheck = True, phaseOverrides = sybDoCheck }
97 | pname == "tar" = deriv { runHaddock = True, phaseOverrides = tarNoHaddock }
98 | pname == "terminfo" = deriv { extraLibs = "ncurses":extraLibs }
99 | pname == "text-icu" = deriv { doCheck = True, phaseOverrides = textIcuDoCheckHook }
100 | pname == "threadscope" = deriv { configureFlags = "--ghc-options=-rtsopts":configureFlags }
101 | pname == "transformers" && version >= Version [0,4,1] []
102 = deriv { runHaddock = True, phaseOverrides = transformersNoHaddock }
103 | pname == "tz" = deriv { extraFunctionArgs = ["pkgs_tzdata"], phaseOverrides = "preConfigure = \"export TZDIR=${pkgs_tzdata}/share/zoneinfo\";" }
104 | pname == "vacuum" = deriv { extraLibs = "ghcPaths":extraLibs }
105 | pname == "wxc" = deriv { extraLibs = "wxGTK":"mesa":"libX11":extraLibs, phaseOverrides = wxcPostInstall }
106 | pname == "wxcore" = deriv { extraLibs = "wxGTK":"mesa":"libX11":extraLibs }
107 | pname == "X11" && version >= Version [1,6] []
108 = deriv { extraLibs = "libXinerama":"libXext":"libXrender":extraLibs }
109 | pname == "X11" = deriv { extraLibs = "libXinerama":"libXext":extraLibs }
110 | pname == "X11-xft" = deriv { extraLibs = "pkgconfig":"freetype":"fontconfig":extraLibs
111 , configureFlags = "--extra-include-dirs=${freetype}/include/freetype2":configureFlags
113 | pname == "xmonad" = deriv { phaseOverrides = xmonadPostInstall }
116cudaConfigurePhase :: String
117cudaConfigurePhase = unlines
118 [ "# Perhaps this should be the default in cabal.nix ..."
120 , "# The cudatoolkit provides both 64 and 32-bit versions of the"
121 , "# library. GHC's linker fails if the wrong version is found first."
122 , "# We solve this by eliminating lib64 from the path on 32-bit"
123 , "# platforms and putting lib64 first on 64-bit platforms."
124 , "libPaths = if self.stdenv.is64bit then \"lib64 lib\" else \"lib\";"
125 , "configurePhase = ''"
126 , " for i in Setup.hs Setup.lhs; do"
127 , " test -f $i && ghc --make $i"
129 , " for p in $extraBuildInputs $propagatedNativeBuildInputs; do"
130 , " if [ -d \"$p/include\" ]; then"
131 , " extraLibDirs=\"$extraLibDirs --extra-include-dir=$p/include\""
133 , " for d in $libPaths; do"
134 , " if [ -d \"$p/$d\" ]; then"
135 , " extraLibDirs=\"$extraLibDirs --extra-lib-dir=$p/$d\""
139 , " ./Setup configure --verbose --prefix=\"$out\" $libraryProfiling $extraLibDirs $configureFlags"
143ghcModPostInstall :: String
144ghcModPostInstall = unlines
145 [ "configureFlags = \"--datasubdir=${self.pname}-${self.version}\";"
147 , " cd $out/share/$pname-$version"
151 , " ensureDir \"$out/share/emacs\""
152 , " mv $pname-$version emacs/site-lisp"
153 , " mv $out/bin/ghc-mod $out/bin/.ghc-mod-wrapped"
154 , " cat - > $out/bin/ghc-mod <<EOF"
155 , " #! ${self.stdenv.shell}"
158 , " eval exec $out/bin/.ghc-mod-wrapped \\$COMMAND \\$( ${self.ghc.GHCGetPackages} ${self.ghc.version} | tr \" \" \"\\n\" | tail -n +2 | paste -d \" \" - - | sed 's/.*/-g \"&\"/' | tr \"\\n\" \" \") \"\\$@\""
160 , " chmod +x $out/bin/ghc-mod"
164wxcPostInstall :: String
165wxcPostInstall = unlines
167 , " cp -v dist/build/libwxc.so.${self.version} $out/lib/libwxc.so"
171cabalInstallPostInstall :: String
172cabalInstallPostInstall = unlines
175 , " mv bash-completion $out/etc/bash_completion.d"
179darcsInstallPostInstall :: String
180darcsInstallPostInstall = unlines
182 , " mkdir -p $out/etc/bash_completion.d"
183 , " mv contrib/darcs_completion $out/etc/bash_completion.d/darcs"
187highlightingKatePostProcessing :: Derivation -> Derivation
188highlightingKatePostProcessing deriv@(MkDerivation {..}) = deriv
189 { phaseOverrides = "prePatch = \"sed -i -e 's|regex-pcre-builtin >= .*|regex-pcre|' highlighting-kate.cabal\";"
190 , buildDepends = "regex-pcre" : filter (/="regex-pcre-builtin") buildDepends
193xmonadPostInstall :: String
194xmonadPostInstall = unlines
196 , " shopt -s globstar"
197 , " mkdir -p $out/share/man/man1"
198 , " mv \"$out/\"**\"/man/\"*.1 $out/share/man/man1/"
201 , " # Patch to make xmonad use XMONAD_{GHC,XMESSAGE} (if available)."
202 , " ./xmonad_ghc_var_0.11.patch"
206gitAnnexOverrides :: String
207gitAnnexOverrides = unlines
208 [ "preConfigure = ''"
209 , " export HOME=\"$NIX_BUILD_TOP/tmp\""
212 , "installPhase = \"./Setup install\";"
214 , " cp dist/build/git-annex/git-annex git-annex"
215 , " ./git-annex test"
217 , "propagatedUserEnvPkgs = [git lsof];"
220ghciPostInstall :: String
221ghciPostInstall = unlines
223 , " ensureDir \"$out/share/ghci\""
224 , " ln -s \"$out/share/$pname-$version/ghci\" \"$out/share/ghci/$pname\""
228hfusePreConfigure :: String
229hfusePreConfigure = unlines
230 [ "preConfigure = ''"
231 , " sed -i -e \"s@ Extra-Lib-Dirs: /usr/local/lib@ Extra-Lib-Dirs: ${fuse}/lib@\" HFuse.cabal"
235ghcPathsPatches :: String
236ghcPathsPatches = "patches = [ ./ghc-paths-nix.patch ];"
238lhs2texPostInstall :: String
239lhs2texPostInstall = unlines
241 , " mkdir -p \"$out/share/doc/$name\""
242 , " cp doc/Guide2.pdf $out/share/doc/$name"
243 , " mkdir -p \"$out/nix-support\""
247ncursesPatchPhase :: String
248ncursesPatchPhase = "patchPhase = \"find . -type f -exec sed -i -e 's|ncursesw/||' {} \\\\;\";"
250doctestNoHaddock, markdownUnlitNoHaddock :: String
251markdownUnlitNoHaddock = "noHaddock = self.stdenv.lib.versionOlder self.ghc.version \"7.4\";"
252doctestNoHaddock = markdownUnlitNoHaddock
254cabal2nixDoCheckHook :: String
255cabal2nixDoCheckHook = "doCheck = self.stdenv.lib.versionOlder \"7.6\" self.ghc.version;"
257textIcuDoCheckHook :: String
258textIcuDoCheckHook = "doCheck = !self.stdenv.isDarwin;"
260eitherNoHaddock :: String
261eitherNoHaddock = "noHaddock = self.stdenv.lib.versionOlder self.ghc.version \"7.6\";"
263httpNoHaddock, quickCheckNoHaddock, tarNoHaddock, transformersNoHaddock :: String
264httpNoHaddock = "noHaddock = self.stdenv.lib.versionOlder self.ghc.version \"6.11\";"
265quickCheckNoHaddock = httpNoHaddock
266tarNoHaddock = httpNoHaddock
267transformersNoHaddock = httpNoHaddock
269agdaPostInstall :: String
270agdaPostInstall = unlines
272 , " $out/bin/agda -c --no-main $out/share/Agda-*/lib/prim/Agda/Primitive.agda"
273 , " $out/bin/agda-mode compile"
277structuredHaskellModePostInstall :: String
278structuredHaskellModePostInstall = unlines
280 , " emacs -L elisp --batch -f batch-byte-compile \"elisp/\"*.el"
281 , " install -d $out/share/emacs/site-lisp"
282 , " install \"elisp/\"*.el \"elisp/\"*.elc $out/share/emacs/site-lisp"
286sloanePostInstall :: String
287sloanePostInstall = unlines
289 , " mkdir -p $out/share/man/man1"
290 , " cp sloane.1 $out/share/man/man1/"
294mimeMailConfigureFlags :: String
295mimeMailConfigureFlags = unlines
296 [ "configureFlags = \"--ghc-option=-DMIME_MAIL_SENDMAIL_PATH=\\\"${sendmail}\\\"\";"
299sybDoCheck, splitDoCheck :: String
300sybDoCheck = "doCheck = self.stdenv.lib.versionOlder self.ghc.version \"7.9\";"
301splitDoCheck = sybDoCheck
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list