git.iko.soy/typeable/cabal2nix
on master help sign in
hackage2nix: split core packages into those that are known to Hackage and those that are not
commit73e861e00060cc870d15e1050428aff11855a2a2 authorPeter Simons <simons@cryp.to> dateSun 4 Jan 2015, 20:39 (12 years ago) parent4546c2b
1 file changed+12−8
src/hackage2nix.hs+12−8
src/hackage2nix.hs+12−8
@@ -48,7 +48,7 @@ generatePackageSet hackage nixpkgs = do
4848
4949 resolver :: Dependency -> Bool
5050 resolver dep@(Dependency (PackageName pkg) vrange) =
51− any (`matches` dep) corePackages ||
51+ any (`matches` dep) (corePackages ++ hardCorePackages) ||
5252 maybe False (not . Map.null . Map.filterWithKey (\k _ -> k `withinRange` vrange)) (Map.lookup pkg defaultPackageSet)
5353
5454 forM_ (Map.assocs defaultPackageSet) $ \(name, vdb) ->
@@ -104,10 +104,10 @@ generatePackage hackage resolver nixpkgs name version descr = do
104104 }
105105
106106 selectHackageNames :: Set String -> Set String
107− selectHackageNames = Set.intersection (Map.keysSet hackage `Set.union` Set.fromList [ n | PackageIdentifier (PackageName n) _ <- corePackages ])
107+ selectHackageNames = Set.intersection (Map.keysSet hackage `Set.union` Set.fromList [ n | PackageIdentifier (PackageName n) _ <- corePackages ++ hardCorePackages ])
108108
109109 selectMissingHackageNames :: Set String -> Set String
110− selectMissingHackageNames = flip Set.difference (Map.keysSet hackage `Set.union` Set.fromList [ n | PackageIdentifier (PackageName n) _ <- corePackages ])
110+ selectMissingHackageNames = flip Set.difference (Map.keysSet hackage `Set.union` Set.fromList [ n | PackageIdentifier (PackageName n) _ <- corePackages ++ hardCorePackages ])
111111
112112 conflicts :: Set String
113113 conflicts = Set.difference (selectHackageNames $ Set.fromList (extraLibs drv ++ pkgConfDeps drv)) missing
@@ -130,7 +130,7 @@ generatePackage hackage resolver nixpkgs name version descr = do
130130 overrides :: Doc
131131 overrides = conflictOverrides $+$ missingOverrides
132132
133− return $ (drv { metaSection = (metaSection drv) { broken = not (Set.null missing) || not (null missingDeps) } }, overrides)
133+ return (drv, overrides)
134134
135135isKnownNixpkgAttribute :: PackageMap -> Hackage -> String -> Bool
136136isKnownNixpkgAttribute nixpkgs hackage name
@@ -246,19 +246,17 @@ cabal2nix resolver cabal = case finalize of
246246 []
247247 cabal
248248
249−corePackages :: [PackageIdentifier]
249+corePackages :: [PackageIdentifier] -- Core packages found on Hackageg
250250corePackages = map (\s -> maybe (error (show s ++ " is not a valid core package")) id (simpleParse s))
251251 [ "Cabal-1.18.1.5"
252252 , "array-0.5.0.0"
253253 , "base-4.7.0.2"
254− , "bin-package-db-0.0.0.0"
255254 , "binary-0.7.1.0"
256255 , "bytestring-0.10.4.0"
257256 , "containers-0.5.5.1"
258257 , "deepseq-1.3.0.2"
259258 , "directory-1.2.1.0"
260259 , "filepath-1.3.0.2"
261− , "ghc-7.8.4"
262260 , "ghc-prim-0.3.1.0"
263261 , "haskeline-0.7.1.2"
264262 , "haskell2010-1.1.2.0"
@@ -270,7 +268,6 @@ corePackages = map (\s -> maybe (error (show s ++ " is not a valid core package"
270268 , "old-time-1.1.0.2"
271269 , "pretty-1.1.1.1"
272270 , "process-1.2.0.0"
273− , "rts-1.0"
274271 , "template-haskell-2.9.0.0"
275272 , "terminfo-0.4.0.0"
276273 , "time-1.4.2"
@@ -278,3 +275,10 @@ corePackages = map (\s -> maybe (error (show s ++ " is not a valid core package"
278275 , "unix-2.7.0.1"
279276 , "xhtml-3000.2.1"
280277 ]
278+
279+hardCorePackages :: [PackageIdentifier] -- Core packages not found on Hackage.
280+hardCorePackages = map (\s -> maybe (error (show s ++ " is not a valid core package")) id (simpleParse s))
281+ [ "bin-package-db-0.0.0.0"
282+ , "ghc-7.8.4"
283+ , "rts-1.0"
284+ ]