git.iko.soy/typeable/cabal2nix
on master help sign in
hackage2nix: switch default package set to stackage nightly
commit54d2d11846c4e549bdf39e6a34c302c81310676f authorPeter Simons <simons@cryp.to> dateWed 16 Sep 2015, 14:19 (11 years ago) parent63fcc77
2 files changed+14−4
hackage2nix/src/Main.hs+6−2 hackage2nix/src/Stackage.hs+8−2
hackage2nix/src/Main.hs+6−2
@@ -76,7 +76,7 @@ main = do
7676 )
7777 CLI {..} <- execParser pinfo
7878
79− config <- readConfiguration (nixpkgsRepository </> configFile)
79+ config' <- readConfiguration (nixpkgsRepository </> configFile)
8080 nixpkgs <- readNixpkgPackageMap nixpkgsRepository Nothing
8181 preferredVersions <- readPreferredVersions (fromMaybe (hackageRepository </> "preferred-versions") preferredVersionsFile)
8282 let fixup = Map.delete "acme-everything" -- TODO: https://github.com/NixOS/cabal2nix/issues/164
@@ -84,8 +84,12 @@ main = do
8484 . Map.delete "type" -- TODO: https://github.com/NixOS/cabal2nix/issues/163
8585 . Map.delete "dictionary-sharing" -- TODO: https://github.com/NixOS/cabal2nix/issues/175
8686 hackage <- fixup <$> readHackage hackageRepository
87− snapshots <- runParIO (readStackage ltsHaskellRepository)
87+ snapshots <- runParIO (readLTSHaskell ltsHaskellRepository)
88+ nightly <- readStackageNightly stackageNightlyRepository
8889 let
90+ config :: Configuration
91+ config = config' { defaultPackageOverrides = [ Dependency n (thisVersion (Stackage.version spec)) | (n, spec) <- Map.toList (packages nightly) ] }
92+
8993 hackagePackagesFile :: FilePath
9094 hackagePackagesFile = nixpkgsRepository </> "pkgs/development/haskell-modules/hackage-packages.nix"
9195
hackage2nix/src/Stackage.hs+8−2
@@ -59,11 +59,17 @@ instance Pretty SnapshotType where
5959 pPrint (STNightly2 _) = text "stackage-nightly"
6060 pPrint (STLTS m n) = text "lts-" <> int m <> char '.' <> int n
6161
62−readStackage :: FilePath -> ParIO [Snapshot]
63−readStackage dirPath = do
62+readLTSHaskell :: FilePath -> ParIO [Snapshot]
63+readLTSHaskell dirPath = do
6464 filePaths <- liftIO (listFiles dirPath)
6565 parMapM (liftIO . readSnapshot) [ dirPath </> p | p <- filePaths, takeExtension p == ".yaml" ]
6666
67+readStackageNightly :: FilePath -> IO Snapshot
68+readStackageNightly dirPath = do
69+ filePaths <- liftIO (listFiles dirPath)
70+ let filePath = last (sort [ p | p <- filePaths, takeExtension p == ".yaml" ])
71+ readSnapshot (dirPath </> filePath)
72+
6773readSnapshot :: FilePath -> IO Snapshot
6874readSnapshot p = fmap (fromBuildPlan (parseSnapshotType (takeFileName p))) (readBuildPlan p)
6975