Skip to content

Commit 28e4f13

Browse files
committed
Update docs for new system-ghc: false default
1 parent 2191977 commit 28e4f13

3 files changed

Lines changed: 33 additions & 14 deletions

File tree

doc/GUIDE.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,7 @@ stack ghc, stack ghci, stack runghc, or stack exec
332332
```
333333

334334
Thankfully, the command is smart enough to know not to perform an installation
335-
twice. `setup` will either use the first GHC it finds on your PATH, or a sandboxed
336-
version after installing it. As the command output above indicates, you can use `stack
335+
twice. As the command output above indicates, you can use `stack
337336
path` for quite a bit of path information (which we'll play with more later).
338337
For now, we'll just look at where GHC is installed:
339338

doc/faq.md

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,23 +155,39 @@ the following line to your .cabal file:
155155

156156
## I already have GHC installed, can I still use stack?
157157

158-
Yes. stack will default to using whatever GHC is on your `PATH`. If that GHC is
159-
a compatible version with the snapshot you're using, it will simply use it.
160-
Otherwise, it will prompt you to run `stack setup`. Note that `stack setup`
161-
installs GHC into `~/.stack/programs/$platform/ghc-$version/` and not a global
162-
location.
158+
Yes. In its default configuration, stack will simply ignore any system GHC
159+
installation and use a sandboxed GHC that it has installed itself (typically
160+
via the `stack setup` command). You can find these sandboxed GHC installations
161+
in `~/.stack/programs/$platform/ghc-$version/`.
163162

164-
Note that GHC installation doesn't work for all OSes, so in some cases the
165-
first option will need to install GHC yourself.
163+
If you would like stack to use your system GHC installation, use the
164+
[`--system-ghc` flag](yaml_configuration.md#system-ghc) or run
165+
`stack config set system-ghc --global true` to make stack check your
166+
`PATH` for a suitable GHC by default.
167+
168+
Note that stack can only use a system GHC installation if its version is
169+
compatible with the configuration of the current project, particularly the
170+
[`resolver` setting](yaml_configuration.md#resolver).
171+
172+
Note that GHC installation doesn't work for all OSes, so in some cases you
173+
will need to use `system-ghc` and install GHC yourself.
166174

167175
## How does stack determine what GHC to use?
168176

169-
It uses the first GHC that it finds on the `PATH`. If that GHC does not comply
170-
with the various requirements (version, architecture) that your project needs,
171-
it will prompt you to run `stack setup` to get it. `stack` is fully aware of
172-
all GHCs that it has installed itself.
177+
In its default configuration, stack determines from the current project which
178+
GHC version, architecture etc. it needs. It then looks in
179+
`~/.stack/programs/$platform/ghc-$version/` for a compatible GHC, requesting
180+
to install one via `stack setup` if none is found.
181+
182+
If you are using the [`--system-ghc` flag](yaml_configuration.md/#system-ghc) or
183+
have configured `system-ghc: true` either in the project `stack.yaml`
184+
or the global `~/.stack/config.yaml`, stack will use the first GHC that it finds
185+
on your `PATH`, falling back on its sandboxed installations only if the found GHC
186+
doesn't comply with the various requirements (version, architecture) that your
187+
project needs.
173188

174-
See [this issue](https://github.com/commercialhaskell/stack/issues/420) for a detailed discussion.
189+
See [this issue](https://github.com/commercialhaskell/stack/issues/420) for a
190+
detailed discussion of stack's behavior when `system-ghc` is enabled.
175191

176192
## How do I upgrade to GHC 7.10.2 with stack?
177193

doc/travis_ci.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ situation is simple:
9292

9393
```yaml
9494
before_install:
95+
# Install stack as above
96+
# ...
97+
# Configure stack to use the system GHC installation
98+
- stack config set system-ghc --global true
9599
- export PATH=/opt/ghc/7.10.2/bin:$PATH
96100
97101
addons:

0 commit comments

Comments
 (0)