@@ -3,6 +3,7 @@
3module Distribution.Nixpkgs.Haskell.FromCabal.PostProcess ( postProcess ) where
3module Distribution.Nixpkgs.Haskell.FromCabal.PostProcess ( postProcess ) where
5import Internal.Lens
5import Internal.Lens
6import Data.Maybe
7import Data.Maybe
7import Data.Set ( Set )
8import Data.Set ( Set )
8import qualified Data.Set as Set
9import qualified Data.Set as Set
@@ -17,9 +18,18 @@ postProcess :: Derivation -> Derivation
17postProcess deriv = foldr ($) (fixGtkBuilds deriv) [ f | (Dependency n vr, f) <- hooks, packageName deriv == n, packageVersion deriv `withinRange` vr ]
18postProcess deriv = foldr ($) (fixGtkBuilds deriv) [ f | (Dependency n vr, f) <- hooks, packageName deriv == n, packageVersion deriv `withinRange` vr ]
19fixGtkBuilds :: Derivation -> Derivation
20fixGtkBuilds :: Derivation -> Derivation
20−fixGtkBuilds drv = drv & dependencies . pkgconfig %~ (`Set.difference` buildDeps)
21+fixGtkBuilds drv = drv & dependencies . pkgconfig %~ Set.filter (not . collidesWithHaskellName)
22+ & dependencies . system %~ Set.filter (not . collidesWithHaskellName)
23+ & dependencies . tool %~ Set.filter (not . collidesWithHaskellName)
22− buildDeps = drv ^. dependencies . haskell
25+ collidesWithHaskellName :: Binding -> Bool
26+ collidesWithHaskellName b = view localName b `Set.member` buildDeps
29+ myName = create ident n where PackageName n = packageName drv
31+ buildDeps :: Set Identifier
32+ buildDeps = Set.delete myName (setOf (dependencies . haskell . folded . localName) drv)
24hooks :: [(Dependency, Derivation -> Derivation)]
34hooks :: [(Dependency, Derivation -> Derivation)]
25hooks = over (mapped._1) (\str -> fromMaybe (error ("invalid constraint: " ++ show str)) (simpleParse str))
35hooks = over (mapped._1) (\str -> fromMaybe (error ("invalid constraint: " ++ show str)) (simpleParse str))