cabal2nix 2.21.1 → 2.21.2
raw patch · 4 files changed
+29/−3 lines, 4 filesdep ~CabalPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: Cabal
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- cabal2nix.cabal +1/−1
- src/Distribution/Nixpkgs/Haskell/FromCabal.hs +22/−1
- src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs +1/−1
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Revision History for cabal2nix +## 2.21.2++* Add support for Cabal `>= 3.16`, see+ [#698](https://github.com/NixOS/cabal2nix/pull/698).+ ## 2.21.1 * Update attribute names of X11 related libraries to prefer their top
cabal2nix.cabal view
@@ -1,5 +1,5 @@ name: cabal2nix-version: 2.21.1+version: 2.21.2 synopsis: Convert Cabal files into Nix build instructions. description: Convert Cabal files into Nix build instructions. Users of Nix can install the latest
src/Distribution/Nixpkgs/Haskell/FromCabal.hs view
@@ -39,6 +39,12 @@ import Distribution.Version import Language.Nix +#if MIN_VERSION_Cabal(3,16,0)+import Distribution.Types.MissingDependency ( MissingDependency(MissingDependency) )+import Distribution.Types.DependencySatisfaction ( DependencySatisfaction(..) )+import Distribution.Types.MissingDependencyReason ( MissingDependencyReason(WrongVersion) )+#endif+ type HaskellResolver = PackageVersionConstraint -> Bool type NixpkgsResolver = Identifier -> Maybe Binding @@ -54,8 +60,16 @@ -- finalizePD incooperates the 'LibraryName' of a dependency -- which we always ignore, so the Cabal-compatible resolver -- is a simple wrapper around our 'HaskellResolver'+#if MIN_VERSION_Cabal(3,16,0)+ makeCabalResolver :: HaskellResolver -> Dependency -> DependencySatisfaction+ makeCabalResolver r (Dependency n v _) =+ if r (PackageVersionConstraint n v)+ then Satisfied+ else Unsatisfied (WrongVersion [])+#else makeCabalResolver :: HaskellResolver -> Dependency -> Bool makeCabalResolver r (Dependency n v _) = r (PackageVersionConstraint n v)+#endif -- the finalizePD API changed in Cabal 3.4.0.0, so we need to do some plumbing. -- See https://github.com/haskell/cabal/issues/5570@@ -70,7 +84,14 @@ -- We have to call the Cabal finalizer several times with different resolver -- functions, and this convenience function makes our code shorter. finalize :: HaskellResolver -> Either [Dependency] (PackageDescription,FlagAssignment)- finalize resolver = finalizePD flags requestedComponents (makeCabalResolver resolver) arch compiler (makeCabalConstraints constraints) genDesc+ finalize resolver =+ case finalizePD flags requestedComponents (makeCabalResolver resolver) arch compiler (makeCabalConstraints constraints) genDesc of+#if MIN_VERSION_Cabal(3,16,0)+ Left left -> Left (map (\(MissingDependency dependency _reason) -> dependency) left)+#else+ Left left -> Left left+#endif+ Right right -> Right right requestedComponents :: ComponentRequestedSpec requestedComponents = ComponentRequestedSpec
src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs view
@@ -210,7 +210,7 @@ libNixName "libsystemd" = return "systemd" libNixName "libudev" = return "systemd" libNixName "libxml-2.0" = return "libxml2"-libNixName "libxxhash" = return "xxHash"+libNixName "libxxhash" = return "xxhash" libNixName "libzip" = return "libzip" libNixName "libzmq" = return "zeromq" libNixName "liquid" = return "liquid-dsp"