stack-2.15.1: The Haskell Tool Stack
Safe HaskellSafe-Inferred
LanguageGHC2021

Stack.Config

Description

The general Stack configuration that starts everything off. This should be smart to fallback 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".

Synopsis

Documentation

loadConfig :: (HasRunner env, HasTerm env) => (Config -> RIO env a) -> RIO env a Source #

Load the configuration, using current directory, environment variables, and defaults as necessary.

loadConfigYaml :: HasLogFunc env => (Value -> Parser (WithJSONWarnings a)) -> Path Abs File -> RIO env a Source #

Load and parse YAML from the given config file. Throws ParseConfigFileException when there's a decoding error.

getImplicitGlobalProjectDir :: HasTerm env => Config -> RIO env (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.

getSnapshots :: HasConfig env => RIO env Snapshots Source #

Download the Snapshots value from stackage.org.

checkOwnership :: MonadIO m => Path Abs Dir -> m () Source #

checkOwnership dir throws UserDoesn'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, NoSuchDirectory (parent dir) is thrown.

getInContainer :: MonadIO m => m Bool Source #

True if we are currently running inside a Docker container.

getInNixShell :: MonadIO m => m Bool Source #

True if we are currently running inside a Nix.

getProjectConfig Source #

Arguments

:: HasTerm env 
=> StackYamlLoc

Override stack.yaml

-> RIO env (ProjectConfig (Path Abs File)) 

Get the location of the project config file, if it exists.

withBuildConfig :: RIO BuildConfig a -> RIO Config a Source #

Load the build configuration, adds build-specific values to config loaded by loadConfig. values.

withNewLogFunc Source #

Arguments

:: MonadUnliftIO m 
=> GlobalOpts 
-> Bool

Use color

-> StylesUpdate 
-> (LogFunc -> m a) 
-> m a 

Runs the provided action with a new LogFunc, given a StylesUpdate.

determineStackRootAndOwnership Source #

Arguments

:: MonadIO m 
=> ConfigMonoid

Parsed command-line arguments

-> m (Path Abs Dir, Path Abs Dir, Bool) 

Get the Stack root, e.g. ~/.stack, and determine whether the user owns it.

On Windows, the second value is always True.