@@ -8,8 +8,8 @@ module Distribution.Nixpkgs.Haskell
8 , cabalFlags, runHaddock, jailbreak, doCheck, testTarget, hyperlinkSource, enableSplitObjs
8 , cabalFlags, runHaddock, jailbreak, doCheck, testTarget, hyperlinkSource, enableSplitObjs
9 , phaseOverrides, editedCabalFile, metaSection
9 , phaseOverrides, editedCabalFile, metaSection
10 , BuildInfo, haskell, pkgconfig, system, tool
10 , BuildInfo, haskell, pkgconfig, system, tool
11− , dependencies
11+ , dependencies, anyDep
12− , unDep
12+ , dep, unDep
@@ -37,6 +37,8 @@ data BuildInfo = BuildInfo
38makeLenses ''BuildInfo
38makeLenses ''BuildInfo
40+makeLensesFor [("_haskell", "anyDep"), ("_pkgconfig", "anyDep"), ("_system", "anyDep"), ("_tool", "anyDep")] ''BuildInfo
40instance Monoid BuildInfo where
42instance Monoid BuildInfo where
41 mempty = BuildInfo mempty mempty mempty mempty
43 mempty = BuildInfo mempty mempty mempty mempty
42 BuildInfo w1 x1 y1 z1 `mappend` BuildInfo w2 x2 y2 z2 = BuildInfo (w1 `mappend` w2) (x1 `mappend` x2) (y1 `mappend` y2) (z1 `mappend` z2)
44 BuildInfo w1 x1 y1 z1 `mappend` BuildInfo w2 x2 y2 z2 = BuildInfo (w1 `mappend` w2) (x1 `mappend` x2) (y1 `mappend` y2) (z1 `mappend` z2)
@@ -113,7 +115,7 @@ instance NFData VersionRange where rnf = genericRnf
113instance NFData Dependency where rnf = genericRnf
115instance NFData Dependency where rnf = genericRnf
115instance Pretty Derivation where
117instance Pretty Derivation where
116− pPrint MkDerivation {..} = funargs (map text ("mkDerivation" : toAscList inputs)) $$ vcat
118+ pPrint drv@(MkDerivation {..}) = funargs (map text ("mkDerivation" : toAscList inputs)) $$ vcat
117 [ text "mkDerivation" <+> lbrace
119 [ text "mkDerivation" <+> lbrace
118 , nest 2 $ vcat
120 , nest 2 $ vcat
119 [ attr "pname" $ doubleQuotes $ disp (packageName _pkgid)
121 [ attr "pname" $ doubleQuotes $ disp (packageName _pkgid)
@@ -141,18 +143,7 @@ instance Pretty Derivation where
142 inputs :: Set String
144 inputs :: Set String
143 inputs = Set.unions [ _extraFunctionArgs
145 inputs = Set.unions [ _extraFunctionArgs
144− , Set.map unDep (_haskell _libraryDepends)
146+ , view (dependencies . anyDep . to (Set.map unDep)) drv
145− , Set.map unDep (_haskell _executableDepends)
146− , Set.map unDep (_haskell _testDepends)
147− , Set.map unDep (_system _libraryDepends)
148− , Set.map unDep (_system _executableDepends)
149− , Set.map unDep (_system _testDepends)
150− , Set.map unDep (_pkgconfig _libraryDepends)
151− , Set.map unDep (_pkgconfig _executableDepends)
152− , Set.map unDep (_pkgconfig _testDepends)
153− , Set.map unDep (_tool _libraryDepends)
154− , Set.map unDep (_tool _executableDepends)
155− , Set.map unDep (_tool _testDepends)
156 , Set.fromList ["fetch" ++ derivKind _src | derivKind _src /= "" && not isHackagePackage]
147 , Set.fromList ["fetch" ++ derivKind _src | derivKind _src /= "" && not isHackagePackage]
@@ -180,6 +171,9 @@ pPrintBuildInfo prefix bi = vcat
180 , setattr (prefix++"ToolDepends") (Set.map unDep (bi^.tool))
171 , setattr (prefix++"ToolDepends") (Set.map unDep (bi^.tool))
174+dep :: String -> Dependency
175+dep s = Dependency (PackageName s) anyVersion
183unDep :: Dependency -> String
177unDep :: Dependency -> String
184unDep (Dependency (PackageName x) _) = x
178unDep (Dependency (PackageName x) _) = x