Skip to content

Commit f0d813e

Browse files
committed
Separate topics of snapshot and package location
1 parent 354b563 commit f0d813e

File tree

5 files changed

+115
-133
lines changed

5 files changed

+115
-133
lines changed

doc/configure/yaml/project.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ currently four snapshot types:
4444
* No snapshot, just use packages shipped with the compiler. For GHC this looks
4545
like `snapshot: ghc-9.6.5`
4646
* Custom snapshot, via a URL or relative file path. For further information, see
47-
the [snapshot and package location](../../topics/pantry.md) documentation.
47+
the [snapshot location](../../topics/snapshot_location.md) documentation.
4848

4949
Each of these snapshots will also determine what constraints are placed on the
5050
compiler version. See the [compiler-check](non-project.md#compiler-check) option
@@ -122,7 +122,8 @@ A Pantry package location is one or three different kinds of sources:
122122
* a Git or Mercurial repository.
123123

124124
For further information on the format for specifying a Pantry package location,
125-
see the [Pantry](../../topics/pantry.md) documentation. For example:
125+
see the [package location](../../topics/package_location.md) documentation. For
126+
example:
126127

127128
~~~yaml
128129
extra-deps:

doc/faq.md

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -152,56 +152,28 @@
152152

153153
## Package-related
154154

155-
??? question "How do I use a package version not in a snapshot?"
155+
??? question "How do I use a package version on Hackage not in a snapshot?"
156156

157-
You can make tweaks to a snapshot by modifying the `extra-deps` configuration
158-
value in your `stack.yaml` file, e.g.:
159-
160-
~~~yaml
161-
snapshot: lts-22.21
162-
packages:
163-
- .
164-
extra-deps:
165-
- text-2.1.1@rev:0
166-
~~~
157+
Add the package version to the [`extra-deps`](configure/yaml/project.md)
158+
project-specific configuration option in the
159+
[project-level configuration file](configure/yaml/yaml_configuration.md).
167160

168161
??? question "How do I use a package version not on Hackage?"
169162

170-
Add it to the
171-
[`extra-deps`](configure/yaml/project-specific_configuration.md#extra-deps) list
172-
in your project's `stack.yaml` file, specifying the package's source code
173-
location relative to the directory where your `stack.yaml` file lives, e.g.
174-
175-
~~~yaml
176-
snapshot: lts-22.21
177-
packages:
178-
- .
179-
extra-deps:
180-
- third-party/proprietary-dep
181-
- github-version-of/conduit
182-
- patched/diagrams
183-
~~~
163+
Add the location of the package version to the
164+
[`extra-deps`](configure/yaml/project.md) project-specific configuration
165+
option in the
166+
[project-level configuration file](configure/yaml/yaml_configuration.md).
184167

185-
The above example specifies that the `proprietary-dep` package is found in the
186-
project's `third-party` directory, that the `conduit` package is found in the
187-
project's `github-version-of` directory, and that the `diagrams` package is
188-
found in the project's `patched` directory. This autodetects changes and
189-
reinstalls the package.
190-
191-
To install packages directly from a Git repository, use e.g.:
192-
193-
~~~yaml
194-
extra-deps:
195-
- git: https://github.com/githubuser/reponame.git
196-
commit: somecommitID
197-
~~~
168+
For further information, see the
169+
[package location](topics/package_location.md) documentation.
198170

199171
??? question "How do I use a modified upstream package?"
200172

201-
Typically, you will want to get the source for the package and then add it to
202-
your `packages` list in the `stack.yaml` file. (See the previous question.)
203-
`stack unpack` is one approach for getting the source. Another would be to add
204-
the upstream package as a submodule to your project.
173+
Typically, you will want to get the source for the package and then add it
174+
to your `packages` list in the `stack.yaml` file. (See the previous
175+
question.) `stack unpack` is one approach for getting the source. Another
176+
would be to add the upstream package as a submodule to your project.
205177

206178
??? question "I'd like to use my installed packages in a different directory. How do I tell Stack where to find my packages?"
207179

doc/topics/index.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ This part of the guide provides pages dedicated to specific topics.
1616
: Stack work directories are directories within a local project or package
1717
directory in which Stack stores files created during the build process.
1818

19-
[Snapshot and package location](pantry.md)
19+
[Snapshot location](snapshot_location.md)
2020

21-
: How to specify the location of snapshots or packages.
21+
: How to specify the location of snapshots.
22+
23+
[Package location](package_location.md)
24+
25+
: How to specify the location of packages.
2226

2327
[Snapshot specification](custom_snapshot.md)
2428

doc/topics/pantry.md renamed to doc/topics/package_location copy.md

Lines changed: 12 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,17 @@
11
<div class="hidden-warning"><a href="https://docs.haskellstack.org/"><img src="https://rawgit.com/commercialhaskell/stack/master/doc/img/hidden-warning.svg"></a></div>
22

3-
# Snapshot and package location
3+
# Package location
44

55
[:octicons-tag-24: 2.1.1](https://github.com/commercialhaskell/stack/releases/tag/v2.1.1)
66

7-
This document describes:
8-
9-
* the specification of a snapshot location (in the
10-
[`snapshot`](../configure/yaml/project.md#snapshot) or
11-
[`resolver`](../configure/yaml/project.md#resolver) key)
12-
* the specification of a package location (in the `extra-deps` key and in a
13-
snapshot)
7+
This document describes the specification of a package location (in the
8+
`extra-deps` key and in a snapshot).
149

1510
!!! info
1611

1712
Stack uses the [Pantry](https://hackage.haskell.org/package/pantry) to
18-
specify the location of snapshots and packages. Pantry is geared towards
19-
reproducible build plans with cryptographically secure specification of
20-
snapshots and packages.
21-
22-
## Snapshot location
23-
24-
There are essentially four different ways of specifying a snapshot location:
25-
26-
1. Via a compiler version, which is a "compiler only" snapshot. This could be,
27-
for example:
28-
29-
~~~yaml
30-
snapshot: ghc-8.6.5
31-
~~~
32-
33-
2. Via a URL pointing to a snapshot configuration file, for example:
34-
35-
~~~yaml
36-
snapshot: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2018/8/21.yaml`
37-
~~~
38-
39-
3. Via a local file path pointing to a snapshot configuration file, for
40-
example:
41-
42-
~~~yaml
43-
snapshot: my-local-snapshot.yaml
44-
~~~
45-
46-
4. Via a _convenience synonym_, which provides a short form for some common
47-
URLs. These are:
48-
49-
* GitHub: `github:user/repo:path` is treated as:
50-
51-
~~~text
52-
https://raw.githubusercontent.com/user/repo/master/path
53-
~~~
54-
55-
* LTS Haskell: `lts-X.Y` is treated (by default) as:
56-
57-
~~~text
58-
github:commercialhaskell/stackage-snapshots:lts/X/Y.yaml
59-
~~~
60-
61-
* Stackage Nightly: `nightly-YYYY-MM-DD` is treated (by default) as:
62-
63-
~~~text
64-
github:commercialhaskell/stackage-snapshots:nightly/YYYY/M/D.yaml
65-
~~~
66-
67-
!!! info
68-
69-
By default, LTS Haskell and Stackage Nightly snapshot configurations are
70-
retrieved from the `stackage-snapshots` GitHub repository of user
71-
`commercialhaskell`. The
72-
[snapshot-location-base](../configure/yaml/non-project.md#snapshot-location-base)
73-
option allows a custom location to be set.
74-
75-
For safer, more reproducible builds, you can optionally specify a URL
76-
together with a cryptographic hash of its content. For example:
77-
78-
~~~yaml
79-
snapshot:
80-
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/12/0.yaml
81-
size: 499143
82-
sha256: 781ea577595dff08b9c8794761ba1321020e3e1ec3297fb833fe951cce1bee11
83-
~~~
84-
85-
`size` is the number of bytes in the file and `sha256` is the file's SHA256
86-
hash. If not provided, the information will automatically be generated and
87-
stored in a [lock file](lock_files.md).
88-
89-
## Package location
13+
specify the location of packages. Pantry is geared towards reproducible
14+
build plans with cryptographically secure specification of packages.
9015

9116
There are three types of package locations:
9217

@@ -98,7 +23,7 @@ All three types support optional tree metadata to be added, which can be used
9823
for reproducibility and faster downloads. This information can automatically be
9924
generated in a [lock file](lock_files.md).
10025

101-
### Hackage packages
26+
## Hackage packages
10227

10328
A package can be identified by its name, version and Cabal file revision
10429
number, with revision `0` being the original Cabal file. For example:
@@ -158,7 +83,7 @@ provided in Stack's lock file. For further information, see the
15883
alternative is also what Stack uses when it makes suggestions about missing
15984
packages.
16085

161-
### Git and Mercurial repositories
86+
## Git and Mercurial repositories
16287

16388
You can specify a Git or Mercurial repository at a specific commit, and Stack
16489
will clone that repository and, if it has submodules (Git), update the
@@ -222,7 +147,7 @@ the root of the repository. If you specify a value of `subdirs`, then `'.'` is
222147
_not_ included by default and needs to be explicitly specified if a required
223148
package is found in the top-level directory of the repository.
224149

225-
#### git-annex
150+
### git-annex
226151

227152
[git-annex](https://git-annex.branchable.com) is not supported. This is because
228153
`git archive` does not handle symbolic links outside the work tree. It is still
@@ -241,9 +166,9 @@ following line:
241166
fonts export-ignore
242167
~~~
243168

244-
### Local or remote archives (such as GitHub archives)
169+
## Local or remote archives (such as GitHub archives)
245170

246-
#### Filepaths or URLs to archive files
171+
### Filepaths or URLs to archive files
247172

248173
You can use filepaths referring to local archive files or HTTP or HTTPS URLs
249174
referring to remote archive files, either tarballs or ZIP files.
@@ -275,7 +200,7 @@ extra-deps:
275200
sha256: e563d8b524017a06b32768c4db8eff1f822f3fb22a90320b7e414402647b735b
276201
~~~
277202

278-
#### GitHub archive files
203+
### GitHub archive files
279204

280205
[:octicons-tag-24: 1.7.1](https://github.com/commercialhaskell/stack/releases/tag/v1.7.1)
281206

@@ -294,7 +219,7 @@ extra-deps:
294219
An archive file of the files in a GitHub repository at a point in its
295220
history is not the same as a clone of the repository (including its history)
296221
and the updating of any submodules. If you need the latter, use the syntax
297-
for a [Git repository](pantry.md#git-and-mercurial-repositories).
222+
for a [Git repository](#git-and-mercurial-repositories).
298223

299224
If the package fails to build due to missing files, it may be that updated
300225
submodules are required.

doc/topics/snapshot_location.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<div class="hidden-warning"><a href="https://docs.haskellstack.org/"><img src="https://rawgit.com/commercialhaskell/stack/master/doc/img/hidden-warning.svg"></a></div>
2+
3+
# Snapshot location
4+
5+
[:octicons-tag-24: 2.1.1](https://github.com/commercialhaskell/stack/releases/tag/v2.1.1)
6+
7+
This document describes the specification of a snapshot location (in the
8+
[`snapshot`](../configure/yaml/project.md#snapshot) or
9+
[`resolver`](../configure/yaml/project.md#resolver) key).
10+
11+
!!! info
12+
13+
Stack uses the [Pantry](https://hackage.haskell.org/package/pantry) to
14+
specify the location of snapshots. Pantry is geared towards reproducible
15+
build plans with cryptographically secure specification of snapshots.
16+
17+
There are essentially four different ways of specifying a snapshot location:
18+
19+
1. Via a compiler version, which is a "compiler only" snapshot. This could be,
20+
for example:
21+
22+
~~~yaml
23+
snapshot: ghc-8.6.5
24+
~~~
25+
26+
2. Via a URL pointing to a snapshot configuration file, for example:
27+
28+
~~~yaml
29+
snapshot: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2018/8/21.yaml`
30+
~~~
31+
32+
3. Via a local file path pointing to a snapshot configuration file, for
33+
example:
34+
35+
~~~yaml
36+
snapshot: my-local-snapshot.yaml
37+
~~~
38+
39+
4. Via a _convenience synonym_, which provides a short form for some common
40+
URLs. These are:
41+
42+
* GitHub: `github:user/repo:path` is treated as:
43+
44+
~~~text
45+
https://raw.githubusercontent.com/user/repo/master/path
46+
~~~
47+
48+
* LTS Haskell: `lts-X.Y` is treated (by default) as:
49+
50+
~~~text
51+
github:commercialhaskell/stackage-snapshots:lts/X/Y.yaml
52+
~~~
53+
54+
* Stackage Nightly: `nightly-YYYY-MM-DD` is treated (by default) as:
55+
56+
~~~text
57+
github:commercialhaskell/stackage-snapshots:nightly/YYYY/M/D.yaml
58+
~~~
59+
60+
!!! info
61+
62+
By default, LTS Haskell and Stackage Nightly snapshot configurations are
63+
retrieved from the `stackage-snapshots` GitHub repository of user
64+
`commercialhaskell`. The
65+
[snapshot-location-base](../configure/yaml/non-project.md#snapshot-location-base)
66+
option allows a custom location to be set.
67+
68+
For safer, more reproducible builds, you can optionally specify a URL
69+
together with a cryptographic hash of its content. For example:
70+
71+
~~~yaml
72+
snapshot:
73+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/12/0.yaml
74+
size: 499143
75+
sha256: 781ea577595dff08b9c8794761ba1321020e3e1ec3297fb833fe951cce1bee11
76+
~~~
77+
78+
`size` is the number of bytes in the file and `sha256` is the file's SHA256
79+
hash. If not provided, the information will automatically be generated and
80+
stored in a [lock file](lock_files.md).

0 commit comments

Comments
 (0)