@@ -1,5 +1,8 @@
1−module Cli where
1+{-# LANGUAGE TemplateHaskell #-}
3+module Runner.Cli where
3import Data.Monoid ( (<>) )
6import Data.Monoid ( (<>) )
4import Data.Text as T
7import Data.Text as T
5import qualified Distribution.Compat.ReadP as P
8import qualified Distribution.Compat.ReadP as P
@@ -7,25 +10,37 @@ import Distribution.Compiler as Compiler
7import Distribution.Nixpkgs.Haskell.Stack
10import Distribution.Nixpkgs.Haskell.Stack
8import Distribution.System as System
11import Distribution.System as System
9import qualified Distribution.Text as Text
12import qualified Distribution.Text as Text
10−import Options.Applicative
13+import Options.Applicative as Opts
11import Stack.Config
14import Stack.Config
12import Stack.Types
15import Stack.Types
18+newtype StackagePackages = StackagePackages { fromStackagePackages :: FilePath }
21+makePrisms ''StackagePackages
23+newtype StackageConfig = StackageConfig { fromStackageConfig :: FilePath }
26+makePrisms ''StackageConfig
15data Options = Options
28data Options = Options
16− { optStackResolver :: Maybe StackResolver
17− , optHackageDb :: Maybe HackageDb
29+ { _optHackageDb :: Maybe HackageDb
18− , optFlags :: [CabalFlag]
30+ , _optStackagePackages :: StackagePackages
31+ , _optStackageConfig :: StackageConfig
19− , optCompilerId :: CompilerId
32+ , _optCompilerId :: CompilerId
20− , optPlatform :: Platform
33+ , _optPlatform :: Platform
21− , optStackYaml :: FilePath
34+ , _optStackYaml :: FilePath
22 } deriving (Show)
35 } deriving (Show)
24options :: Parser Options
39options :: Parser Options
25options = Options
40options = Options
26− <$> optional stackResolver
27− <*> optional hackageDb
41+ <$> optional hackageDb
28− <*> many cabalFlag
42+ <*> stackagePackages
29 <*> compilerId
44 <*> compilerId
30 <*> platform
45 <*> platform
31 <*> stackYamlArg
46 <*> stackYamlArg
@@ -44,8 +59,22 @@ stackResolver = StackResolver <$>
44 <> metavar "RESOLVER"
59 <> metavar "RESOLVER"
45 <> help "override stack resolver" )
60 <> help "override stack resolver" )
62+stackagePackages :: Parser StackagePackages
63+stackagePackages = StackagePackages <$>
65+ ( long "nix-stackage-packages"
66+ <> metavar "STACKAGE_PACKAGES"
67+ <> help "path to packages file generated by 'stackage2nix'" )
69+stackageConfig :: Parser StackageConfig
70+stackageConfig = StackageConfig <$>
72+ ( long "nix-stackage-config"
73+ <> metavar "STACKAGE_CONFIG"
74+ <> help "path to packages config file generated by 'stackage2nix'" )
47stackYamlArg :: Parser FilePath
76stackYamlArg :: Parser FilePath
48−stackYamlArg = argument str
77+stackYamlArg = Opts.argument str
49 ( metavar "STACK_YAML"
78 ( metavar "STACK_YAML"
50 <> value "stack.yaml" )
79 <> value "stack.yaml" )