git.iko.soy/typeable/cabal2nix
on master help sign in
Merge pull request #397 from qrilka/benchmark-flag

add benchmark enabling flag

commitaf7cf68dfc6fa94d4bdb6c5db7a0d8cb430654fd authorPeter Simons <simons@cryp.to> dateMon 17 Dec 2018, 17:12 (8 years ago) parent89ccf0891ede5d
3 files changed+8−1
src/Cabal2nix.hs+3 src/Distribution/Nixpkgs/Haskell/Derivation.hs+4−1 src/Distribution/Nixpkgs/Haskell/FromCabal.hs+1
src/Cabal2nix.hs+3
@@ -49,6 +49,7 @@ data Options = Options
4949 , optHpack :: Bool
5050 , optDoCheck :: Bool
5151 , optJailbreak :: Bool
52+ , optDoBenchmark :: Bool
5253 , optRevision :: Maybe String
5354 , optHyperlinkSource :: Bool
5455 , optEnableLibraryProfiling :: Bool
@@ -76,6 +77,7 @@ options = Options
7677 <*> switch (long "hpack" <> help "run hpack before configuring this package (only non-hackage packages)")
7778 <*> flag True False (long "no-check" <> help "don't run regression test suites of this package")
7879 <*> switch (long "jailbreak" <> help "disregard version restrictions on build inputs")
80+ <*> switch (long "benchmark" <> help "enable benchmarks for this package")
7981 <*> optional (strOption $ long "revision" <> help "revision to use when fetching from VCS")
8082 <*> flag True False (long "no-hyperlink-source" <> help "don't generate pretty-printed source code for the documentation")
8183 <*> switch (long "enable-library-profiling" <> help "enable library profiling in the generated build")
@@ -228,6 +230,7 @@ processPackage Options{..} pkg = do
228230 & metaSection.maintainers .~ Set.fromList (map (review ident) optMaintainer)
229231-- & metaSection.platforms .~ Set.fromList optPlatform
230232 & doCheck &&~ optDoCheck
233+ & doBenchmark ||~ optDoBenchmark
231234 & extraFunctionArgs %~ Set.union (Set.fromList ("inherit stdenv":map (fromString . ("inherit " ++)) optExtraArgs))
232235
233236 shell :: Doc
src/Distribution/Nixpkgs/Haskell/Derivation.hs+4−1
@@ -7,7 +7,7 @@
77module Distribution.Nixpkgs.Haskell.Derivation
88 ( Derivation, nullDerivation, pkgid, revision, src, subpath, isLibrary, isExecutable
99 , extraFunctionArgs, libraryDepends, executableDepends, testDepends, configureFlags
10− , cabalFlags, runHaddock, jailbreak, doCheck, testTarget, hyperlinkSource, enableSplitObjs
10+ , cabalFlags, runHaddock, jailbreak, doCheck, doBenchmark, testTarget, hyperlinkSource, enableSplitObjs
1111 , enableLibraryProfiling, enableExecutableProfiling, phaseOverrides, editedCabalFile, metaSection
1212 , dependencies, setupDepends, benchmarkDepends, enableSeparateDataOutput
1313 )
@@ -55,6 +55,7 @@ data Derivation = MkDerivation
5555 , _runHaddock :: Bool
5656 , _jailbreak :: Bool
5757 , _doCheck :: Bool
58+ , _doBenchmark :: Bool
5859 , _testTarget :: String
5960 , _hyperlinkSource :: Bool
6061 , _enableLibraryProfiling :: Bool
@@ -86,6 +87,7 @@ nullDerivation = MkDerivation
8687 , _runHaddock = error "undefined Derivation.runHaddock"
8788 , _jailbreak = error "undefined Derivation.jailbreak"
8889 , _doCheck = error "undefined Derivation.doCheck"
90+ , _doBenchmark = error "undefined Derivation.doBenchmark"
8991 , _testTarget = error "undefined Derivation.testTarget"
9092 , _hyperlinkSource = error "undefined Derivation.hyperlinkSource"
9193 , _enableLibraryProfiling = error "undefined Derivation.enableLibraryProfiling"
@@ -131,6 +133,7 @@ instance Pretty Derivation where
131133 , boolattr "doHaddock" (not _runHaddock) _runHaddock
132134 , boolattr "jailbreak" _jailbreak _jailbreak
133135 , boolattr "doCheck" (not _doCheck) _doCheck
136+ , boolattr "doBenchmark" _doBenchmark _doBenchmark
134137 , onlyIf (not (null _testTarget)) $ attr "testTarget" $ string _testTarget
135138 , boolattr "hyperlinkSource" (not _hyperlinkSource) _hyperlinkSource
136139 , onlyIf (not (null _phaseOverrides)) $ vcat ((map text . lines) _phaseOverrides)
src/Distribution/Nixpkgs/Haskell/FromCabal.hs+1
@@ -91,6 +91,7 @@ fromPackageDescription haskellResolver nixpkgsResolver missingDeps flags Package
9191 & runHaddock .~ doHaddockPhase
9292 & jailbreak .~ False
9393 & doCheck .~ True
94+ & doBenchmark .~ False
9495 & testTarget .~ mempty
9596 & hyperlinkSource .~ True
9697 & enableSplitObjs .~ True