git.iko.soy/typeable/cabal2nix
on master help sign in
Moved two more functions.
commitcf7f665b64f46502a0efae90793fd1c9f4a2554c authorAndres Loeh <mail@andres-loeh.de> dateSat 6 Aug 2011, 13:19 (15 years ago) parentcff3034
2 files changed+21−20
src/Cabal2Nix.hs−20 src/Cabal2Nix/Package.hs+21
src/Cabal2Nix.hs−20
@@ -15,32 +15,12 @@ import Distribution.Package
1515import Distribution.Text
1616import Data.Version
1717import Data.List
18−import Data.Maybe
1918import Control.Monad
2019import Network.HTTP
2120import System.Process
2221
2322import Cabal2Nix.Package
2423
25−cabal2nix :: GenericPackageDescription -> PkgSHA256 -> Pkg
26−cabal2nix cabal sha256 = Pkg pkgname pkgver sha256 url desc lic (map simplify libDeps ++ map simplify exeDeps) (libs++libs')
27− where
28− pkg = packageDescription cabal
29− PackageName pkgname = pkgName (package pkg)
30− pkgver = versionBranch (pkgVersion (package pkg))
31− lic = license pkg
32− url = homepage pkg
33− desc = synopsis pkg
34− -- globalDeps = buildDepends pkg
35− libDeps = maybeToList (condLibrary cabal)
36− exeDeps = [ tree | (_,tree) <- condExecutables cabal ]
37− libs = concat [ extraLibs (libBuildInfo (condTreeData x)) | x <- libDeps ]
38− libs' = concat [ extraLibs (buildInfo (condTreeData x)) | x <- exeDeps ]
39−
40−simplify :: CondTree ConfVar [Dependency] a -> CondTree ConfVar [Dependency] ()
41−simplify (CondNode _ deps nodes) = CondNode () deps (map simp nodes)
42− where
43− simp (cond,tree,mtree) = (cond, simplify tree, maybe Nothing (Just . simplify) mtree)
4424
4525data Ext = TarGz | Cabal deriving Eq
4626
src/Cabal2Nix/Package.hs+21
@@ -1,9 +1,11 @@
11module Cabal2Nix.Package where
22
33import Data.List
4+import Data.Maybe
45
56import Distribution.Package
67import Distribution.PackageDescription
8+import Distribution.Version
79
810import Cabal2Nix.License
911import Cabal2Nix.Name
@@ -51,3 +53,22 @@ toNix (Pkg name ver sha256 url desc lic deps libs) =
5153 , n `notElem` ["base","containers"]
5254 ]
5355
56+cabal2nix :: GenericPackageDescription -> PkgSHA256 -> Pkg
57+cabal2nix cabal sha256 = Pkg pkgname pkgver sha256 url desc lic (map simplify libDeps ++ map simplify exeDeps) (libs++libs')
58+ where
59+ pkg = packageDescription cabal
60+ PackageName pkgname = pkgName (package pkg)
61+ pkgver = versionBranch (pkgVersion (package pkg))
62+ lic = license pkg
63+ url = homepage pkg
64+ desc = synopsis pkg
65+ -- globalDeps = buildDepends pkg
66+ libDeps = maybeToList (condLibrary cabal)
67+ exeDeps = [ tree | (_,tree) <- condExecutables cabal ]
68+ libs = concat [ extraLibs (libBuildInfo (condTreeData x)) | x <- libDeps ]
69+ libs' = concat [ extraLibs (buildInfo (condTreeData x)) | x <- exeDeps ]
70+
71+simplify :: CondTree ConfVar [Dependency] a -> CondTree ConfVar [Dependency] ()
72+simplify (CondNode _ deps nodes) = CondNode () deps (map simp nodes)
73+ where
74+ simp (cond,tree,mtree) = (cond, simplify tree, maybe Nothing (Just . simplify) mtree)