stack-1.0.4: The Haskell Tool Stack

Safe HaskellNone
LanguageHaskell2010

Stack.Types.Config

Contents

Description

The Config type.

Synopsis

Main configuration types and classes

HasPlatform & HasStackRoot

class HasPlatform env where Source

Class for environment values which have a Platform

Minimal complete definition

Nothing

class HasStackRoot env where Source

Class for environment values which have access to the stack root

Minimal complete definition

Nothing

Methods

getStackRoot :: env -> Path Abs Dir Source

data PlatformVariant Source

A variant of the platform, used to differentiate Docker builds from host

Config & HasConfig

data Config Source

The top-level Stackage configuration.

Constructors

Config 

Fields

configStackRoot :: !(Path Abs Dir)

~/.stack more often than not

configWorkDir :: !(Path Rel Dir)

this allows to override .stack-work directory

configUserConfigPath :: !(Path Abs File)

Path to user configuration file (usually ~.stackconfig.yaml)

configDocker :: !DockerOpts

Docker configuration

configNix :: !NixOpts

Execution environment (e.g nix-shell) configuration

configEnvOverride :: !(EnvSettings -> IO EnvOverride)

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)

configConnectionCount :: !Int

How many concurrent connections are allowed when downloading

configHideTHLoading :: !Bool

Hide the Template Haskell "Loading package ..." messages from the console

configPlatform :: !Platform

The platform we're building for, used in many directory names

configPlatformVariant :: !PlatformVariant

Variant of the platform, also used in directory names

configGHCVariant0 :: !(Maybe GHCVariant)

The variant of GHC requested by the user. In most cases, use BuildConfig or MiniConfigs version instead, which will have an auto-detected default.

configLatestSnapshotUrl :: !Text

URL for a JSON file containing information on the latest snapshots available.

configPackageIndices :: ![PackageIndex]

Information on package indices. This is left biased, meaning that packages in an earlier index will shadow those in a later index.

Warning: if you override packages in an index vs what's available upstream, you may correct your compiled snapshots, as different projects may have different definitions of what pkg-ver means! This feature is primarily intended for adding local packages, not overriding. Overriding is better accomplished by adding to your list of packages.

Note that indices specified in a later config file will override previous indices, not extend them.

Using an assoc list instead of a Map to keep track of priority

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 locally installed MSYS

configCompilerCheck :: !VersionCheck

Specifies which versions of the compiler are acceptable.

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

configExtraIncludeDirs :: !(Set Text)
  • -extra-include-dirs arguments
configExtraLibDirs :: !(Set Text)
  • -extra-lib-dirs arguments
configConfigMonoid :: !ConfigMonoid

ConfigMonoid used to generate this

configConcurrentTests :: !Bool

Run test suites concurrently

configImage :: !ImageOpts
 
configTemplateParams :: !(Map Text Text)

Parameters for templates.

configScmInit :: !(Maybe SCM)

Initialize SCM (e.g. git) when creating new projects.

configGhcOptions :: !(Map (Maybe PackageName) [Text])

Additional GHC options to apply to either all packages (Nothing) or a specific package (Just).

configSetupInfoLocations :: ![SetupInfoLocation]

Additional SetupInfo (inline or remote) 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

configExplicitSetupDeps :: !(Map (Maybe PackageName) Bool)

See explicitSetupDeps. Nothing provides the default value.

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.

class (HasStackRoot env, HasPlatform env) => HasConfig env where Source

Class for environment values that can provide a Config.

Minimal complete definition

Nothing

Methods

getConfig :: env -> Config Source

askConfig :: (MonadReader env m, HasConfig env) => m Config Source

Helper function to ask the environment and apply getConfig

askLatestSnapshotUrl :: (MonadReader env m, HasConfig env) => m Text Source

Get the URL to request the information on the latest snapshots

explicitSetupDeps :: (MonadReader env m, HasConfig env) => PackageName -> m Bool Source

Provide an explicit list of package dependencies when running a custom Setup.hs

getMinimalEnvOverride :: (MonadReader env m, HasConfig env, MonadIO m) => m EnvOverride Source

Get the minimal environment override, useful for just calling external processes like git or ghc

BuildConfig & HasBuildConfig

data BuildConfig Source

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.

Constructors

BuildConfig 

Fields

bcConfig :: !Config
 
bcResolver :: !Resolver

How we resolve which dependencies to install given a set of packages.

bcWantedCompiler :: !CompilerVersion

Compiler version wanted for this build

bcPackageEntries :: ![PackageEntry]

Local packages identified by a path, Bool indicates whether it is a non-dependency (the opposite of peExtraDep)

bcExtraDeps :: !(Map PackageName Version)

Extra dependencies specified in configuration.

These dependencies will not be installed to a shared location, and will override packages provided by the resolver.

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 bcRoot / "stack.yaml"

bcFlags :: !(Map PackageName (Map FlagName Bool))

Per-package flag overrides

bcImplicitGlobal :: !Bool

Are we loading from the implicit global stack.yaml? This is useful for providing better error messages.

bcGHCVariant :: !GHCVariant

The variant of GHC used to select a GHC bindist.

bcPackageCaches :: !(Map PackageIdentifier (PackageIndex, PackageCache))

Shared package cache map

bcRoot :: BuildConfig -> Path Abs Dir Source

Directory containing the project's stack.yaml file

bcWorkDir :: (MonadReader env m, HasConfig env) => BuildConfig -> m (Path Abs Dir) Source

"bcRoot/.stack-work"

class HasConfig env => HasBuildConfig env where Source

Class for environment values that can provide a BuildConfig.

GHCVariant & HasGHCVariant

data GHCVariant Source

Specialized bariant of GHC (e.g. libgmp4 or integer-simple)

Constructors

GHCStandard

Standard bindist

GHCGMP4

Bindist that supports libgmp4 (centos66)

GHCArch

Bindist built on Arch Linux (bleeding-edge)

GHCIntegerSimple

Bindist that uses integer-simple

GHCCustom String

Other bindists

ghcVariantName :: GHCVariant -> String Source

Render a GHC variant to a String.

ghcVariantSuffix :: GHCVariant -> String Source

Render a GHC variant to a String suffix.

parseGHCVariant :: MonadThrow m => String -> m GHCVariant Source

Parse GHC variant from a String.

class HasGHCVariant env where Source

Class for environment values which have a GHCVariant

Minimal complete definition

Nothing

snapshotsDir :: (MonadReader env m, HasConfig env, HasGHCVariant env, MonadThrow m) => m (Path Abs Dir) Source

Directory containing snapshots

EnvConfig & HasEnvConfig

Details

ApplyGhcOptions

data ApplyGhcOptions Source

Which packages to ghc-options on the command line apply to?

Constructors

AGOTargets

all local targets

AGOLocals

all local packages, even non-targets

AGOEverything

every package

ConfigException

ConfigMonoid

data ConfigMonoid Source

Constructors

ConfigMonoid 

Fields

configMonoidWorkDir :: !(Maybe FilePath)

See: configWorkDir.

configMonoidDockerOpts :: !DockerOptsMonoid

Docker options.

configMonoidNixOpts :: !NixOptsMonoid

Options for the execution environment (nix-shell or container)

configMonoidConnectionCount :: !(Maybe Int)

See: configConnectionCount

configMonoidHideTHLoading :: !(Maybe Bool)

See: configHideTHLoading

configMonoidLatestSnapshotUrl :: !(Maybe Text)

See: configLatestSnapshotUrl

configMonoidPackageIndices :: !(Maybe [PackageIndex])

See: configPackageIndices

configMonoidSystemGHC :: !(Maybe Bool)

See: configSystemGHC

configMonoidInstallGHC :: !(Maybe Bool)

See: configInstallGHC

configMonoidSkipGHCCheck :: !(Maybe Bool)

See: configSkipGHCCheck

configMonoidSkipMsys :: !(Maybe Bool)

See: configSkipMsys

configMonoidCompilerCheck :: !(Maybe VersionCheck)

See: configCompilerCheck

configMonoidRequireStackVersion :: !VersionRange

See: configRequireStackVersion

configMonoidOS :: !(Maybe String)

Used for overriding the platform

configMonoidArch :: !(Maybe String)

Used for overriding the platform

configMonoidGHCVariant :: !(Maybe GHCVariant)

Used for overriding the GHC variant

configMonoidJobs :: !(Maybe Int)

See: configJobs

configMonoidExtraIncludeDirs :: !(Set Text)

See: configExtraIncludeDirs

configMonoidExtraLibDirs :: !(Set Text)

See: configExtraLibDirs

configMonoidConcurrentTests :: !(Maybe Bool)

See: configConcurrentTests

configMonoidLocalBinPath :: !(Maybe FilePath)

Used to override the binary installation dir

configMonoidImageOpts :: !ImageOptsMonoid

Image creation options.

configMonoidTemplateParameters :: !(Map Text Text)

Template parameters.

configMonoidScmInit :: !(Maybe SCM)

Initialize SCM (e.g. git init) when making new projects?

configMonoidGhcOptions :: !(Map (Maybe PackageName) [Text])

See configGhcOptions

configMonoidExtraPath :: ![Path Abs Dir]

Additional paths to search for executables in

configMonoidSetupInfoLocations :: ![SetupInfoLocation]

Additional setup info (inline or remote) to use for installing tools

configMonoidPvpBounds :: !(Maybe PvpBounds)

See configPvpBounds

configMonoidModifyCodePage :: !(Maybe Bool)

See configModifyCodePage

configMonoidExplicitSetupDeps :: !(Map (Maybe PackageName) Bool)

See configExplicitSetupDeps

configMonoidRebuildGhcOptions :: !(Maybe Bool)

See configMonoidRebuildGhcOptions

configMonoidApplyGhcOptions :: !(Maybe ApplyGhcOptions)

See configApplyGhcOptions

configMonoidAllowNewer :: !(Maybe Bool)

See configMonoidAllowNewer

configMonoidDefaultTemplate :: !(Maybe TemplateName)

The default template to use when none is specified. (If Nothing, the default default is used.)

configMonoidAllowDifferentUser :: !(Maybe Bool)

Allow users other than the stack root owner to use the stack installation.

EnvSettings

data EnvSettings Source

Controls which version of the environment is used

Constructors

EnvSettings 

Fields

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

GlobalOpts & GlobalOptsMonoid

data GlobalOpts Source

Parsed global command-line options.

Constructors

GlobalOpts 

Fields

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

globalConfigMonoid :: !ConfigMonoid

Config monoid, for passing into loadConfig

globalResolver :: !(Maybe AbstractResolver)

Resolver override

globalCompiler :: !(Maybe CompilerVersion)

Compiler override

globalTerminal :: !Bool

We're in a terminal?

globalStackYaml :: !(Maybe FilePath)

Override project stack.yaml

data GlobalOptsMonoid Source

Parsed global command-line options monoid.

Constructors

GlobalOptsMonoid 

Fields

globalMonoidReExecVersion :: !(Maybe String)

Expected re-exec in container version

globalMonoidDockerEntrypoint :: !(Maybe DockerEntrypoint)

Data used when stack is acting as a Docker entrypoint (internal use only)

globalMonoidLogLevel :: !(Maybe LogLevel)

Log level

globalMonoidConfigMonoid :: !ConfigMonoid

Config monoid, for passing into loadConfig

globalMonoidResolver :: !(Maybe AbstractResolver)

Resolver override

globalMonoidCompiler :: !(Maybe CompilerVersion)

Compiler override

globalMonoidTerminal :: !(Maybe Bool)

We're in a terminal?

globalMonoidStackYaml :: !(Maybe FilePath)

Override project stack.yaml

defaultLogLevel :: LogLevel Source

Default logging level should be something useful but not crazy.

LoadConfig

data LoadConfig m Source

Value returned by loadConfig.

Constructors

LoadConfig 

Fields

lcConfig :: !Config

Top-level Stack configuration.

lcLoadBuildConfig :: !(Maybe CompilerVersion -> m BuildConfig)

Action to load the remaining BuildConfig.

lcProjectRoot :: !(Maybe (Path Abs Dir))

The project root directory, if in a project.

PackageEntry & PackageLocation

data PackageEntry Source

Constructors

PackageEntry 

Fields

peExtraDepMaybe :: !(Maybe Bool)

Is this package a dependency? This means the local package will be treated just like an extra-deps: it will only be built as a dependency for others, and its test suite/benchmarks will not be run.

Useful modifying an upstream package, see: https://github.com/commercialhaskell/stack/issues/219 https://github.com/commercialhaskell/stack/issues/386

peValidWanted :: !(Maybe Bool)

Deprecated name meaning the opposite of peExtraDep. Only present to provide deprecation warnings to users.

peLocation :: !PackageLocation
 
peSubdirs :: ![FilePath]
 

peExtraDep :: PackageEntry -> Bool Source

Once peValidWanted is removed, this should just become the field name in PackageEntry.

data PackageLocation Source

Constructors

PLFilePath FilePath

Note that we use FilePath and not Paths. The goal is: first parse the value raw, and then use canonicalizePath and parseAbsDir.

PLRemote Text RemotePackageType

URL and further details

PackageIndex, IndexName & IndexLocation

data PackageIndex Source

Information on a single package index

Constructors

PackageIndex 

Fields

indexName :: !IndexName
 
indexLocation :: !IndexLocation
 
indexDownloadPrefix :: !Text

URL prefix for downloading packages

indexGpgVerify :: !Bool

GPG-verify the package index during download. Only applies to Git repositories for now.

indexRequireHashes :: !Bool

Require that hashes and package size information be available for packages in this index

configPackageIndex :: (MonadReader env m, HasConfig env, MonadThrow m) => IndexName -> m (Path Abs File) Source

Location of the 00-index.tar file

configPackageIndexCache :: (MonadReader env m, HasConfig env, MonadThrow m) => IndexName -> m (Path Abs File) Source

Location of the 00-index.cache file

configPackageIndexGz :: (MonadReader env m, HasConfig env, MonadThrow m) => IndexName -> m (Path Abs File) Source

Location of the 00-index.tar.gz file

configPackageIndexRoot :: (MonadReader env m, HasConfig env, MonadThrow m) => IndexName -> m (Path Abs Dir) Source

Root for a specific package index

configPackageTarball :: (MonadReader env m, HasConfig env, MonadThrow m) => IndexName -> PackageIdentifier -> m (Path Abs File) Source

Location of a package tarball

data IndexLocation Source

Location of the package index. This ensures that at least one of Git or HTTP is available.

Constructors

ILGit !Text 
ILHttp !Text 
ILGitHttp !Text !Text 

Project & ProjectAndConfigMonoid

data Project Source

A project is a collection of packages. We can have multiple stack.yaml files, but only one of them may contain project information.

Constructors

Project 

Fields

projectUserMsg :: !(Maybe String)

A warning message to display to the user when the auto generated config may have issues.

projectPackages :: ![PackageEntry]

Components of the package list

projectExtraDeps :: !(Map PackageName Version)

Components of the package list referring to package/version combos, see: https://github.com/fpco/stack/issues/41

projectFlags :: !(Map PackageName (Map FlagName Bool))

Per-package flag overrides

projectResolver :: !Resolver

How we resolve which dependencies to use

projectCompiler :: !(Maybe CompilerVersion)

When specified, overrides which compiler to use

projectExtraPackageDBs :: ![FilePath]
 

PvpBounds

Resolver & AbstractResolver

data Resolver Source

How we resolve which dependencies to install given a set of packages.

Constructors

ResolverSnapshot SnapName

Use an official snapshot from the Stackage project, either an LTS Haskell or Stackage Nightly

ResolverCompiler !CompilerVersion

Require a specific compiler version, but otherwise provide no build plan. Intended for use cases where end user wishes to specify all upstream dependencies manually, such as using a dependency solver.

ResolverCustom !Text !Text

A custom resolver based on the given name and URL. This file is assumed to be completely immutable.

parseResolverText :: MonadThrow m => Text -> m Resolver Source

Try to parse a Resolver from a Text. Won't work for complex resolvers (like custom).

resolverName :: Resolver -> Text Source

Convert a Resolver into its Text representation, as will be used by directory names

data AbstractResolver Source

Either an actual resolver value, or an abstract description of one (e.g., latest nightly).

SCM

data SCM Source

A software control system.

Constructors

Git 

Paths

bindirSuffix :: Path Rel Dir Source

Suffix applied to an installation root to get the bin dir

configInstalledCache :: (HasBuildConfig env, MonadReader env m) => m (Path Abs File) Source

File containing the installed cache, see Stack.PackageDump

configMiniBuildPlanCache :: (MonadThrow m, MonadReader env m, HasConfig env, HasGHCVariant env) => SnapName -> m (Path Abs File) Source

Where to store mini build plan caches

configProjectWorkDir :: (HasBuildConfig env, MonadReader env m) => m (Path Abs Dir) Source

Per-project work dir

docDirSuffix :: Path Rel Dir Source

Suffix applied to an installation root to get the doc dir

flagCacheLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) Source

Directory for holding flag cache information

extraBinDirs :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Bool -> [Path Abs Dir]) Source

Get the extra bin directories (for the PATH). Puts more local first

Bool indicates whether or not to include the locals

hpcReportDir :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) Source

Where HPC reports and tix files get stored.

installationRootDeps :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) Source

Installation root for dependencies

installationRootLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) Source

Installation root for locals

packageDatabaseDeps :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) Source

Package database for installing dependencies into

packageDatabaseExtra :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m [Path Abs Dir] Source

Extra package databases

packageDatabaseLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) Source

Package database for installing local packages into

platformOnlyRelDir :: (MonadReader env m, HasPlatform env, MonadThrow m) => m (Path Rel Dir) Source

Relative directory for the platform identifier

platformGhcRelDir :: (MonadReader env m, HasPlatform env, HasGHCVariant env, MonadThrow m) => m (Path Rel Dir) Source

Relative directory for the platform identifier

useShaPathOnWindows :: MonadThrow m => Path Rel Dir -> m (Path Rel Dir) Source

This is an attempt to shorten stack paths on Windows to decrease our chances of hitting 260 symbol path limit. The idea is to calculate SHA1 hash of the path used on other architectures, encode with base 16 and take first 8 symbols of it.

getWorkDir :: (MonadReader env m, HasConfig env) => m (Path Rel Dir) Source

".stack-work"

Command-specific types

Eval

data EvalOpts Source

Constructors

EvalOpts 

Instances

Exec

data ExecOpts Source

Constructors

ExecOpts 

Instances

Setup

data SetupInfo Source

Instances

Show SetupInfo Source 
Monoid SetupInfo Source

For siGHCs and siGHCJSs fields maps are deeply merged. For all fields the values from the last SetupInfo win.

FromJSON (SetupInfo, [JSONWarning]) Source 

Docker entrypoint

data DockerEntrypoint Source

Data passed into Docker container for the Docker entrypoint's use

Constructors

DockerEntrypoint 

Fields

deUser :: !(Maybe DockerUser)

UIDGIDetc of host user, if we wish to perform UID/GID switch in container

data DockerUser Source

Docker host user info

Constructors

DockerUser 

Fields

duUid :: UserID

uid

duGid :: GroupID

gid

duGroups :: [GroupID]

Supplemantal groups

duUmask :: FileMode

File creation mask }