git.iko.soy/typeable/cabal2nix
on master help sign in
Commit to GHC 7.10.1 or later so that we can get rid of the CPP conditionals.
commitbb6ede95eaf6e07af5c376b9458f4a2da5323fb1 authorPeter Simons <simons@cryp.to> dateThu 23 Apr 2015, 12:38 (12 years ago) parent990ea01
6 files changed+12−42
generate-cabal-file.hs+6−6 release.nix+3−8 src/Cabal2Nix/Generate.hs−6 src/Cabal2Nix/License.hs+1−13 src/Distribution/Nixpkgs/Haskell.hs+1−4 src/hackage2nix.hs+1−5
generate-cabal-file.hs+6−6
@@ -38,14 +38,15 @@ properties = do
3838 , copyright = "Copyright (c) 2011-2015 by Peter Simons et al"
3939 , author = intercalate ", " as
4040 , stability = "Experimental"
41− , cabalVersion = Just (1,8)
41+ , cabalVersion = Just (1,10)
4242 , homepage = "http://github.com/NixOS/cabal2nix/"
4343 , bugReports = "http://github.com/NixOS/cabal2nix/issues"
4444 , extraSourceFiles = ["README.md"]
45+ , testedWith = [(ghc, eq [7,10,1])]
4546 }
4647
4748commonBuildOptions :: HasBuildInfo a => [a]
48−commonBuildOptions = hsSourceDirs ["src"] : commonOptions
49+commonBuildOptions = hsSourceDirs ["src"] : haskell2010 : commonOptions
4950
5051commonOptions :: HasBuildInfo a => [a]
5152commonOptions = commonGhcOptions : commonBuildDepends
@@ -55,12 +56,11 @@ commonGhcOptions = ghcOptions ["-Wall"]
5556
5657commonBuildDepends :: HasBuildInfo a => [a]
5758commonBuildDepends =
58− [ condBlock (impl ghc (lt [7,10])) (buildDepends [unconstrained "prettyclass"], []) []
59− , buildDepends
59+ [ buildDepends
6060 [ package "base" (lt [5])
6161 , unconstrained "aeson"
6262 , unconstrained "bytestring"
63− , unconstrained "Cabal"
63+ , package "Cabal" (gtEq [1,22,2])
6464 , unconstrained "containers"
6565 , unconstrained "deepseq-generics"
6666 , unconstrained "directory"
@@ -70,7 +70,7 @@ commonBuildDepends =
7070 , unconstrained "monad-par"
7171 , unconstrained "monad-par-extras"
7272 , unconstrained "mtl"
73− , unconstrained "pretty"
73+ , package "pretty" (gtEq [1,1,2])
7474 , unconstrained "process"
7575 , unconstrained "regex-posix"
7676 , unconstrained "SHA"
release.nix+3−8
@@ -3,7 +3,7 @@
33{ cabal2nixSrc ? { outPath = ./.; revCount = 0; gitTag = "dirty"; }
44, releaseBuild ? false
55, supportedPlatforms ? ["x86_64-linux"] ++ (if releaseBuild then ["i686-linux" "x86_64-darwin"] else [])
6−, supportedCompilers ? ["ghc784" "ghc7101"]
6+, supportedCompilers ? ["ghc7101"]
77}:
88
99let
@@ -14,11 +14,6 @@ in
1414 let
1515 pkgs = import <nixpkgs> { inherit system; };
1616 haskellPackages = pkgs.lib.getAttrFromPath ["haskell-ng" "packages" ghcVer] pkgs;
17− nativeCabal = pkgs.stdenv.lib.versionOlder "7.8" haskellPackages.ghc.version;
18− Cabal = if nativeCabal then null else haskellPackages.Cabal_1_20_0_3;
19− hackage-db = haskellPackages.hackage-db.override { Cabal = Cabal; };
20− nativePrettyClass = pkgs.stdenv.lib.versionOlder "7.10" haskellPackages.ghc.version;
21− prettyclass = if nativePrettyClass then null else haskellPackages.prettyclass;
2217 in
2318 haskellPackages.mkDerivation {
2419 pname = "cabal2nix";
@@ -31,13 +26,13 @@ in
3126 buildDepends = with haskellPackages; [
3227 aeson base bytestring Cabal containers deepseq deepseq-generics
3328 directory filepath hackage-db monad-par monad-par-extras mtl pretty
34− prettyclass process QuickCheck regex-posix SHA split transformers
29+ process QuickCheck regex-posix SHA split transformers
3530 utf8-string lens
3631 ];
3732 testDepends = with haskellPackages; [
3833 aeson base bytestring Cabal containers deepseq deepseq-generics
3934 directory doctest filepath hackage-db hspec monad-par
40− monad-par-extras mtl pretty prettyclass process QuickCheck
35+ monad-par-extras mtl pretty process QuickCheck
4136 regex-posix SHA split transformers utf8-string
4237 ];
4338 homepage = "http://github.com/NixOS/cabal2nix";
src/Cabal2Nix/Generate.hs−6
@@ -1,5 +1,3 @@
1−{-# LANGUAGE CPP #-}
2−
31module Cabal2Nix.Generate ( cabal2nix, cabal2nix' ) where
42
53import Cabal2Nix.Flags
@@ -23,11 +21,7 @@ cabal2nix flags' cabal = drv { cabalFlags = flags }
2321 flags
2422 (const True)
2523 (Platform X86_64 Linux) -- shouldn't be hardcoded
26−#if MIN_VERSION_Cabal(1,22,0)
2724 (unknownCompilerInfo (CompilerId GHC (Version [7,8,4] [])) NoAbiTag)
28−#else
29− (CompilerId GHC (Version [7,8,4] []))
30−#endif
3125 []
3226 cabal
3327
src/Cabal2Nix/License.hs+1−13
@@ -1,5 +1,3 @@
1−{-# LANGUAGE CPP #-}
2−
31module Cabal2Nix.License ( fromCabalLicense ) where
42
53import Distribution.Nixpkgs.License
@@ -17,23 +15,13 @@ fromCabalLicense (LGPL (Just (Version [3] []))) = Known "stdenv.lib.lice
1715fromCabalLicense (AGPL Nothing) = Unknown (Just "AGPL")
1816fromCabalLicense (AGPL (Just (Version [3] []))) = Known "stdenv.lib.licenses.agpl3"
1917fromCabalLicense (AGPL (Just (Version [3,0] []))) = Known "stdenv.lib.licenses.agpl3"
20−#if MIN_VERSION_Cabal(1,22,0)
2118fromCabalLicense (MPL (Version [2,0] [])) = Known "stdenv.lib.licenses.mpl20"
22−#else
23−fromCabalLicense (UnknownLicense "MPL-2.0") = Known "stdenv.lib.licenses.mpl20"
24−#endif
25−#if MIN_VERSION_Cabal(1,22,0)
26−fromCabalLicense (BSD2) = Known "stdenv.lib.licenses.bsd2"
27−#else
28−fromCabalLicense (UnknownLicense "BSD2") = Known "stdenv.lib.licenses.bsd2"
29−#endif
19+fromCabalLicense BSD2 = Known "stdenv.lib.licenses.bsd2"
3020fromCabalLicense BSD3 = Known "stdenv.lib.licenses.bsd3"
3121fromCabalLicense BSD4 = Unknown (Just "BSD4")
3222fromCabalLicense MIT = Known "stdenv.lib.licenses.mit"
3323fromCabalLicense PublicDomain = Known "stdenv.lib.licenses.publicDomain"
34−#if MIN_VERSION_Cabal(1,22,0)
3524fromCabalLicense UnspecifiedLicense = Known "stdenv.lib.licenses.unfree"
36−#endif
3725fromCabalLicense AllRightsReserved = Known "stdenv.lib.licenses.unfree"
3826fromCabalLicense (Apache Nothing) = Known "stdenv.lib.licenses.asl20"
3927fromCabalLicense (Apache (Just (Version [2,0] []))) = Known "stdenv.lib.licenses.asl20"
src/Distribution/Nixpkgs/Haskell.hs+1−4
@@ -1,4 +1,4 @@
1−{-# LANGUAGE RecordWildCards, DeriveGeneric, StandaloneDeriving, CPP #-}
1+{-# LANGUAGE RecordWildCards, DeriveGeneric, StandaloneDeriving #-}
22{-# OPTIONS_GHC -fno-warn-orphans #-} -- for FlagName below
33
44module Distribution.Nixpkgs.Haskell
@@ -68,9 +68,6 @@ instance Package Derivation where
6868
6969instance NFData Derivation where rnf = genericRnf
7070
71−#if !MIN_VERSION_Cabal(1,22,0)
72−deriving instance Generic FlagName
73−#endif
7471instance NFData FlagName where rnf = genericRnf
7572
7673renderDerivation :: Derivation -> Doc
src/hackage2nix.hs+1−5
@@ -1,4 +1,4 @@
1−{-# LANGUAGE PatternGuards, CPP #-}
1+{-# LANGUAGE PatternGuards #-}
22
33module Main ( main ) where
44
@@ -235,11 +235,7 @@ cabal2nix resolver cabal = (missingDeps, flags, drv)
235235 (configureCabalFlags (package (packageDescription cabal)))
236236 resolver'
237237 (Platform X86_64 Linux) -- shouldn't be hardcoded
238−#if MIN_VERSION_Cabal(1,22,0)
239238 (unknownCompilerInfo (CompilerId GHC (Version [7,10,1] [])) NoAbiTag)
240−#else
241− (CompilerId GHC (Version [7,10,1] []))
242−#endif
243239 [] -- no additional constraints
244240
245241 -- A variant of the cabal file that has all test suites enabled to ensure