Safe Haskell | None |
---|---|
Language | Haskell2010 |
The general Stack configuration that starts everything off. This should be smart to falback if there is no stack.yaml, instead relying on whatever files are available.
If there is no stack.yaml, and there is a cabal.config, we read in those constraints, and if there's a cabal.sandbox.config, we read any constraints from there and also find the package database from there, etc. And if there's nothing, we should probably default to behaving like cabal, possibly with spitting out a warning that "you should run `stk init` to make things better".
- data MiniConfig
- loadConfig :: HasRunner env => ConfigMonoid -> Maybe AbstractResolver -> StackYamlLoc (Path Abs File) -> RIO env LoadConfig
- loadConfigMaybeProject :: HasRunner env => ConfigMonoid -> Maybe AbstractResolver -> LocalConfigStatus (Project, Path Abs File, ConfigMonoid) -> RIO env LoadConfig
- loadMiniConfig :: Config -> MiniConfig
- loadConfigYaml :: (MonadIO m, MonadLogger m) => (Value -> Parser (WithJSONWarnings a)) -> Path Abs File -> m a
- packagesParser :: Parser [String]
- getLocalPackages :: forall env. HasEnvConfig env => RIO env LocalPackages
- getImplicitGlobalProjectDir :: (MonadIO m, MonadLogger m) => Config -> m (Path Abs Dir)
- getStackYaml :: HasConfig env => RIO env (Path Abs File)
- getSnapshots :: HasConfig env => RIO env Snapshots
- makeConcreteResolver :: HasConfig env => Maybe (Path Abs Dir) -> AbstractResolver -> RIO env Resolver
- checkOwnership :: MonadIO m => Path Abs Dir -> m ()
- getInContainer :: MonadIO m => m Bool
- getInNixShell :: MonadIO m => m Bool
- defaultConfigYaml :: ByteString
- getProjectConfig :: (MonadIO m, MonadThrow m, MonadLogger m) => StackYamlLoc (Path Abs File) -> m (LocalConfigStatus (Path Abs File))
- data LocalConfigStatus a
- = LCSNoProject
- | LCSProject a
- | LCSNoConfig !(Path Abs Dir)
Documentation
data MiniConfig Source #
An environment with a subset of BuildConfig used for setup.
:: HasRunner env | |
=> ConfigMonoid | Config monoid from parsed command-line arguments |
-> Maybe AbstractResolver | Override resolver |
-> StackYamlLoc (Path Abs File) | Override stack.yaml |
-> RIO env LoadConfig |
Load the configuration, using current directory, environment variables,
and defaults as necessary. The passed Maybe (Path Abs File)
is an
override for the location of the project's stack.yaml.
loadConfigMaybeProject Source #
:: HasRunner env | |
=> ConfigMonoid | Config monoid from parsed command-line arguments |
-> Maybe AbstractResolver | Override resolver |
-> LocalConfigStatus (Project, Path Abs File, ConfigMonoid) | Project config to use, if any |
-> RIO env LoadConfig |
loadMiniConfig :: Config -> MiniConfig Source #
Load the MiniConfig
.
loadConfigYaml :: (MonadIO m, MonadLogger m) => (Value -> Parser (WithJSONWarnings a)) -> Path Abs File -> m a Source #
Load and parse YAML from the given config file. Throws
ParseConfigFileException
when there's a decoding error.
packagesParser :: Parser [String] Source #
getLocalPackages :: forall env. HasEnvConfig env => RIO env LocalPackages Source #
Get packages from EnvConfig, downloading and cloning as necessary. If the packages have already been downloaded, this uses a cached value (
getImplicitGlobalProjectDir :: (MonadIO m, MonadLogger m) => Config -> m (Path Abs Dir) Source #
Get the location of the implicit global project directory. If the directory already exists at the deprecated location, its location is returned. Otherwise, the new location is returned.
getStackYaml :: HasConfig env => RIO env (Path Abs File) Source #
This is slightly more expensive than
and should only be used when no asks
(bcStackYaml
.
getBuildConfig
)BuildConfig
is at hand.
getSnapshots :: HasConfig env => RIO env Snapshots Source #
Download the Snapshots
value from stackage.org.
:: HasConfig env | |
=> Maybe (Path Abs Dir) | root of project for resolving custom relative paths |
-> AbstractResolver | |
-> RIO env Resolver |
Turn an AbstractResolver
into a Resolver
.
checkOwnership :: MonadIO m => Path Abs Dir -> m () Source #
throws checkOwnership
dirUserDoesn'tOwnDirectory
if dir
isn't owned by the current user.
If dir
doesn't exist, its parent directory is checked instead.
If the parent directory doesn't exist either,
is thrown.NoSuchDirectory
(parent
dir)
getInContainer :: MonadIO m => m Bool Source #
True
if we are currently running inside a Docker container.
:: (MonadIO m, MonadThrow m, MonadLogger m) | |
=> StackYamlLoc (Path Abs File) | Override stack.yaml |
-> m (LocalConfigStatus (Path Abs File)) |
Get the location of the project config file, if it exists.
data LocalConfigStatus a Source #
LCSNoProject | |
LCSProject a | |
LCSNoConfig !(Path Abs Dir) | parent directory for making a concrete resolving |