Skip to content

Commit 05acb2c

Browse files
committed
Nix: Added info to README about env vars & setup
1 parent b8bfe50 commit 05acb2c

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

doc/nix_integration.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ With Nix enabled, `stack build` and `stack exec` will automatically
115115
launch themselves in a local build environment (using `nix-shell`
116116
behind the scenes).
117117

118+
`stack setup` will start a nix-shell, so it will gather all the required
119+
packages, but given nix handles GHC installation, instead of stack, this will
120+
happen when running `stack build` if no setup has been performed
121+
before. Therefore it is not longer necessary to run `stack setup` unless you
122+
want to cache a GHC installation before running the build.
123+
118124
If `enable:` is omitted or set to `false`, you can still build in a nix-shell by
119125
passing the `--nix` flag to stack, for instance `stack --nix build`. Passing
120126
any `--nix*` option to the command line will do the same.
@@ -125,13 +131,18 @@ libraries.
125131

126132
### The Nix shell
127133

128-
By default, stack will run the build in a pure Nix build environment
129-
(or *shell*), which means the build should fail if you haven't
130-
specified all the dependencies in the `packages:` section of the
131-
`stack.yaml` file, even if these dependencies are installed elsewhere
132-
on your system. This behaviour enforces a complete description of the
133-
build environment to facilitate reproducibility. To override this
134-
behaviour, add `pure: false` to your `stack.yaml` or pass the
134+
By default, stack will run the build in a *pure* Nix build environment (or
135+
*shell*), which means two important things:
136+
137+
- basically **no environment variable will be forwarded** from your user session
138+
to the nix-shell (variables like `HTTP_PROXY` or `PATH` notably will not be
139+
available),
140+
- the build should fail if you haven't specified all the dependencies in the
141+
`packages:` section of the `stack.yaml` file, even if these dependencies are
142+
installed elsewhere on your system. This behaviour enforces a complete
143+
description of the build environment to facilitate reproducibility.
144+
145+
To override this behaviour, add `pure: false` to your `stack.yaml` or pass the
135146
`--no-nix-pure` option to the command line.
136147

137148
**Note:** On macOS shells are non-pure by default currently. This is

0 commit comments

Comments
 (0)