@@ -9,9 +9,10 @@ postProcess :: Derivation -> Derivation
99postProcess deriv@(MkDerivation {..})
1010 | pname == "alex" = deriv { buildTools = "perl":buildTools }
1111 | pname == "cairo" = deriv { extraLibs = "pkgconfig":"libc":"cairo":"zlib":extraLibs }
12+ | pname == "cuda" = deriv { phaseOverrides = cudaConfigurePhase, extraLibs = "cudatoolkit":"nvidia_x11":"self.stdenv.gcc":extraLibs }
1213 | pname == "editline" = deriv { extraLibs = "libedit":extraLibs }
1314 | pname == "epic" = deriv { extraLibs = "gmp":"boehmgc":extraLibs, buildTools = "happy":buildTools }
14− | pname == "ghc-mod" = deriv { postInstall = ghcModPostInstall, buildTools = "emacs":buildTools }
15+ | pname == "ghc-mod" = deriv { phaseOverrides = ghcModPostInstall, buildTools = "emacs":buildTools }
1516 | pname == "glade" = deriv { extraLibs = "pkgconfig":"libc":extraLibs, pkgConfDeps = "gtkC":delete "gtk" pkgConfDeps }
1617 | pname == "glib" = deriv { extraLibs = "pkgconfig":"libc":extraLibs }
1718 | pname == "GLUT" = deriv { extraLibs = "glut":"libSM":"libICE":"libXmu":"libXi":"mesa":extraLibs }
@@ -23,6 +24,7 @@ postProcess deriv@(MkDerivation {..})
2324 | pname == "haskell-src-meta" = deriv { buildDepends = "uniplate":buildDepends }
2425 | pname == "hmatrix" = deriv { extraLibs = "gsl":"liblapack":"blas":extraLibs }
2526 | pname == "idris" = deriv { buildTools = "happy":buildTools }
27+ | pname == "language-c-quote" = deriv { buildTools = "alex":"happy":buildTools }
2628 | pname == "leksah-server" = deriv { buildDepends = "process-leksah":buildDepends }
2729 | pname == "multiarg" = deriv { buildDepends = "utf8String":buildDepends }
2830 | pname == "OpenAL" = deriv { extraLibs = "openal":extraLibs }
@@ -39,7 +41,7 @@ postProcess deriv@(MkDerivation {..})
3941 | pname == "threadscope" = deriv { configureFlags = "--ghc-options=-rtsopts":configureFlags }
4042 | pname == "vacuum" = deriv { extraLibs = "ghcPaths":extraLibs }
4143 | pname == "wxcore" = deriv { extraLibs = "wxGTK":"mesa":"libX11":extraLibs }
42− | pname == "wxc" = deriv { extraLibs = "wxGTK":"mesa":"libX11":extraLibs, postInstall = wxcPostInstall }
44+ | pname == "wxc" = deriv { extraLibs = "wxGTK":"mesa":"libX11":extraLibs, phaseOverrides = wxcPostInstall }
4345 | pname == "X11" && version >= (Version [1,6] [])
4446 = deriv { extraLibs = "libXinerama":"libXext":"libXrender":extraLibs }
4547 | pname == "X11" = deriv { extraLibs = "libXinerama":"libXext":extraLibs }
@@ -48,6 +50,37 @@ postProcess deriv@(MkDerivation {..})
4850 }
4951 | otherwise = deriv
5052
53+cudaConfigurePhase :: String
54+cudaConfigurePhase = unlines
55+ [ "# Perhaps this should be the default in cabal.nix ..."
56+ , "#"
57+ , "# The cudatoolkit provides both 64 and 32-bit versions of the"
58+ , "# library. GHC's linker fails if the wrong version is found first."
59+ , "# We solve this by eliminating lib64 from the path on 32-bit"
60+ , "# platforms and putting lib64 first on 64-bit platforms."
61+ , ""
62+ , "libPaths = if self.stdenv.is64bit then \"lib64 lib\" else \"lib\";"
63+ , ""
64+ , "configurePhase = ''"
65+ , " for i in Setup.hs Setup.lhs; do"
66+ , " test -f $i && ghc --make $i"
67+ , " done"
68+ , ""
69+ , " for p in $extraBuildInputs $propagatedBuildNativeInputs; do"
70+ , " if [ -d \"$p/include\" ]; then"
71+ , " extraLibDirs=\"$extraLibDirs --extra-include-dir=$p/include\""
72+ , " fi"
73+ , " for d in $libPaths; do"
74+ , " if [ -d \"$p/$d\" ]; then"
75+ , " extraLibDirs=\"$extraLibDirs --extra-lib-dir=$p/$d\""
76+ , " fi"
77+ , " done"
78+ , " done"
79+ , ""
80+ , " ./Setup configure --verbose --prefix=\"$out\" $libraryProfiling $extraLibDirs $configureFlags"
81+ , "'';"
82+ ]
83+
5184ghcModPostInstall :: String
5285ghcModPostInstall = unlines
5386 [ "postInstall = ''"