Subject: [bug#67921] [PATCH haskell-team 3/3] guix: haskell-build-system: Hide dependecies from ghc's package db

From: Saku Laesvuori <[email-masked]>
Date: Wed, 20 Dec 2023 09:13:49 +0200

A Haskell package P contains information about all other haskell
packages P_n it depends on. This commit hides the packages P_n in the
package database stored in P, which enables being explicit about which
haskell packages one wants to be visible in their profile.

* guix/build/haskell-build-system.scm
(register)[install-transitive-deps]: Set the 'exposed' field to False in
the dependencies' .conf files. Remove a comment about symlinking because
the copied files are now modified.

Fixes: https://issues.guix.gnu.org/66347
Change-Id: I66332cd49e6036689873d9435036c9f876216f1b
---
 guix/build/haskell-build-system.scm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/guix/build/haskell-build-system.scm b/guix/build/haskell-build-system.scm
index 0e94cf59a5..83c742427a 100644
--- a/guix/build/haskell-build-system.scm
+++ b/guix/build/haskell-build-system.scm
@@ -214,7 +214,10 @@ (define* (register #:key name system inputs outputs #:allow-other-keys)
                (unless dep-conf*-exists?
                  (unless dep-conf-exists?
                    (error (format #f "File ~a does not exist. This usually means the dependency ~a is missing. Was checking conf-file ~a." dep-conf id conf-file)))
-                 (copy-file dep-conf dep-conf*)) ;XXX: maybe symlink instead?
+                 (copy-file dep-conf dep-conf*)
+                 (substitute* dep-conf*
+                   (("(exposed:[ \t]*)True" _ field)
+                    (string-append field "False"))))
                 (loop (vhash-cons id #t seen) next-tail))
              (loop seen tail))))))
 
-- 
2.41.0