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
|
<div class="hidden-warning"><a href="https://docs.haskellstack.org/"><img src="https://cdn.jsdelivr.net/gh/commercialhaskell/stack/doc/img/hidden-warning.svg"></a></div>
# The `stack config` commands
~~~text
stack config COMMAND
Available commands:
env Print environment variables for use in a shell
set Sets a key in YAML configuration file to value
~~~
The `stack config` commands provide assistance with accessing or modifying
Stack's configuration. See `stack config` for the available commands.
## The `stack config env` command
~~~text
stack config env [--[no-]locals] [--[no-]ghc-package-path] [--[no-]stack-exe]
[--[no-]locale-utf8] [--[no-]keep-ghc-rts]
~~~
`stack config env` outputs a script that sets or unsets environment variables
for a Stack environment. Flags modify the script that is output:
* `--[no-]locals` (enabled by default) include/exclude project package
information
* `--[no-]ghc-package-path` (enabled by default) set `GHC_PACKAGE_PATH`
environment variable or not
* `--[no-]stack-exe` (enabled by default) set `STACK_EXE` environment variable
or not
* `--[no-]locale-utf8` (disabled by default) set the `GHC_CHARENC`
environment variable to `UTF-8` or not
* `--[no-]keep-ghc-rts` (disabled by default) keep/discard any `GHCRTS`
environment variable
The command also accepts flags and options of the
[`stack build`](build_command.md#flags-affecting-ghcs-behaviour) command that
affect the location of the local project installation directory, such as
`--profile` and `--no-strip`. For further information, see the documentation of
the [project Stack work directory](stack_work.md#project-stack-work-directory).
## The `stack config set` commands
~~~text
stack config set COMMAND
Available commands:
install-ghc Configure whether Stack should automatically install
GHC when necessary.
package-index Configure Stack's package index
resolver Change the resolver key of the current project.
snapshot Change the snapshot of the current project.
system-ghc Configure whether Stack should use a system GHC
installation or not.
~~~
The `stack config set` commands allow the values of keys in YAML configuration
files to be set. See `stack config set` for the available keys.
!!! note
The `config set` commands support an existing key only in the form
`key: value` on a single line.
## The `stack config set install-ghc` command
~~~text
stack config set install-ghc [--global] true|false
~~~
`stack config set install-ghc true` or `false` sets the `install-ghc` key in a
YAML configuration file, accordingly. By default, the project-level
configuration file (`stack.yaml`, by default) is altered. The `--global` flag
specifies the user-specific global configuration file (`config.yaml`).
## The `stack config set package-index download-prefix` command
[:octicons-tag-24: 2.9.3](https://github.com/commercialhaskell/stack/releases/tag/v2.9.3)
~~~text
stack config set package-index download-prefix [--global] [URL]
~~~
`stack config set package-index download-prefix <url>` sets the
`download-prefix` key of the `package-index` key in a YAML configuration file,
accordingly. By default, the project-level configuration file (`stack.yaml`, by
default) is altered. The `--global` flag specifies the user-specific global
configuration file (`config.yaml`).
## The `stack config set resolver` command
~~~text
stack config set resolver SNAPSHOT
~~~
`stack config set resolver <snapshot>` sets the `resolver` key in the
project-level configuration file (`stack.yaml`, by default).
A snapshot of `lts` or `nightly` will be translated into the most recent
available. A snapshot of `lts-22` will be translated into the most recent
available in the `lts-22` sequence.
Known bug:
* The command does not respect the presence of a `snapshot` key.
## The `stack config set snapshot` command
[:octicons-tag-24: 2.15.1](https://github.com/commercialhaskell/stack/releases/tag/v2.15.1)
~~~text
stack config set snapshot SNAPSHOT
~~~
`stack config set snapshot <snapshot>` sets the `snapshot` key in the
project-level configuration file (`stack.yaml`, by default).
A snapshot of `lts` or `nightly` will be translated into the most recent
available. A snapshot of `lts-22` will be translated into the most recent
available in the `lts-22` sequence.
Known bug:
* The command does not respect the presence of a `resolver` key.
## The `stack config set system-ghc` command
~~~text
stack config set system-ghc [--global] true|false
~~~
`stack config set system-ghc true` or `false` sets the `system-ghc` key in a
YAML configuration file, accordingly. By default, the project-level
configuration file (`stack.yaml`, by default) is altered. The `--global` flag
specifies the user-specific global configuration file (`config.yaml`).
|