git.iko.soy/typeable/stackage2nix
on master help sign in
Show default values of cli options
commitc2c5d44c9e5024bc287ba0a9c214bdae6667f424 authorDmitry Bushev <bushevdv@gmail.com> dateThu 15 Jun 2017, 23:48 (9 years ago) parent6230243
2 files changed+17−16
src/Runner.hs+10−12 src/Runner/Cli.hs+7−4
src/Runner.hs+10−12
@@ -16,18 +16,8 @@ run :: IO ()
1616run = do
1717 opts <- execParser pinfo
1818 stackYaml <- either fail pure =<< readStackConfig (opts ^. optStackYaml)
19−
2019 -- generate stackage packages
21− let
22− s2nOptions = S2n.Options
23− { S2n.optBuildPlanFile = opts ^. optStackageBuildPlan
24− , S2n.optAllCabalHashes = opts ^. optAllCabalHashes
25− , S2n.optNixpkgsRepository = opts ^. optNixpkgsRepository
26− , S2n.optNixpkgsMap = Nothing
27− , S2n.optOutPackages = opts ^. optStackageOutPackages
28− , S2n.optOutConfig = opts ^. optStackageOutConfig }
29− buildPlan <- S2n.run s2nOptions
30−
20+ buildPlan <- S2n.run $ mkS2nOptions opts
3121 -- generate haskell packages override
3222 let
3323 pkgConfig = mkPackageConfig (opts ^. optPlatform) (opts ^. optCompilerId)
@@ -36,7 +26,6 @@ run = do
3626 $ stackYaml ^. scPackages
3727 let
3828 out = PP.overrideHaskellPackages overrideConfig packages
39−
4029 writeFile (opts ^. optOutFile) (show out)
4130 putStrLn $ "\nDerivation was written to " ++ opts ^. optOutFile
4231
@@ -45,3 +34,12 @@ mkOverrideConfig opts ghcVersion = OverrideConfig
4534 { _ocGhc = ghcVersion
4635 , _ocStackagePackages = opts ^. optStackageOutPackages
4736 , _ocStackageConfig = opts ^. optStackageOutConfig }
37+
38+mkS2nOptions :: Options -> S2n.Options
39+mkS2nOptions opts = S2n.Options
40+ { S2n.optBuildPlanFile = opts ^. optStackageBuildPlan
41+ , S2n.optAllCabalHashes = opts ^. optAllCabalHashes
42+ , S2n.optNixpkgsRepository = opts ^. optNixpkgsRepository
43+ , S2n.optNixpkgsMap = Nothing
44+ , S2n.optOutPackages = opts ^. optStackageOutPackages
45+ , S2n.optOutConfig = opts ^. optStackageOutConfig }
src/Runner/Cli.hs+7−4
@@ -54,8 +54,9 @@ outFile :: Parser FilePath
5454outFile = option str
5555 ( long "nix-out-file"
5656 <> metavar "NIX_OUT_FILE"
57− <> help "path where to write output derivation"
58− <> value "default.nix" )
57+ <> help "path to output derivation"
58+ <> value "default.nix"
59+ <> showDefaultWith id )
5960
6061nixpkgsRepository :: Parser FilePath
6162nixpkgsRepository = option str
@@ -89,14 +90,16 @@ stackageOutPackages = option str
8990 ( long "nix-stackage-packages"
9091 <> metavar "STACKAGE_PACKAGES"
9192 <> help "name of the output file for the package set"
92− <> value "configuration-packages.nix" )
93+ <> value "configuration-packages.nix"
94+ <> showDefaultWith id)
9395
9496stackageOutConfig :: Parser FilePath
9597stackageOutConfig = option str
9698 ( long "nix-stackage-config"
9799 <> metavar "STACKAGE_CONFIG"
98100 <> help "name of the output file for the package set configuration"
99− <> value "packages.nix" )
101+ <> value "packages.nix"
102+ <> showDefaultWith id)
100103
101104stackYamlArg :: Parser FilePath
102105stackYamlArg = Opts.argument str