From af9cb087850b759f32ae0fad565cf4924650f3d7 Mon Sep 17 00:00:00 2001 From: Janus Troelsen Date: Tue, 5 Apr 2022 02:29:36 -0500 Subject: [PATCH 1/2] Document Stackage use with remote project config --- doc/cabal-project.rst | 2 ++ doc/nix-local-build.rst | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/doc/cabal-project.rst b/doc/cabal-project.rst index 52322a04b51..4e538274a4c 100644 --- a/doc/cabal-project.rst +++ b/doc/cabal-project.rst @@ -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 ------------------------ diff --git a/doc/nix-local-build.rst b/doc/nix-local-build.rst index bf3869f4eb3..e45bb1520b1 100644 --- a/doc/nix-local-build.rst +++ b/doc/nix-local-build.rst @@ -104,6 +104,32 @@ 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`: 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 + +.. _Stackage: https://stackage.org/ +.. _versions of packages in lts-19.2: https://www.stackage.org/lts-19.2 + How it works ============ From 79d84d59f31e31e425260e3290ae89b4ec8ab085 Mon Sep 17 00:00:00 2001 From: Janus Troelsen Date: Wed, 6 Apr 2022 17:26:51 -0500 Subject: [PATCH 2/2] Point out that cabal.project doesn't get distributed --- doc/nix-local-build.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/nix-local-build.rst b/doc/nix-local-build.rst index e45bb1520b1..19cca22c9f3 100644 --- a/doc/nix-local-build.rst +++ b/doc/nix-local-build.rst @@ -127,6 +127,10 @@ 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