git.iko.soy/typeable/cabal2nix
on master help sign in
hackage2nix: switch default package set to stackage nightly
54d2d11Peter Simons
hackage2nix/src/Main.hs+6−2
@@ -76,7 +76,7 @@ main = do
76 )
76 )
77 CLI {..} <- execParser pinfo
77 CLI {..} <- execParser pinfo
78
78
79− config <- readConfiguration (nixpkgsRepository </> configFile)
79+ config' <- readConfiguration (nixpkgsRepository </> configFile)
80 nixpkgs <- readNixpkgPackageMap nixpkgsRepository Nothing
80 nixpkgs <- readNixpkgPackageMap nixpkgsRepository Nothing
81 preferredVersions <- readPreferredVersions (fromMaybe (hackageRepository </> "preferred-versions") preferredVersionsFile)
81 preferredVersions <- readPreferredVersions (fromMaybe (hackageRepository </> "preferred-versions") preferredVersionsFile)
82 let fixup = Map.delete "acme-everything" -- TODO: https://github.com/NixOS/cabal2nix/issues/164
82 let fixup = Map.delete "acme-everything" -- TODO: https://github.com/NixOS/cabal2nix/issues/164
@@ -84,8 +84,12 @@ main = do
84 . Map.delete "type" -- TODO: https://github.com/NixOS/cabal2nix/issues/163
84 . Map.delete "type" -- TODO: https://github.com/NixOS/cabal2nix/issues/163
85 . Map.delete "dictionary-sharing" -- TODO: https://github.com/NixOS/cabal2nix/issues/175
85 . Map.delete "dictionary-sharing" -- TODO: https://github.com/NixOS/cabal2nix/issues/175
86 hackage <- fixup <$> readHackage hackageRepository
86 hackage <- fixup <$> readHackage hackageRepository
87− snapshots <- runParIO (readStackage ltsHaskellRepository)
87+ snapshots <- runParIO (readLTSHaskell ltsHaskellRepository)
88+ nightly <- readStackageNightly stackageNightlyRepository
88 let
89 let
90+ config :: Configuration
91+ config = config' { defaultPackageOverrides = [ Dependency n (thisVersion (Stackage.version spec)) | (n, spec) <- Map.toList (packages nightly) ] }
92+
89 hackagePackagesFile :: FilePath
93 hackagePackagesFile :: FilePath
90 hackagePackagesFile = nixpkgsRepository </> "pkgs/development/haskell-modules/hackage-packages.nix"
94 hackagePackagesFile = nixpkgsRepository </> "pkgs/development/haskell-modules/hackage-packages.nix"
91
95
hackage2nix/src/Stackage.hs+8−2
@@ -59,11 +59,17 @@ instance Pretty SnapshotType where
59 pPrint (STNightly2 _) = text "stackage-nightly"
59 pPrint (STNightly2 _) = text "stackage-nightly"
60 pPrint (STLTS m n) = text "lts-" <> int m <> char '.' <> int n
60 pPrint (STLTS m n) = text "lts-" <> int m <> char '.' <> int n
61
61
62−readStackage :: FilePath -> ParIO [Snapshot]
62+readLTSHaskell :: FilePath -> ParIO [Snapshot]
63−readStackage dirPath = do
63+readLTSHaskell dirPath = do
64 filePaths <- liftIO (listFiles dirPath)
64 filePaths <- liftIO (listFiles dirPath)
65 parMapM (liftIO . readSnapshot) [ dirPath </> p | p <- filePaths, takeExtension p == ".yaml" ]
65 parMapM (liftIO . readSnapshot) [ dirPath </> p | p <- filePaths, takeExtension p == ".yaml" ]
66
66
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+
67readSnapshot :: FilePath -> IO Snapshot
73readSnapshot :: FilePath -> IO Snapshot
68readSnapshot p = fmap (fromBuildPlan (parseSnapshotType (takeFileName p))) (readBuildPlan p)
74readSnapshot p = fmap (fromBuildPlan (parseSnapshotType (takeFileName p))) (readBuildPlan p)
69
75