From 9236047476e728b9ae1746d56b8547e023f72307 Mon Sep 17 00:00:00 2001 From: Sören Tempel Date: Tue, 19 Dec 2023 11:05:32 +0100 Subject: gnu: ghc-9.2: Make Cabal respect GHC_PACKAGE_PATH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **tl;dr** Applying this patch makes Cabal work in Guix environments and ensures that Cabal picks up Haskell packages installed via Guix. Guix makes heavy use of GHC_PACKAGE_PATH to make GHC pickup Haskell packages installed via the Guix package manager. The environment variable is set using native-search-paths from the GHC packages. Unfortunately, upstream Cabal does presently not respect GHC_PACKAGE_PATH. If this environment variable is set, `cabal build` and other commands will terminate. For building packages, Guix does not make much use of cabal-install hence this is not as big of an issue. However, cabal-install does therefore presently not work out-of-the-box in environments created by Guix. For example, in `guix shell` environments. This makes it essentially impossible to use Guix for setting up development environments for Haskell software. Cabal upstream is aware of this issue and a patch exists to workaround this problem. The patch is currently not merged upstream due to issues related to reconfiguration (changing GHC_PACKAGE_PATH between `cabal configure` and `cabal build`). However, I would argue that this edge case is not that relevant for Guix and therefore propose including this patch with the Cabal Guix package. As outlined above, cabal-install is not usable by default presently, and I would therefore argue that this is a major improvement over the current situation. I am willing to work with Cabal upstream to have this issue fixed upstream eventually. Note that this requires patching the GHC package instead of the cabal-install package as Guix uses the version of the Cabal package distributed with GHC. See: https://github.com/haskell/cabal/issues/3728 * gnu/packages/haskell-apps.scm (cabal-install): Include patch to support the GHC_PACKAGE_PATH environment variable. Signed-off-by: Sören Tempel Signed-off-by: Lars-Dominik Braun Change-Id: Ib77ffa937b878690d0e2d8964b534842b99da039 --- gnu/local.mk | 1 + 1 file changed, 1 insertion(+) (limited to 'gnu/local.mk') diff --git a/gnu/local.mk b/gnu/local.mk index d0cc62dd57..93b0968b28 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1330,6 +1330,7 @@ dist_patch_DATA = \ %D%/packages/patches/geoclue-config.patch \ %D%/packages/patches/gettext-libunicode-update.patch \ %D%/packages/patches/ghc-8.0-fall-back-to-madv_dontneed.patch \ + %D%/packages/patches/ghc-9.2-cabal-support-package-path.patch \ %D%/packages/patches/ghc-9.2-glibc-2.33-link-order.patch \ %D%/packages/patches/ghc-9.2-grep-warnings.patch \ %D%/packages/patches/ghc-testsuite-dlopen-pie.patch \ -- cgit v1.2.3