Skip to content

Document Stackage use with remote project config #8083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/cabal-project.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ options):
Any call to ``cabal build`` will consider ``cabal.project*`` files from parent
directories when there is none in the current directory.

.. _conditionals and imports:

Conditionals and imports
------------------------

Expand Down
30 changes: 30 additions & 0 deletions doc/nix-local-build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,36 @@ for each package using :cfg-field:`profiling-detail`::
Alternately, you can call ``cabal v2-build --enable-profiling`` to
temporarily build with profiling.

How can I have a reproducible set of versions for my dependencies?
------------------------------------------------------------------

You can use ``cabal freeze`` to save the solver results to a file.

Since Cabal 3.8, an alternative approach is to use a :ref:`remote project
configuration file<conditionals and imports>`: to specify a set of versions for
packages.

One provider of such package sets is Stackage_, and its package sets are called
snapshots. The Stackage snapshots contain a set of packages from Hackage that
have all been verified to build with a given version of GHC.

For example, the snapshot named lts-19.2 contains versioned packages which all
compile on GHC 9.0.2. You can conveniently review the `versions of packages in
lts-19.2`_. Using the following ``cabal.project`` file, Cabal will use the
versions of packages that the this snapshot specifies:

::

packages: .
import https://www.stackage.org/lts-19.2/cabal.config

Please note that project files do not get bundled in Cabal package tarballs,
made using e.g. ``cabal sdist``. Project files are intended for use in local
development environments.

.. _Stackage: https://stackage.org/
.. _versions of packages in lts-19.2: https://www.stackage.org/lts-19.2

How it works
============

Expand Down