git.iko.soy/typeable/cabal2nix
on master help sign in
Fix build for hpack-0.22.0.
2160534Tom Smalley
cabal2nix.cabal+1−1
@@ -104,7 +104,7 @@ library
104 , filepath
104 , filepath
105 , hackage-db >2
105 , hackage-db >2
106 , hopenssl >=2
106 , hopenssl >=2
107− , hpack == 0.21.*
107+ , hpack >= 0.21 && < 0.23
108 , language-nix
108 , language-nix
109 , lens
109 , lens
110 , optparse-applicative
110 , optparse-applicative
src/Distribution/Nixpkgs/Haskell/PackageSourceSpec.hs+9
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
1module Distribution.Nixpkgs.Haskell.PackageSourceSpec
2module Distribution.Nixpkgs.Haskell.PackageSourceSpec
2 ( Package(..), getPackage, getPackage', loadHackageDB, sourceFromHackage
3 ( Package(..), getPackage, getPackage', loadHackageDB, sourceFromHackage
3 ) where
4 ) where
@@ -191,10 +192,18 @@ handleIO = Exception.handle
191
192
192hpackDirectory :: FilePath -> MaybeT IO (Bool, Cabal.GenericPackageDescription)
193hpackDirectory :: FilePath -> MaybeT IO (Bool, Cabal.GenericPackageDescription)
193hpackDirectory dir = do
194hpackDirectory dir = do
195+#if MIN_VERSION_hpack(0,22,0)
196+ mPackage <- liftIO $ Hpack.readPackageConfig "" $ dir </> "package.yaml"
197+#else
194 mPackage <- liftIO $ Hpack.readPackageConfig $ dir </> "package.yaml"
198 mPackage <- liftIO $ Hpack.readPackageConfig $ dir </> "package.yaml"
199+#endif
195 case mPackage of
200 case mPackage of
196 Left err -> liftIO $ hPutStrLn stderr ("*** hpack error: " ++ show err ++ ". Exiting.") >> exitFailure
201 Left err -> liftIO $ hPutStrLn stderr ("*** hpack error: " ++ show err ++ ". Exiting.") >> exitFailure
202+#if MIN_VERSION_hpack(0,22,0)
203+ Right (pkg', _) -> do
204+#else
197 Right (_, pkg') -> do
205 Right (_, pkg') -> do
206+#endif
198 let hpackOutput = Hpack.renderPackage Hpack.defaultRenderSettings 2 [] [] pkg'
207 let hpackOutput = Hpack.renderPackage Hpack.defaultRenderSettings 2 [] [] pkg'
199 hash = printSHA256 $ digestString (digestByName "sha256") hpackOutput
208 hash = printSHA256 $ digestString (digestByName "sha256") hpackOutput
200 case parseGenericPackageDescription hpackOutput of
209 case parseGenericPackageDescription hpackOutput of