cabal2nix 1.31 → 1.32
raw patch · 6 files changed
+54/−11 lines, 6 files
Files
- cabal2nix.cabal +3/−3
- src/Cabal2Nix/Flags.hs +2/−0
- src/Cabal2Nix/Generate.hs +2/−2
- src/Cabal2Nix/PostProcess.hs +42/−1
- src/Distribution/NixOS/Derivation/Cabal.hs +4/−4
- src/Hackage4Nix.hs +1/−1
cabal2nix.cabal view
@@ -1,5 +1,5 @@ Name: cabal2nix-Version: 1.31+Version: 1.32 Copyright: Peter Simons, Andres Loeh License: BSD3 License-File: LICENSE@@ -31,8 +31,8 @@ . The only required argument is the path to the cabal file. For example: .- > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.31/cabal2nix.cabal- > cabal2nix cabal://cabal2nix-1.31+ > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.32/cabal2nix.cabal+ > cabal2nix cabal://cabal2nix-1.32 . If the @--sha256@ option has not been specified, cabal2nix calls @nix-prefetch-url@ to determine the hash automatically. This causes
src/Cabal2Nix/Flags.hs view
@@ -5,7 +5,9 @@ configureCabalFlags :: PackageIdentifier -> FlagAssignment configureCabalFlags (PackageIdentifier (PackageName name) _)+ | name == "haskeline" = [enable "terminfo"] | name == "xmobar" = [enable "with_xft"]+ | name == "accelerate-examples"= [disable "opencl"] | otherwise = [] enable :: String -> (FlagName,Bool)
src/Cabal2Nix/Generate.hs view
@@ -27,7 +27,7 @@ , configureFlags = [] , cabalFlags = configureCabalFlags pkg , runHaddock = True- , postInstall = ""+ , phaseOverrides = "" , metaSection = Meta { homepage = Cabal.homepage descr , description = Cabal.synopsis descr@@ -49,7 +49,7 @@ (configureCabalFlags pkg) (const True) (Platform I386 Linux) -- shouldn't be hardcoded- (CompilerId GHC (Version [7,2,2] [])) -- dito+ (CompilerId GHC (Version [7,4,1] [])) -- dito [] cabal unDep :: Cabal.Dependency -> String
src/Cabal2Nix/PostProcess.hs view
@@ -9,9 +9,10 @@ postProcess deriv@(MkDerivation {..}) | pname == "alex" = deriv { buildTools = "perl":buildTools } | pname == "cairo" = deriv { extraLibs = "pkgconfig":"libc":"cairo":"zlib":extraLibs }+ | pname == "cuda" = deriv { phaseOverrides = cudaConfigurePhase, extraLibs = "cudatoolkit":"nvidia_x11":"self.stdenv.gcc":extraLibs } | pname == "editline" = deriv { extraLibs = "libedit":extraLibs } | pname == "epic" = deriv { extraLibs = "gmp":"boehmgc":extraLibs, buildTools = "happy":buildTools }- | pname == "ghc-mod" = deriv { postInstall = ghcModPostInstall, buildTools = "emacs":buildTools }+ | pname == "ghc-mod" = deriv { phaseOverrides = ghcModPostInstall, buildTools = "emacs":buildTools } | pname == "glade" = deriv { extraLibs = "pkgconfig":"libc":extraLibs, pkgConfDeps = "gtkC":delete "gtk" pkgConfDeps } | pname == "glib" = deriv { extraLibs = "pkgconfig":"libc":extraLibs } | pname == "GLUT" = deriv { extraLibs = "glut":"libSM":"libICE":"libXmu":"libXi":"mesa":extraLibs }@@ -23,6 +24,7 @@ | pname == "haskell-src-meta" = deriv { buildDepends = "uniplate":buildDepends } | pname == "hmatrix" = deriv { extraLibs = "gsl":"liblapack":"blas":extraLibs } | pname == "idris" = deriv { buildTools = "happy":buildTools }+ | pname == "language-c-quote" = deriv { buildTools = "alex":"happy":buildTools } | pname == "leksah-server" = deriv { buildDepends = "process-leksah":buildDepends } | pname == "multiarg" = deriv { buildDepends = "utf8String":buildDepends } | pname == "OpenAL" = deriv { extraLibs = "openal":extraLibs }@@ -39,6 +41,7 @@ | pname == "threadscope" = deriv { configureFlags = "--ghc-options=-rtsopts":configureFlags } | pname == "vacuum" = deriv { extraLibs = "ghcPaths":extraLibs } | pname == "wxcore" = deriv { extraLibs = "wxGTK":"mesa":"libX11":extraLibs }+ | pname == "wxc" = deriv { extraLibs = "wxGTK":"mesa":"libX11":extraLibs, phaseOverrides = wxcPostInstall } | pname == "X11" && version >= (Version [1,6] []) = deriv { extraLibs = "libXinerama":"libXext":"libXrender":extraLibs } | pname == "X11" = deriv { extraLibs = "libXinerama":"libXext":extraLibs }@@ -47,6 +50,37 @@ } | otherwise = deriv +cudaConfigurePhase :: String+cudaConfigurePhase = unlines+ [ "# Perhaps this should be the default in cabal.nix ..."+ , "#"+ , "# The cudatoolkit provides both 64 and 32-bit versions of the"+ , "# library. GHC's linker fails if the wrong version is found first."+ , "# We solve this by eliminating lib64 from the path on 32-bit"+ , "# platforms and putting lib64 first on 64-bit platforms."+ , ""+ , "libPaths = if self.stdenv.is64bit then \"lib64 lib\" else \"lib\";"+ , ""+ , "configurePhase = ''"+ , " for i in Setup.hs Setup.lhs; do"+ , " test -f $i && ghc --make $i"+ , " done"+ , ""+ , " for p in $extraBuildInputs $propagatedBuildNativeInputs; do"+ , " if [ -d \"$p/include\" ]; then"+ , " extraLibDirs=\"$extraLibDirs --extra-include-dir=$p/include\""+ , " fi"+ , " for d in $libPaths; do"+ , " if [ -d \"$p/$d\" ]; then"+ , " extraLibDirs=\"$extraLibDirs --extra-lib-dir=$p/$d\""+ , " fi"+ , " done"+ , " done"+ , ""+ , " ./Setup configure --verbose --prefix=\"$out\" $libraryProfiling $extraLibDirs $configureFlags"+ , "'';"+ ]+ ghcModPostInstall :: String ghcModPostInstall = unlines [ "postInstall = ''"@@ -58,3 +92,10 @@ , " mv $pname-$version emacs/site-lisp" , " '';" ]++wxcPostInstall :: String+wxcPostInstall = unlines+ [ "postInstall = ''"+ , " cp -v dist/build/libwxc.so.${self.version} $out/lib/libwxc.so"+ , " '';"+ ]
src/Distribution/NixOS/Derivation/Cabal.hs view
@@ -53,7 +53,7 @@ , configureFlags :: [String] , cabalFlags :: FlagAssignment , runHaddock :: Bool- , postInstall :: String+ , phaseOverrides :: String , metaSection :: Meta } deriving (Show, Eq, Ord)@@ -81,14 +81,14 @@ , listattr "pkgconfigDepends" (pkgConfDeps deriv) , onlyIf renderedFlags $ attr "configureFlags" $ doubleQuotes (sep renderedFlags) , boolattr "noHaddock" (not (runHaddock deriv)) (not (runHaddock deriv))- , onlyIf (postInstall deriv) $ text (postInstall deriv)+ , onlyIf (phaseOverrides deriv) $ vcat ((map text . lines) (phaseOverrides deriv)) , disp (metaSection deriv) ] , rbrace <> rparen , text "" ] where- inputs = nub $ sortBy (compare `on` map toLower) $ filter (/="cabal") $+ inputs = nub $ sortBy (compare `on` map toLower) $ filter (/="cabal") $ filter (not . isPrefixOf "self.") $ buildDepends deriv ++ buildTools deriv ++ extraLibs deriv ++ pkgConfDeps deriv renderedFlags = [ text "-f" <> (if enable then empty else char '-') <> text f | (FlagName f, enable) <- cabalFlags deriv ] ++ map text (configureFlags deriv)@@ -121,7 +121,7 @@ , cabalFlags = [] , runHaddock = case noHaddock of "true":[] -> False _ -> True- , postInstall = ""+ , phaseOverrides = "" , metaSection = Meta { homepage = "" , description = ""
src/Hackage4Nix.hs view
@@ -202,7 +202,7 @@ -- Packages that we cannot parse. badPackagePaths :: [FilePath]-badPackagePaths = ["haskell-platform/2011.2.0.1.nix","haskell-platform/2011.4.0.0.nix"]+badPackagePaths = ["haskell-platform/2011.2.0.1.nix","haskell-platform/2011.4.0.0.nix","haskell-platform/2012.2.0.0.nix"] -- Packages that we cannot regenerate automatically yet. This list -- should be empty.