git.iko.soy/typeable/cabal2nix
on master help sign in
Merge pull request #397 from qrilka/benchmark-flag
af7cf68Peter Simons
src/Cabal2nix.hs+3
@@ -49,6 +49,7 @@ data Options = Options
49 , optHpack :: Bool
49 , optHpack :: Bool
50 , optDoCheck :: Bool
50 , optDoCheck :: Bool
51 , optJailbreak :: Bool
51 , optJailbreak :: Bool
52+ , optDoBenchmark :: Bool
52 , optRevision :: Maybe String
53 , optRevision :: Maybe String
53 , optHyperlinkSource :: Bool
54 , optHyperlinkSource :: Bool
54 , optEnableLibraryProfiling :: Bool
55 , optEnableLibraryProfiling :: Bool
@@ -76,6 +77,7 @@ options = Options
76 <*> switch (long "hpack" <> help "run hpack before configuring this package (only non-hackage packages)")
77 <*> switch (long "hpack" <> help "run hpack before configuring this package (only non-hackage packages)")
77 <*> flag True False (long "no-check" <> help "don't run regression test suites of this package")
78 <*> flag True False (long "no-check" <> help "don't run regression test suites of this package")
78 <*> switch (long "jailbreak" <> help "disregard version restrictions on build inputs")
79 <*> switch (long "jailbreak" <> help "disregard version restrictions on build inputs")
80+ <*> switch (long "benchmark" <> help "enable benchmarks for this package")
79 <*> optional (strOption $ long "revision" <> help "revision to use when fetching from VCS")
81 <*> optional (strOption $ long "revision" <> help "revision to use when fetching from VCS")
80 <*> flag True False (long "no-hyperlink-source" <> help "don't generate pretty-printed source code for the documentation")
82 <*> flag True False (long "no-hyperlink-source" <> help "don't generate pretty-printed source code for the documentation")
81 <*> switch (long "enable-library-profiling" <> help "enable library profiling in the generated build")
83 <*> switch (long "enable-library-profiling" <> help "enable library profiling in the generated build")
@@ -228,6 +230,7 @@ processPackage Options{..} pkg = do
228 & metaSection.maintainers .~ Set.fromList (map (review ident) optMaintainer)
230 & metaSection.maintainers .~ Set.fromList (map (review ident) optMaintainer)
229-- & metaSection.platforms .~ Set.fromList optPlatform
231-- & metaSection.platforms .~ Set.fromList optPlatform
230 & doCheck &&~ optDoCheck
232 & doCheck &&~ optDoCheck
233+ & doBenchmark ||~ optDoBenchmark
231 & extraFunctionArgs %~ Set.union (Set.fromList ("inherit stdenv":map (fromString . ("inherit " ++)) optExtraArgs))
234 & extraFunctionArgs %~ Set.union (Set.fromList ("inherit stdenv":map (fromString . ("inherit " ++)) optExtraArgs))
232
235
233 shell :: Doc
236 shell :: Doc
src/Distribution/Nixpkgs/Haskell/Derivation.hs+4−1
@@ -7,7 +7,7 @@
7module Distribution.Nixpkgs.Haskell.Derivation
7module Distribution.Nixpkgs.Haskell.Derivation
8 ( Derivation, nullDerivation, pkgid, revision, src, subpath, isLibrary, isExecutable
8 ( Derivation, nullDerivation, pkgid, revision, src, subpath, isLibrary, isExecutable
9 , extraFunctionArgs, libraryDepends, executableDepends, testDepends, configureFlags
9 , extraFunctionArgs, libraryDepends, executableDepends, testDepends, configureFlags
10− , cabalFlags, runHaddock, jailbreak, doCheck, testTarget, hyperlinkSource, enableSplitObjs
10+ , cabalFlags, runHaddock, jailbreak, doCheck, doBenchmark, testTarget, hyperlinkSource, enableSplitObjs
11 , enableLibraryProfiling, enableExecutableProfiling, phaseOverrides, editedCabalFile, metaSection
11 , enableLibraryProfiling, enableExecutableProfiling, phaseOverrides, editedCabalFile, metaSection
12 , dependencies, setupDepends, benchmarkDepends, enableSeparateDataOutput
12 , dependencies, setupDepends, benchmarkDepends, enableSeparateDataOutput
13 )
13 )
@@ -55,6 +55,7 @@ data Derivation = MkDerivation
55 , _runHaddock :: Bool
55 , _runHaddock :: Bool
56 , _jailbreak :: Bool
56 , _jailbreak :: Bool
57 , _doCheck :: Bool
57 , _doCheck :: Bool
58+ , _doBenchmark :: Bool
58 , _testTarget :: String
59 , _testTarget :: String
59 , _hyperlinkSource :: Bool
60 , _hyperlinkSource :: Bool
60 , _enableLibraryProfiling :: Bool
61 , _enableLibraryProfiling :: Bool
@@ -86,6 +87,7 @@ nullDerivation = MkDerivation
86 , _runHaddock = error "undefined Derivation.runHaddock"
87 , _runHaddock = error "undefined Derivation.runHaddock"
87 , _jailbreak = error "undefined Derivation.jailbreak"
88 , _jailbreak = error "undefined Derivation.jailbreak"
88 , _doCheck = error "undefined Derivation.doCheck"
89 , _doCheck = error "undefined Derivation.doCheck"
90+ , _doBenchmark = error "undefined Derivation.doBenchmark"
89 , _testTarget = error "undefined Derivation.testTarget"
91 , _testTarget = error "undefined Derivation.testTarget"
90 , _hyperlinkSource = error "undefined Derivation.hyperlinkSource"
92 , _hyperlinkSource = error "undefined Derivation.hyperlinkSource"
91 , _enableLibraryProfiling = error "undefined Derivation.enableLibraryProfiling"
93 , _enableLibraryProfiling = error "undefined Derivation.enableLibraryProfiling"
@@ -131,6 +133,7 @@ instance Pretty Derivation where
131 , boolattr "doHaddock" (not _runHaddock) _runHaddock
133 , boolattr "doHaddock" (not _runHaddock) _runHaddock
132 , boolattr "jailbreak" _jailbreak _jailbreak
134 , boolattr "jailbreak" _jailbreak _jailbreak
133 , boolattr "doCheck" (not _doCheck) _doCheck
135 , boolattr "doCheck" (not _doCheck) _doCheck
136+ , boolattr "doBenchmark" _doBenchmark _doBenchmark
134 , onlyIf (not (null _testTarget)) $ attr "testTarget" $ string _testTarget
137 , onlyIf (not (null _testTarget)) $ attr "testTarget" $ string _testTarget
135 , boolattr "hyperlinkSource" (not _hyperlinkSource) _hyperlinkSource
138 , boolattr "hyperlinkSource" (not _hyperlinkSource) _hyperlinkSource
136 , onlyIf (not (null _phaseOverrides)) $ vcat ((map text . lines) _phaseOverrides)
139 , 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
91 & runHaddock .~ doHaddockPhase
91 & runHaddock .~ doHaddockPhase
92 & jailbreak .~ False
92 & jailbreak .~ False
93 & doCheck .~ True
93 & doCheck .~ True
94+ & doBenchmark .~ False
94 & testTarget .~ mempty
95 & testTarget .~ mempty
95 & hyperlinkSource .~ True
96 & hyperlinkSource .~ True
96 & enableSplitObjs .~ True
97 & enableSplitObjs .~ True