forked from commercialhaskell/stack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfig.hs
More file actions
2122 lines (1890 loc) · 80.9 KB
/
Config.hs
File metadata and controls
2122 lines (1890 loc) · 80.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ViewPatterns #-}
-- | The Config type.
module Stack.Types.Config
(
-- * Main configuration types and classes
-- ** HasPlatform & HasStackRoot
HasPlatform(..)
,PlatformVariant(..)
-- ** Runner
,HasRunner(..)
,Runner(..)
,ColorWhen(..)
,terminalL
,reExecL
-- ** Config & HasConfig
,Config(..)
,HasConfig(..)
,askLatestSnapshotUrl
,configProjectRoot
-- ** BuildConfig & HasBuildConfig
,BuildConfig(..)
,ProjectPackage(..)
,DepPackage(..)
,ppRoot
,ppVersion
,ppComponents
,ppGPD
,stackYamlL
,projectRootL
,HasBuildConfig(..)
-- ** Storage databases
,UserStorage(..)
,ProjectStorage(..)
-- ** GHCVariant & HasGHCVariant
,GHCVariant(..)
,ghcVariantName
,ghcVariantSuffix
,parseGHCVariant
,HasGHCVariant(..)
,snapshotsDir
-- ** EnvConfig & HasEnvConfig
,EnvConfig(..)
,HasSourceMap(..)
,HasEnvConfig(..)
,getCompilerPath
-- * Details
-- ** ApplyGhcOptions
,ApplyGhcOptions(..)
-- ** CabalConfigKey
,CabalConfigKey(..)
-- ** ConfigException
,HpackExecutable(..)
,ConfigException(..)
-- ** ConfigMonoid
,ConfigMonoid(..)
,configMonoidInstallGHCName
,configMonoidSystemGHCName
,parseConfigMonoid
-- ** DumpLogs
,DumpLogs(..)
-- ** EnvSettings
,EnvSettings(..)
,minimalEnvSettings
,defaultEnvSettings
,plainEnvSettings
-- ** GlobalOpts & GlobalOptsMonoid
,GlobalOpts(..)
,GlobalOptsMonoid(..)
,StackYamlLoc(..)
,stackYamlLocL
,LockFileBehavior(..)
,readLockFileBehavior
,lockFileBehaviorL
,defaultLogLevel
-- ** Project & ProjectAndConfigMonoid
,Project(..)
,ProjectConfig(..)
,Curator(..)
,ProjectAndConfigMonoid(..)
,parseProjectAndConfigMonoid
-- ** PvpBounds
,PvpBounds(..)
,PvpBoundsType(..)
,parsePvpBounds
-- ** ColorWhen
,readColorWhen
-- ** Styles
,readStyles
-- ** SCM
,SCM(..)
-- * Paths
,bindirSuffix
,GlobalInfoSource(..)
,getProjectWorkDir
,docDirSuffix
,extraBinDirs
,hpcReportDir
,installationRootDeps
,installationRootLocal
,bindirCompilerTools
,hoogleRoot
,hoogleDatabasePath
,packageDatabaseDeps
,packageDatabaseExtra
,packageDatabaseLocal
,platformOnlyRelDir
,platformGhcRelDir
,platformGhcVerOnlyRelDir
,useShaPathOnWindows
,shaPath
,shaPathForBytes
,workDirL
-- * Command-specific types
-- ** Eval
,EvalOpts(..)
-- ** Exec
,ExecOpts(..)
,SpecialExecCmd(..)
,ExecOptsExtra(..)
-- ** Setup
,DownloadInfo(..)
,VersionedDownloadInfo(..)
,GHCDownloadInfo(..)
,SetupInfo(..)
-- ** Docker entrypoint
,DockerEntrypoint(..)
,DockerUser(..)
,module X
-- * Lens helpers
,wantedCompilerVersionL
,actualCompilerVersionL
,HasCompiler(..)
,DumpPackage(..)
,CompilerPaths(..)
,GhcPkgExe(..)
,getGhcPkgExe
,cpWhich
,ExtraDirs(..)
,buildOptsL
,globalOptsL
,buildOptsInstallExesL
,buildOptsMonoidHaddockL
,buildOptsMonoidTestsL
,buildOptsMonoidBenchmarksL
,buildOptsMonoidInstallExesL
,buildOptsHaddockL
,globalOptsBuildOptsMonoidL
,stackRootL
,cabalVersionL
,whichCompilerL
,envOverrideSettingsL
,shouldForceGhcColorFlag
,appropriateGhcColorFlag
-- * Helper logging functions
,prettyStackDevL
-- * Lens reexport
,view
,to
) where
import Control.Monad.Writer (tell)
import Crypto.Hash (hashWith, SHA1(..))
import Stack.Prelude
import Pantry.Internal.AesonExtended
(ToJSON, toJSON, FromJSON, FromJSONKey (..), parseJSON, withText, object,
(.=), (..:), (...:), (..:?), (..!=), Value(Bool),
withObjectWarnings, WarningParser, Object, jsonSubWarnings,
jsonSubWarningsT, jsonSubWarningsTT, WithJSONWarnings(..),
FromJSONKeyFunction (FromJSONKeyTextParser))
import Data.Attoparsec.Args (parseArgs, EscapingMode (Escaping))
import qualified Data.ByteArray.Encoding as Mem (convertToBase, Base(Base16))
import qualified Data.ByteString.Char8 as S8
import Data.Coerce (coerce)
import Data.List (stripPrefix)
import qualified Data.List.NonEmpty as NonEmpty
import qualified Data.Map as Map
import qualified Data.Map.Strict as M
import qualified Data.Monoid as Monoid
import Data.Monoid.Map (MonoidMap(..))
import qualified Data.Set as Set
import qualified Data.Text as T
import Data.Yaml (ParseException)
import qualified Data.Yaml as Yaml
import qualified Distribution.License as C
import Distribution.ModuleName (ModuleName)
import Distribution.PackageDescription (GenericPackageDescription)
import qualified Distribution.PackageDescription as C
import Distribution.System (Platform, Arch)
import qualified Distribution.Text
import qualified Distribution.Types.UnqualComponentName as C
import Distribution.Version (anyVersion, mkVersion', mkVersion)
import Generics.Deriving.Monoid (memptydefault, mappenddefault)
import Lens.Micro
import Options.Applicative (ReadM)
import qualified Options.Applicative as OA
import qualified Options.Applicative.Types as OA
import Pantry.Internal (Storage)
import Path
import qualified Paths_stack as Meta
import qualified RIO.List as List
import RIO.PrettyPrint (HasTerm (..), StyleDoc, prettyWarnL, prettyDebugL)
import RIO.PrettyPrint.StylesUpdate (StylesUpdate,
parseStylesUpdateFromString, HasStylesUpdate (..))
import Stack.Constants
import Stack.Types.Compiler
import Stack.Types.CompilerBuild
import Stack.Types.Docker
import Stack.Types.GhcPkgId
import Stack.Types.NamedComponent
import Stack.Types.Nix
import Stack.Types.Resolver
import Stack.Types.SourceMap
import Stack.Types.TemplateName
import Stack.Types.Version
import qualified System.FilePath as FilePath
import System.PosixCompat.Types (UserID, GroupID, FileMode)
import RIO.Process (ProcessContext, HasProcessContext (..))
import Casa.Client (CasaRepoPrefix)
-- Re-exports
import Stack.Types.Config.Build as X
-- | The base environment that almost everything in Stack runs in,
-- based off of parsing command line options in 'GlobalOpts'. Provides
-- logging and process execution.
data Runner = Runner
{ runnerGlobalOpts :: !GlobalOpts
, runnerUseColor :: !Bool
, runnerLogFunc :: !LogFunc
, runnerTermWidth :: !Int
, runnerProcessContext :: !ProcessContext
}
data ColorWhen = ColorNever | ColorAlways | ColorAuto
deriving (Eq, Show, Generic)
instance FromJSON ColorWhen where
parseJSON v = do
s <- parseJSON v
case s of
"never" -> return ColorNever
"always" -> return ColorAlways
"auto" -> return ColorAuto
_ -> fail ("Unknown color use: " <> s <> ". Expected values of " <>
"option are 'never', 'always', or 'auto'.")
-- | The top-level Stackage configuration.
data Config =
Config {configWorkDir :: !(Path Rel Dir)
-- ^ this allows to override .stack-work directory
,configUserConfigPath :: !(Path Abs File)
-- ^ Path to user configuration file (usually ~/.stack/config.yaml)
,configBuild :: !BuildOpts
-- ^ Build configuration
,configDocker :: !DockerOpts
-- ^ Docker configuration
,configNix :: !NixOpts
-- ^ Execution environment (e.g nix-shell) configuration
,configProcessContextSettings :: !(EnvSettings -> IO ProcessContext)
-- ^ Environment variables to be passed to external tools
,configLocalProgramsBase :: !(Path Abs Dir)
-- ^ Non-platform-specific path containing local installations
,configLocalPrograms :: !(Path Abs Dir)
-- ^ Path containing local installations (mainly GHC)
,configHideTHLoading :: !Bool
-- ^ Hide the Template Haskell "Loading package ..." messages from the
-- console
,configPrefixTimestamps :: !Bool
-- ^ Prefix build output with timestamps for each line.
,configPlatform :: !Platform
-- ^ The platform we're building for, used in many directory names
,configPlatformVariant :: !PlatformVariant
-- ^ Variant of the platform, also used in directory names
,configGHCVariant :: !(Maybe GHCVariant)
-- ^ The variant of GHC requested by the user.
,configGHCBuild :: !(Maybe CompilerBuild)
-- ^ Override build of the compiler distribution (e.g. standard, gmp4, tinfo6)
,configLatestSnapshot :: !Text
-- ^ URL of a JSON file providing the latest LTS and Nightly snapshots.
,configSystemGHC :: !Bool
-- ^ Should we use the system-installed GHC (on the PATH) if
-- available? Can be overridden by command line options.
,configInstallGHC :: !Bool
-- ^ Should we automatically install GHC if missing or the wrong
-- version is available? Can be overridden by command line options.
,configSkipGHCCheck :: !Bool
-- ^ Don't bother checking the GHC version or architecture.
,configSkipMsys :: !Bool
-- ^ On Windows: don't use a sandboxed MSYS
,configCompilerCheck :: !VersionCheck
-- ^ Specifies which versions of the compiler are acceptable.
,configCompilerRepository :: !CompilerRepository
-- ^ Specifies the repository containing the compiler sources
,configLocalBin :: !(Path Abs Dir)
-- ^ Directory we should install executables into
,configRequireStackVersion :: !VersionRange
-- ^ Require a version of stack within this range.
,configJobs :: !Int
-- ^ How many concurrent jobs to run, defaults to number of capabilities
,configOverrideGccPath :: !(Maybe (Path Abs File))
-- ^ Optional gcc override path
,configExtraIncludeDirs :: ![FilePath]
-- ^ --extra-include-dirs arguments
,configExtraLibDirs :: ![FilePath]
-- ^ --extra-lib-dirs arguments
,configConcurrentTests :: !Bool
-- ^ Run test suites concurrently
,configTemplateParams :: !(Map Text Text)
-- ^ Parameters for templates.
,configScmInit :: !(Maybe SCM)
-- ^ Initialize SCM (e.g. git) when creating new projects.
,configGhcOptionsByName :: !(Map PackageName [Text])
-- ^ Additional GHC options to apply to specific packages.
,configGhcOptionsByCat :: !(Map ApplyGhcOptions [Text])
-- ^ Additional GHC options to apply to categories of packages
,configCabalConfigOpts :: !(Map CabalConfigKey [Text])
-- ^ Additional options to be passed to ./Setup.hs configure
,configSetupInfoLocations :: ![String]
-- ^ URLs or paths to stack-setup.yaml files, for finding tools.
-- If none present, the default setup-info is used.
,configSetupInfoInline :: !SetupInfo
-- ^ Additional SetupInfo to use to find tools.
,configPvpBounds :: !PvpBounds
-- ^ How PVP upper bounds should be added to packages
,configModifyCodePage :: !Bool
-- ^ Force the code page to UTF-8 on Windows
,configRebuildGhcOptions :: !Bool
-- ^ Rebuild on GHC options changes
,configApplyGhcOptions :: !ApplyGhcOptions
-- ^ Which packages to ghc-options on the command line apply to?
,configAllowNewer :: !Bool
-- ^ Ignore version ranges in .cabal files. Funny naming chosen to
-- match cabal.
,configDefaultTemplate :: !(Maybe TemplateName)
-- ^ The default template to use when none is specified.
-- (If Nothing, the default default is used.)
,configAllowDifferentUser :: !Bool
-- ^ Allow users other than the stack root owner to use the stack
-- installation.
,configDumpLogs :: !DumpLogs
-- ^ Dump logs of local non-dependencies when doing a build.
,configProject :: !(ProjectConfig (Project, Path Abs File))
-- ^ Project information and stack.yaml file location
,configAllowLocals :: !Bool
-- ^ Are we allowed to build local packages? The script
-- command disallows this.
,configSaveHackageCreds :: !Bool
-- ^ Should we save Hackage credentials to a file?
,configHackageBaseUrl :: !Text
-- ^ Hackage base URL used when uploading packages
,configRunner :: !Runner
,configPantryConfig :: !PantryConfig
,configStackRoot :: !(Path Abs Dir)
,configResolver :: !(Maybe AbstractResolver)
-- ^ Any resolver override from the command line
,configUserStorage :: !UserStorage
-- ^ Database connection pool for user Stack database
,configHideSourcePaths :: !Bool
-- ^ Enable GHC hiding source paths?
,configRecommendUpgrade :: !Bool
-- ^ Recommend a Stack upgrade?
,configStackDeveloperMode :: !Bool
-- ^ Turn on Stack developer mode for additional messages?
}
-- | A bit of type safety to ensure we're talking to the right database.
newtype UserStorage = UserStorage
{ unUserStorage :: Storage
}
-- | A bit of type safety to ensure we're talking to the right database.
newtype ProjectStorage = ProjectStorage
{ unProjectStorage :: Storage
}
-- | The project root directory, if in a project.
configProjectRoot :: Config -> Maybe (Path Abs Dir)
configProjectRoot c =
case configProject c of
PCProject (_, fp) -> Just $ parent fp
PCGlobalProject -> Nothing
PCNoProject _deps -> Nothing
-- | Which packages do configure opts apply to?
data CabalConfigKey
= CCKTargets -- ^ See AGOTargets
| CCKLocals -- ^ See AGOLocals
| CCKEverything -- ^ See AGOEverything
| CCKPackage !PackageName -- ^ A specific package
deriving (Show, Read, Eq, Ord)
instance FromJSON CabalConfigKey where
parseJSON = withText "CabalConfigKey" parseCabalConfigKey
instance FromJSONKey CabalConfigKey where
fromJSONKey = FromJSONKeyTextParser parseCabalConfigKey
parseCabalConfigKey :: (Monad m, MonadFail m) => Text -> m CabalConfigKey
parseCabalConfigKey "$targets" = pure CCKTargets
parseCabalConfigKey "$locals" = pure CCKLocals
parseCabalConfigKey "$everything" = pure CCKEverything
parseCabalConfigKey name =
case parsePackageName $ T.unpack name of
Nothing -> fail $ "Invalid CabalConfigKey: " ++ show name
Just x -> pure $ CCKPackage x
-- | Which packages do ghc-options on the command line apply to?
data ApplyGhcOptions = AGOTargets -- ^ all local targets
| AGOLocals -- ^ all local packages, even non-targets
| AGOEverything -- ^ every package
deriving (Show, Read, Eq, Ord, Enum, Bounded)
instance FromJSON ApplyGhcOptions where
parseJSON = withText "ApplyGhcOptions" $ \t ->
case t of
"targets" -> return AGOTargets
"locals" -> return AGOLocals
"everything" -> return AGOEverything
_ -> fail $ "Invalid ApplyGhcOptions: " ++ show t
-- | Which build log files to dump
data DumpLogs
= DumpNoLogs -- ^ don't dump any logfiles
| DumpWarningLogs -- ^ dump logfiles containing warnings
| DumpAllLogs -- ^ dump all logfiles
deriving (Show, Read, Eq, Ord, Enum, Bounded)
instance FromJSON DumpLogs where
parseJSON (Bool True) = return DumpAllLogs
parseJSON (Bool False) = return DumpNoLogs
parseJSON v =
withText
"DumpLogs"
(\t ->
if | t == "none" -> return DumpNoLogs
| t == "warning" -> return DumpWarningLogs
| t == "all" -> return DumpAllLogs
| otherwise -> fail ("Invalid DumpLogs: " ++ show t))
v
-- | Controls which version of the environment is used
data EnvSettings = EnvSettings
{ esIncludeLocals :: !Bool
-- ^ include local project bin directory, GHC_PACKAGE_PATH, etc
, esIncludeGhcPackagePath :: !Bool
-- ^ include the GHC_PACKAGE_PATH variable
, esStackExe :: !Bool
-- ^ set the STACK_EXE variable to the current executable name
, esLocaleUtf8 :: !Bool
-- ^ set the locale to C.UTF-8
, esKeepGhcRts :: !Bool
-- ^ if True, keep GHCRTS variable in environment
}
deriving (Show, Eq, Ord)
data ExecOpts = ExecOpts
{ eoCmd :: !SpecialExecCmd
, eoArgs :: ![String]
, eoExtra :: !ExecOptsExtra
} deriving (Show)
data SpecialExecCmd
= ExecCmd String
| ExecRun
| ExecGhc
| ExecRunGhc
deriving (Show, Eq)
data ExecOptsExtra = ExecOptsExtra
{ eoEnvSettings :: !EnvSettings
, eoPackages :: ![String]
, eoRtsOptions :: ![String]
, eoCwd :: !(Maybe FilePath)
}
deriving (Show)
data EvalOpts = EvalOpts
{ evalArg :: !String
, evalExtra :: !ExecOptsExtra
} deriving (Show)
-- | Parsed global command-line options.
data GlobalOpts = GlobalOpts
{ globalReExecVersion :: !(Maybe String) -- ^ Expected re-exec in container version
, globalDockerEntrypoint :: !(Maybe DockerEntrypoint)
-- ^ Data used when stack is acting as a Docker entrypoint (internal use only)
, globalLogLevel :: !LogLevel -- ^ Log level
, globalTimeInLog :: !Bool -- ^ Whether to include timings in logs.
, globalConfigMonoid :: !ConfigMonoid -- ^ Config monoid, for passing into 'loadConfig'
, globalResolver :: !(Maybe AbstractResolver) -- ^ Resolver override
, globalCompiler :: !(Maybe WantedCompiler) -- ^ Compiler override
, globalTerminal :: !Bool -- ^ We're in a terminal?
, globalStylesUpdate :: !StylesUpdate -- ^ SGR (Ansi) codes for styles
, globalTermWidth :: !(Maybe Int) -- ^ Terminal width override
, globalStackYaml :: !StackYamlLoc -- ^ Override project stack.yaml
, globalLockFileBehavior :: !LockFileBehavior
} deriving (Show)
-- | Location for the project's stack.yaml file.
data StackYamlLoc
= SYLDefault
-- ^ Use the standard parent-directory-checking logic
| SYLOverride !(Path Abs File)
-- ^ Use a specific stack.yaml file provided
| SYLNoProject ![PackageIdentifierRevision]
-- ^ Do not load up a project, just user configuration. Include
-- the given extra dependencies with the resolver.
| SYLGlobalProject
-- ^ Do not look for a project configuration, and use the implicit global.
deriving Show
stackYamlLocL :: HasRunner env => Lens' env StackYamlLoc
stackYamlLocL = globalOptsL.lens globalStackYaml (\x y -> x { globalStackYaml = y })
-- | How to interact with lock files
data LockFileBehavior
= LFBReadWrite
-- ^ Read and write lock files
| LFBReadOnly
-- ^ Read lock files, but do not write them
| LFBIgnore
-- ^ Entirely ignore lock files
| LFBErrorOnWrite
-- ^ Error out on trying to write a lock file. This can be used to
-- ensure that lock files in a repository already ensure
-- reproducible builds.
deriving (Show, Enum, Bounded)
lockFileBehaviorL :: HasRunner env => SimpleGetter env LockFileBehavior
lockFileBehaviorL = globalOptsL.to globalLockFileBehavior
-- | Parser for 'LockFileBehavior'
readLockFileBehavior :: ReadM LockFileBehavior
readLockFileBehavior = do
s <- OA.readerAsk
case Map.lookup s m of
Just x -> pure x
Nothing -> OA.readerError $ "Invalid lock file behavior, valid options: " ++
List.intercalate ", " (Map.keys m)
where
m = Map.fromList $ map (\x -> (render x, x)) [minBound..maxBound]
render LFBReadWrite = "read-write"
render LFBReadOnly = "read-only"
render LFBIgnore = "ignore"
render LFBErrorOnWrite = "error-on-write"
-- | Project configuration information. Not every run of Stack has a
-- true local project; see constructors below.
data ProjectConfig a
= PCProject a
-- ^ Normal run: we want a project, and have one. This comes from
-- either 'SYLDefault' or 'SYLOverride'.
| PCGlobalProject
-- ^ No project was found when using 'SYLDefault'. Instead, use
-- the implicit global.
| PCNoProject ![PackageIdentifierRevision]
-- ^ Use a no project run. This comes from 'SYLNoProject'.
-- | Parsed global command-line options monoid.
data GlobalOptsMonoid = GlobalOptsMonoid
{ globalMonoidReExecVersion :: !(First String) -- ^ Expected re-exec in container version
, globalMonoidDockerEntrypoint :: !(First DockerEntrypoint)
-- ^ Data used when stack is acting as a Docker entrypoint (internal use only)
, globalMonoidLogLevel :: !(First LogLevel) -- ^ Log level
, globalMonoidTimeInLog :: !FirstTrue -- ^ Whether to include timings in logs.
, globalMonoidConfigMonoid :: !ConfigMonoid -- ^ Config monoid, for passing into 'loadConfig'
, globalMonoidResolver :: !(First (Unresolved AbstractResolver)) -- ^ Resolver override
, globalMonoidResolverRoot :: !(First FilePath) -- ^ root directory for resolver relative path
, globalMonoidCompiler :: !(First WantedCompiler) -- ^ Compiler override
, globalMonoidTerminal :: !(First Bool) -- ^ We're in a terminal?
, globalMonoidStyles :: !StylesUpdate -- ^ Stack's output styles
, globalMonoidTermWidth :: !(First Int) -- ^ Terminal width override
, globalMonoidStackYaml :: !(First FilePath) -- ^ Override project stack.yaml
, globalMonoidLockFileBehavior :: !(First LockFileBehavior) -- ^ See 'globalLockFileBehavior'
} deriving Generic
instance Semigroup GlobalOptsMonoid where
(<>) = mappenddefault
instance Monoid GlobalOptsMonoid where
mempty = memptydefault
mappend = (<>)
-- | Default logging level should be something useful but not crazy.
defaultLogLevel :: LogLevel
defaultLogLevel = LevelInfo
readColorWhen :: ReadM ColorWhen
readColorWhen = do
s <- OA.readerAsk
case s of
"never" -> return ColorNever
"always" -> return ColorAlways
"auto" -> return ColorAuto
_ -> OA.readerError "Expected values of color option are 'never', 'always', or 'auto'."
readStyles :: ReadM StylesUpdate
readStyles = parseStylesUpdateFromString <$> OA.readerAsk
-- | A superset of 'Config' adding information on how to build code. The reason
-- for this breakdown is because we will need some of the information from
-- 'Config' in order to determine the values here.
--
-- These are the components which know nothing about local configuration.
data BuildConfig = BuildConfig
{ bcConfig :: !Config
, bcSMWanted :: !SMWanted
, bcExtraPackageDBs :: ![Path Abs Dir]
-- ^ Extra package databases
, bcStackYaml :: !(Path Abs File)
-- ^ Location of the stack.yaml file.
--
-- Note: if the STACK_YAML environment variable is used, this may be
-- different from projectRootL </> "stack.yaml" if a different file
-- name is used.
, bcProjectStorage :: !ProjectStorage
-- ^ Database connection pool for project Stack database
, bcCurator :: !(Maybe Curator)
}
stackYamlL :: HasBuildConfig env => Lens' env (Path Abs File)
stackYamlL = buildConfigL.lens bcStackYaml (\x y -> x { bcStackYaml = y })
-- | Directory containing the project's stack.yaml file
projectRootL :: HasBuildConfig env => Getting r env (Path Abs Dir)
projectRootL = stackYamlL.to parent
-- | Configuration after the environment has been setup.
data EnvConfig = EnvConfig
{envConfigBuildConfig :: !BuildConfig
,envConfigBuildOptsCLI :: !BuildOptsCLI
,envConfigSourceMap :: !SourceMap
,envConfigSourceMapHash :: !SourceMapHash
,envConfigCompilerPaths :: !CompilerPaths
}
ppGPD :: MonadIO m => ProjectPackage -> m GenericPackageDescription
ppGPD = liftIO . cpGPD . ppCommon
-- | Root directory for the given 'ProjectPackage'
ppRoot :: ProjectPackage -> Path Abs Dir
ppRoot = parent . ppCabalFP
-- | All components available in the given 'ProjectPackage'
ppComponents :: MonadIO m => ProjectPackage -> m (Set NamedComponent)
ppComponents pp = do
gpd <- ppGPD pp
pure $ Set.fromList $ concat
[ maybe [] (const [CLib]) (C.condLibrary gpd)
, go CExe (fst <$> C.condExecutables gpd)
, go CTest (fst <$> C.condTestSuites gpd)
, go CBench (fst <$> C.condBenchmarks gpd)
]
where
go :: (T.Text -> NamedComponent)
-> [C.UnqualComponentName]
-> [NamedComponent]
go wrapper = map (wrapper . T.pack . C.unUnqualComponentName)
-- | Version for the given 'ProjectPackage
ppVersion :: MonadIO m => ProjectPackage -> m Version
ppVersion = fmap gpdVersion . ppGPD
-- | A project is a collection of packages. We can have multiple stack.yaml
-- files, but only one of them may contain project information.
data Project = Project
{ projectUserMsg :: !(Maybe String)
-- ^ A warning message to display to the user when the auto generated
-- config may have issues.
, projectPackages :: ![RelFilePath]
-- ^ Packages which are actually part of the project (as opposed
-- to dependencies).
, projectDependencies :: ![RawPackageLocation]
-- ^ Dependencies defined within the stack.yaml file, to be
-- applied on top of the snapshot.
, projectFlags :: !(Map PackageName (Map FlagName Bool))
-- ^ Flags to be applied on top of the snapshot flags.
, projectResolver :: !RawSnapshotLocation
-- ^ How we resolve which @Snapshot@ to use
, projectCompiler :: !(Maybe WantedCompiler)
-- ^ Override the compiler in 'projectResolver'
, projectExtraPackageDBs :: ![FilePath]
, projectCurator :: !(Maybe Curator)
-- ^ Extra configuration intended exclusively for usage by the
-- curator tool. In other words, this is /not/ part of the
-- documented and exposed Stack API. SUBJECT TO CHANGE.
, projectDropPackages :: !(Set PackageName)
-- ^ Packages to drop from the 'projectResolver'.
}
deriving Show
instance ToJSON Project where
-- Expanding the constructor fully to ensure we don't miss any fields.
toJSON (Project userMsg packages extraDeps flags resolver mcompiler extraPackageDBs mcurator drops) = object $ concat
[ maybe [] (\cv -> ["compiler" .= cv]) mcompiler
, maybe [] (\msg -> ["user-message" .= msg]) userMsg
, if null extraPackageDBs then [] else ["extra-package-dbs" .= extraPackageDBs]
, if null extraDeps then [] else ["extra-deps" .= extraDeps]
, if Map.null flags then [] else ["flags" .= fmap toCabalStringMap (toCabalStringMap flags)]
, ["packages" .= packages]
, ["resolver" .= resolver]
, maybe [] (\c -> ["curator" .= c]) mcurator
, if Set.null drops then [] else ["drop-packages" .= Set.map CabalString drops]
]
-- | Extra configuration intended exclusively for usage by the
-- curator tool. In other words, this is /not/ part of the
-- documented and exposed Stack API. SUBJECT TO CHANGE.
data Curator = Curator
{ curatorSkipTest :: !(Set PackageName)
, curatorExpectTestFailure :: !(Set PackageName)
, curatorSkipBenchmark :: !(Set PackageName)
, curatorExpectBenchmarkFailure :: !(Set PackageName)
, curatorSkipHaddock :: !(Set PackageName)
, curatorExpectHaddockFailure :: !(Set PackageName)
}
deriving Show
instance ToJSON Curator where
toJSON c = object
[ "skip-test" .= Set.map CabalString (curatorSkipTest c)
, "expect-test-failure" .= Set.map CabalString (curatorExpectTestFailure c)
, "skip-bench" .= Set.map CabalString (curatorSkipBenchmark c)
, "expect-benchmark-failure" .= Set.map CabalString (curatorExpectTestFailure c)
, "skip-haddock" .= Set.map CabalString (curatorSkipHaddock c)
, "expect-test-failure" .= Set.map CabalString (curatorExpectHaddockFailure c)
]
instance FromJSON (WithJSONWarnings Curator) where
parseJSON = withObjectWarnings "Curator" $ \o -> Curator
<$> fmap (Set.map unCabalString) (o ..:? "skip-test" ..!= mempty)
<*> fmap (Set.map unCabalString) (o ..:? "expect-test-failure" ..!= mempty)
<*> fmap (Set.map unCabalString) (o ..:? "skip-bench" ..!= mempty)
<*> fmap (Set.map unCabalString) (o ..:? "expect-benchmark-failure" ..!= mempty)
<*> fmap (Set.map unCabalString) (o ..:? "skip-haddock" ..!= mempty)
<*> fmap (Set.map unCabalString) (o ..:? "expect-haddock-failure" ..!= mempty)
-- An uninterpreted representation of configuration options.
-- Configurations may be "cascaded" using mappend (left-biased).
data ConfigMonoid =
ConfigMonoid
{ configMonoidStackRoot :: !(First (Path Abs Dir))
-- ^ See: 'clStackRoot'
, configMonoidWorkDir :: !(First (Path Rel Dir))
-- ^ See: 'configWorkDir'.
, configMonoidBuildOpts :: !BuildOptsMonoid
-- ^ build options.
, configMonoidDockerOpts :: !DockerOptsMonoid
-- ^ Docker options.
, configMonoidNixOpts :: !NixOptsMonoid
-- ^ Options for the execution environment (nix-shell or container)
, configMonoidConnectionCount :: !(First Int)
-- ^ See: 'configConnectionCount'
, configMonoidHideTHLoading :: !FirstTrue
-- ^ See: 'configHideTHLoading'
, configMonoidPrefixTimestamps :: !(First Bool)
-- ^ See: 'configPrefixTimestamps'
, configMonoidLatestSnapshot :: !(First Text)
-- ^ See: 'configLatestSnapshot'
, configMonoidPackageIndices :: !(First [HackageSecurityConfig])
-- ^ See: @picIndices@
, configMonoidSystemGHC :: !(First Bool)
-- ^ See: 'configSystemGHC'
,configMonoidInstallGHC :: !FirstTrue
-- ^ See: 'configInstallGHC'
,configMonoidSkipGHCCheck :: !FirstFalse
-- ^ See: 'configSkipGHCCheck'
,configMonoidSkipMsys :: !FirstFalse
-- ^ See: 'configSkipMsys'
,configMonoidCompilerCheck :: !(First VersionCheck)
-- ^ See: 'configCompilerCheck'
,configMonoidCompilerRepository :: !(First CompilerRepository)
-- ^ See: 'configCompilerRepository'
,configMonoidRequireStackVersion :: !IntersectingVersionRange
-- ^ See: 'configRequireStackVersion'
,configMonoidArch :: !(First String)
-- ^ Used for overriding the platform
,configMonoidGHCVariant :: !(First GHCVariant)
-- ^ Used for overriding the platform
,configMonoidGHCBuild :: !(First CompilerBuild)
-- ^ Used for overriding the GHC build
,configMonoidJobs :: !(First Int)
-- ^ See: 'configJobs'
,configMonoidExtraIncludeDirs :: ![FilePath]
-- ^ See: 'configExtraIncludeDirs'
,configMonoidExtraLibDirs :: ![FilePath]
-- ^ See: 'configExtraLibDirs'
, configMonoidOverrideGccPath :: !(First (Path Abs File))
-- ^ Allow users to override the path to gcc
,configMonoidOverrideHpack :: !(First FilePath)
-- ^ Use Hpack executable (overrides bundled Hpack)
,configMonoidConcurrentTests :: !(First Bool)
-- ^ See: 'configConcurrentTests'
,configMonoidLocalBinPath :: !(First FilePath)
-- ^ Used to override the binary installation dir
,configMonoidTemplateParameters :: !(Map Text Text)
-- ^ Template parameters.
,configMonoidScmInit :: !(First SCM)
-- ^ Initialize SCM (e.g. git init) when making new projects?
,configMonoidGhcOptionsByName :: !(MonoidMap PackageName (Monoid.Dual [Text]))
-- ^ See 'configGhcOptionsByName'. Uses 'Monoid.Dual' so that
-- options from the configs on the right come first, so that they
-- can be overridden.
,configMonoidGhcOptionsByCat :: !(MonoidMap ApplyGhcOptions (Monoid.Dual [Text]))
-- ^ See 'configGhcOptionsAll'. Uses 'Monoid.Dual' so that options
-- from the configs on the right come first, so that they can be
-- overridden.
,configMonoidCabalConfigOpts :: !(MonoidMap CabalConfigKey (Monoid.Dual [Text]))
-- ^ See 'configCabalConfigOpts'.
,configMonoidExtraPath :: ![Path Abs Dir]
-- ^ Additional paths to search for executables in
,configMonoidSetupInfoLocations :: ![String]
-- ^ See 'configSetupInfoLocations'
,configMonoidSetupInfoInline :: !SetupInfo
-- ^ See 'configSetupInfoInline'
,configMonoidLocalProgramsBase :: !(First (Path Abs Dir))
-- ^ Override the default local programs dir, where e.g. GHC is installed.
,configMonoidPvpBounds :: !(First PvpBounds)
-- ^ See 'configPvpBounds'
,configMonoidModifyCodePage :: !FirstTrue
-- ^ See 'configModifyCodePage'
,configMonoidRebuildGhcOptions :: !FirstFalse
-- ^ See 'configMonoidRebuildGhcOptions'
,configMonoidApplyGhcOptions :: !(First ApplyGhcOptions)
-- ^ See 'configApplyGhcOptions'
,configMonoidAllowNewer :: !(First Bool)
-- ^ See 'configMonoidAllowNewer'
,configMonoidDefaultTemplate :: !(First TemplateName)
-- ^ The default template to use when none is specified.
-- (If Nothing, the default default is used.)
, configMonoidAllowDifferentUser :: !(First Bool)
-- ^ Allow users other than the stack root owner to use the stack
-- installation.
, configMonoidDumpLogs :: !(First DumpLogs)
-- ^ See 'configDumpLogs'
, configMonoidSaveHackageCreds :: !(First Bool)
-- ^ See 'configSaveHackageCreds'
, configMonoidHackageBaseUrl :: !(First Text)
-- ^ See 'configHackageBaseUrl'
, configMonoidColorWhen :: !(First ColorWhen)
-- ^ When to use 'ANSI' colors
, configMonoidStyles :: !StylesUpdate
, configMonoidHideSourcePaths :: !FirstTrue
-- ^ See 'configHideSourcePaths'
, configMonoidRecommendUpgrade :: !FirstTrue
-- ^ See 'configRecommendUpgrade'
, configMonoidCasaRepoPrefix :: !(First CasaRepoPrefix)
, configMonoidSnapshotLocation :: !(First Text)
-- ^ Custom location of LTS/Nightly snapshots
, configMonoidStackDeveloperMode :: !(First Bool)
-- ^ See 'configStackDeveloperMode'
}
deriving (Show, Generic)
instance Semigroup ConfigMonoid where
(<>) = mappenddefault
instance Monoid ConfigMonoid where
mempty = memptydefault
mappend = (<>)
parseConfigMonoid :: Path Abs Dir -> Value -> Yaml.Parser (WithJSONWarnings ConfigMonoid)
parseConfigMonoid = withObjectWarnings "ConfigMonoid" . parseConfigMonoidObject
-- | Parse a partial configuration. Used both to parse both a standalone config
-- file and a project file, so that a sub-parser is not required, which would interfere with
-- warnings for missing fields.
parseConfigMonoidObject :: Path Abs Dir -> Object -> WarningParser ConfigMonoid
parseConfigMonoidObject rootDir obj = do
-- Parsing 'stackRoot' from 'stackRoot'/config.yaml would be nonsensical
let configMonoidStackRoot = First Nothing
configMonoidWorkDir <- First <$> obj ..:? configMonoidWorkDirName
configMonoidBuildOpts <- jsonSubWarnings (obj ..:? configMonoidBuildOptsName ..!= mempty)
configMonoidDockerOpts <- jsonSubWarnings (obj ..:? configMonoidDockerOptsName ..!= mempty)
configMonoidNixOpts <- jsonSubWarnings (obj ..:? configMonoidNixOptsName ..!= mempty)
configMonoidConnectionCount <- First <$> obj ..:? configMonoidConnectionCountName
configMonoidHideTHLoading <- FirstTrue <$> obj ..:? configMonoidHideTHLoadingName
configMonoidPrefixTimestamps <- First <$> obj ..:? configMonoidPrefixTimestampsName
murls :: Maybe Value <- obj ..:? configMonoidUrlsName
configMonoidLatestSnapshot <-
case murls of
Nothing -> pure $ First Nothing
Just urls -> jsonSubWarnings $ lift $ withObjectWarnings
"urls"
(\o -> First <$> o ..:? "latest-snapshot" :: WarningParser (First Text))
urls
configMonoidPackageIndices <- First <$> jsonSubWarningsTT (obj ..:? configMonoidPackageIndicesName)
configMonoidSystemGHC <- First <$> obj ..:? configMonoidSystemGHCName
configMonoidInstallGHC <- FirstTrue <$> obj ..:? configMonoidInstallGHCName
configMonoidSkipGHCCheck <- FirstFalse <$> obj ..:? configMonoidSkipGHCCheckName
configMonoidSkipMsys <- FirstFalse <$> obj ..:? configMonoidSkipMsysName
configMonoidRequireStackVersion <- IntersectingVersionRange . unVersionRangeJSON <$> (
obj ..:? configMonoidRequireStackVersionName
..!= VersionRangeJSON anyVersion)
configMonoidArch <- First <$> obj ..:? configMonoidArchName
configMonoidGHCVariant <- First <$> obj ..:? configMonoidGHCVariantName
configMonoidGHCBuild <- First <$> obj ..:? configMonoidGHCBuildName
configMonoidJobs <- First <$> obj ..:? configMonoidJobsName
configMonoidExtraIncludeDirs <- map (toFilePath rootDir FilePath.</>) <$>
obj ..:? configMonoidExtraIncludeDirsName ..!= []
configMonoidExtraLibDirs <- map (toFilePath rootDir FilePath.</>) <$>
obj ..:? configMonoidExtraLibDirsName ..!= []
configMonoidOverrideGccPath <- First <$> obj ..:? configMonoidOverrideGccPathName
configMonoidOverrideHpack <- First <$> obj ..:? configMonoidOverrideHpackName
configMonoidConcurrentTests <- First <$> obj ..:? configMonoidConcurrentTestsName
configMonoidLocalBinPath <- First <$> obj ..:? configMonoidLocalBinPathName
templates <- obj ..:? "templates"
(configMonoidScmInit,configMonoidTemplateParameters) <-
case templates of
Nothing -> return (First Nothing,M.empty)
Just tobj -> do
scmInit <- tobj ..:? configMonoidScmInitName
params <- tobj ..:? configMonoidTemplateParametersName
return (First scmInit,fromMaybe M.empty params)
configMonoidCompilerCheck <- First <$> obj ..:? configMonoidCompilerCheckName
configMonoidCompilerRepository <- First <$> (obj ..:? configMonoidCompilerRepositoryName)
options <- Map.map unGhcOptions <$> obj ..:? configMonoidGhcOptionsName ..!= mempty
optionsEverything <-
case (Map.lookup GOKOldEverything options, Map.lookup GOKEverything options) of
(Just _, Just _) -> fail "Cannot specify both `*` and `$everything` GHC options"
(Nothing, Just x) -> return x
(Just x, Nothing) -> do
tell "The `*` ghc-options key is not recommended. Consider using $locals, or if really needed, $everything"
return x
(Nothing, Nothing) -> return []
let configMonoidGhcOptionsByCat = coerce $ Map.fromList
[ (AGOEverything, optionsEverything)
, (AGOLocals, Map.findWithDefault [] GOKLocals options)
, (AGOTargets, Map.findWithDefault [] GOKTargets options)
]
configMonoidGhcOptionsByName = coerce $ Map.fromList
[(name, opts) | (GOKPackage name, opts) <- Map.toList options]
configMonoidCabalConfigOpts' <- obj ..:? "configure-options" ..!= mempty
let configMonoidCabalConfigOpts = coerce (configMonoidCabalConfigOpts' :: Map CabalConfigKey [Text])
configMonoidExtraPath <- obj ..:? configMonoidExtraPathName ..!= []
configMonoidSetupInfoLocations <- obj ..:? configMonoidSetupInfoLocationsName ..!= []
configMonoidSetupInfoInline <- jsonSubWarningsT (obj ..:? configMonoidSetupInfoInlineName) ..!= mempty
configMonoidLocalProgramsBase <- First <$> obj ..:? configMonoidLocalProgramsBaseName
configMonoidPvpBounds <- First <$> obj ..:? configMonoidPvpBoundsName
configMonoidModifyCodePage <- FirstTrue <$> obj ..:? configMonoidModifyCodePageName
configMonoidRebuildGhcOptions <- FirstFalse <$> obj ..:? configMonoidRebuildGhcOptionsName
configMonoidApplyGhcOptions <- First <$> obj ..:? configMonoidApplyGhcOptionsName
configMonoidAllowNewer <- First <$> obj ..:? configMonoidAllowNewerName
configMonoidDefaultTemplate <- First <$> obj ..:? configMonoidDefaultTemplateName
configMonoidAllowDifferentUser <- First <$> obj ..:? configMonoidAllowDifferentUserName
configMonoidDumpLogs <- First <$> obj ..:? configMonoidDumpLogsName
configMonoidSaveHackageCreds <- First <$> obj ..:? configMonoidSaveHackageCredsName
configMonoidHackageBaseUrl <- First <$> obj ..:? configMonoidHackageBaseUrlName
configMonoidColorWhenUS <- obj ..:? configMonoidColorWhenUSName
configMonoidColorWhenGB <- obj ..:? configMonoidColorWhenGBName
let configMonoidColorWhen = First $ configMonoidColorWhenUS
<|> configMonoidColorWhenGB
configMonoidStylesUS <- obj ..:? configMonoidStylesUSName
configMonoidStylesGB <- obj ..:? configMonoidStylesGBName
let configMonoidStyles = fromMaybe mempty $ configMonoidStylesUS
<|> configMonoidStylesGB
configMonoidHideSourcePaths <- FirstTrue <$> obj ..:? configMonoidHideSourcePathsName
configMonoidRecommendUpgrade <- FirstTrue <$> obj ..:? configMonoidRecommendUpgradeName
configMonoidCasaRepoPrefix <- First <$> obj ..:? configMonoidCasaRepoPrefixName
configMonoidSnapshotLocation <- First <$> obj ..:? configMonoidSnapshotLocationName
configMonoidStackDeveloperMode <- First <$> obj ..:? configMonoidStackDeveloperModeName
return ConfigMonoid {..}
configMonoidWorkDirName :: Text
configMonoidWorkDirName = "work-dir"
configMonoidBuildOptsName :: Text
configMonoidBuildOptsName = "build"
configMonoidDockerOptsName :: Text
configMonoidDockerOptsName = "docker"
configMonoidNixOptsName :: Text