git.iko.soy/typeable/cabal2nix
on master help sign in
cabal2nix: add --extra-arguments flag
commit80ddd3e0751a5175ae90f6403116036f51054313 authorPeter Simons <simons@cryp.to> dateMon 7 Sep 2015, 14:14 (11 years ago) parentf874e9d
1 file changed+3−1
cabal2nix/src/Main.hs+3−1
cabal2nix/src/Main.hs+3−1
@@ -36,6 +36,7 @@ data Options = Options
3636 , optEnableLibraryProfiling :: Bool
3737 , optEnableExecutableProfiling :: Bool
3838 , optEnableProfiling :: Maybe Bool
39+ , optExtraArgs :: [String]
3940 , optHackageDb :: Maybe FilePath
4041 , optNixShellOutput :: Bool
4142 , optFlags :: [String]
@@ -56,6 +57,7 @@ options = Options
5657 <*> switch (long "enable-library-profiling" <> help "enable library profiling in the generated build")
5758 <*> switch (long "enable-executable-profiling" <> help "enable executable profiling in the generated build")
5859 <*> optional (switch (long "enable-profiling" <> help "enable both library and executable profiling in the generated build"))
60+ <*> many (strOption $ long "extra-arguments" <> help "extra parameters required for the function body")
5961 <*> optional (strOption $ long "hackage-db" <> metavar "PATH" <> help "path to the local hackage db in tar format")
6062 <*> switch (long "shell" <> help "generate output suitable for nix-shell")
6163 <*> many (strOption $ short 'f' <> long "flag" <> help "Cabal flag (may be specified multiple times)")
@@ -111,7 +113,7 @@ main = bracket (return ()) (\() -> hFlush stdout >> hFlush stderr) $ \() -> do
111113 & metaSection.maintainers .~ Set.fromList (map (review ident) optMaintainer)
112114-- & metaSection.platforms .~ Set.fromList optPlatform
113115 & doCheck &&~ optDoCheck
114− & extraFunctionArgs . contains "stdenv" .~ True
116+ & extraFunctionArgs %~ (Set.union (Set.fromList ("stdenv":(map (review ident) optExtraArgs))))
115117
116118 shell :: Doc
117119 shell = vcat