git.iko.soy/typeable/cabal2nix
on master help sign in
Added a post-processing stage to 'cabal2nix' that can be used to mess

with the generated derivation, i.e. to add undeclared build inputs.

commit51ef63b5a81f87a858e687c0c592317bb2fdaa4c authorPeter Simons <simons@cryp.to> dateTue 23 Aug 2011, 12:28 (15 years ago) parent18fb5f8
3 files changed+39−1
cabal2nix.cabal+2 src/Cabal2Nix/Package.hs+2−1 src/Cabal2Nix/PostProcess.hs+35
cabal2nix.cabal+2
@@ -62,6 +62,7 @@ Executable cabal2nix
6262 Cabal2Nix.Hackage
6363 Cabal2Nix.Name
6464 Cabal2Nix.Package
65+ Cabal2Nix.PostProcess
6566 Distribution.NixOS.Derivation.Cabal
6667 Distribution.NixOS.Derivation.License
6768 Distribution.NixOS.Derivation.Meta
@@ -77,6 +78,7 @@ Executable hackage4nix
7778 other-modules: Cabal2Nix.CorePackages
7879 Cabal2Nix.Name
7980 Cabal2Nix.Package
81+ Cabal2Nix.PostProcess
8082 Distribution.NixOS.Derivation.Cabal
8183 Distribution.NixOS.Derivation.License
8284 Distribution.NixOS.Derivation.Meta
src/Cabal2Nix/Package.hs+2−1
@@ -1,6 +1,7 @@
11module Cabal2Nix.Package ( cabal2nix ) where
22
33import Cabal2Nix.License
4+import Cabal2Nix.PostProcess
45import Data.Maybe
56import Distribution.Compiler
67import qualified Distribution.Package as Cabal
@@ -15,7 +16,7 @@ import Data.List
1516import Data.Char
1617
1718cabal2nix :: Cabal.GenericPackageDescription -> Derivation
18−cabal2nix cabal = MkDerivation
19+cabal2nix cabal = postProcess $ MkDerivation
1920 { pname = let Cabal.PackageName x = Cabal.pkgName pkg in x
2021 , version = Cabal.pkgVersion pkg
2122 , sha256 = "cabal2nix left the she256 field undefined"
src/Cabal2Nix/PostProcess.hsnew file+35
@@ -0,0 +1,35 @@
1+{-# LANGUAGE RecordWildCards #-}
2+
3+module Cabal2Nix.PostProcess ( postProcess ) where
4+
5+import Distribution.NixOS.Derivation.Cabal
6+import Data.List
7+
8+postProcess :: Derivation -> Derivation
9+postProcess deriv@(MkDerivation {..})
10+ | pname == "alex" = deriv { buildTools = "perl":buildTools }
11+ | pname == "cairo" = deriv { extraLibs = "pkgconfig":"glibc":"cairo":"zlib":extraLibs }
12+ | pname == "editline" = deriv { extraLibs = "libedit":extraLibs }
13+ | pname == "epic" = deriv { extraLibs = "gmp":"boehmgc":extraLibs, buildTools = "happy":buildTools }
14+ | pname == "glade" = deriv { extraLibs = "pkgconfig":"glibc":extraLibs, pkgConfDeps = "gtkC":(delete "gtk" pkgConfDeps) }
15+ | pname == "glib" = deriv { extraLibs = "pkgconfig":"glibc":extraLibs }
16+ | pname == "GLUT" = deriv { extraLibs = "glut":"libSM":"libICE":"libXmu":"libXi":"mesa":extraLibs }
17+ | pname == "gtk" = deriv { extraLibs = "pkgconfig":"glibc":extraLibs, buildDepends = delete "gio" buildDepends }
18+ | pname == "gtksourceview2" = deriv { extraLibs = "pkgconfig":"glibc":extraLibs }
19+ | pname == "haskell-src" = deriv { buildTools = "happy":buildTools }
20+ | pname == "hmatrix" = deriv { extraLibs = "gsl":"liblapack":"blas":extraLibs }
21+ | pname == "idris" = deriv { buildTools = "happy":buildTools }
22+ | pname == "OpenAL" = deriv { extraLibs = "openal":extraLibs }
23+ | pname == "OpenGL" = deriv { extraLibs = "mesa":"libX11":extraLibs }
24+ | pname == "pango" = deriv { extraLibs = "pkgconfig":"glibc":extraLibs }
25+ | pname == "repa-examples" = deriv { extraLibs = "llvm":extraLibs }
26+ | pname == "SDL-image" = deriv { extraLibs = "SDL_image":extraLibs }
27+ | pname == "SDL-mixer" = deriv { extraLibs = "SDL_mixer":extraLibs }
28+ | pname == "SDL-ttf" = deriv { extraLibs = "SDL_ttf":extraLibs }
29+ | pname == "svgcairo" = deriv { extraLibs = "glibc":extraLibs }
30+ | pname == "terminfo" = deriv { extraLibs = "ncurses":extraLibs }
31+ | pname == "vacuum" = deriv { extraLibs = "ghcPaths":extraLibs }
32+ | pname == "wxcore" = deriv { extraLibs = "wxGTK":"mesa":"libX11":extraLibs }
33+ | pname == "xmonad" = deriv { extraLibs = delete "libmpd" extraLibs }
34+ | pname == "xmonad-extras" = deriv { buildDepends = delete "libmpd" buildDepends }
35+ | otherwise = deriv