Subject: [PATCH v2 1/4] gnu: racket: Fix layered documentation rendering.

From: Philip McGrath <[email-masked]>
Date: Fri, 20 Oct 2023 22:01:11 -0400

We want to create additional Guix packages (e.g. 'racket-with-video')
that extend our 'racket' package as the 'racket' package extends
'racket-minimal', using Racket’s support for “layered installations”.
Without this fix, rendering the documentation for the new layer would
try to write to the parent layer in the store, breaking the build.

See upstream discussion at <https://github.com/racket/racket/pull/4802>.

* gnu/packages/racket.scm (racket)[inputs]: Add an additional snippet to
'%racket-origin' when used for the Racket package 'racket-index'.
---
 gnu/packages/racket.scm | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index 1e97f19dbb..a127f75669 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -676,7 +676,18 @@ (define-public racket
        "algol60" (base32 "03akd7xhn4l7y66qgaimvdbn6gq7ay6j03dc11mz80n06z21dfb6")
        '(("algol60" ".")))
       (racket-packages-origin
-       "racket" %racket-origin
+       "racket" (origin
+                  (inherit %racket-origin)
+                  (snippet
+                   ;; Workaround for https://github.com/racket/racket/pull/4802
+                   ;; TODO: When updating to Racket 8.11, include the upstream
+                   ;; fix in %racket-origin (probably as a patch).
+                   #~(begin
+                       #$(origin-snippet %racket-origin)
+                       (substitute*
+                           "pkgs/racket-index/scribblings/main/info.rkt"
+                         (("no-depend-on[)]")
+                          "no-depend-on every-main-layer)")))))
        '(("at-exp-lib" "pkgs/at-exp-lib")
          ("compiler" "pkgs/compiler")
          ("compiler-lib" "pkgs/compiler-lib")
-- 
2.41.0