Subject: [PATCH 3/3] gnu: idris: Add doc output and build the html documentation.

From: Attila Lendvai <[email-masked]>
Date: Thu, 14 Apr 2022 14:16:13 +0200

* gnu/packages/idris.scm (make-idris-package): Build the html docs and install
it into the doc output.
---
 gnu/packages/idris.scm | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/idris.scm b/gnu/packages/idris.scm
index 28e918a486..b9b309d6d5 100644
--- a/gnu/packages/idris.scm
+++ b/gnu/packages/idris.scm
@@ -50,7 +50,9 @@ (define-module (gnu packages idris)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages node)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages racket)
+  #:use-module (gnu packages sphinx)
   #:use-module (gnu packages version-control)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system haskell)
@@ -248,11 +250,17 @@ (define* (make-idris-package source idris-version
                bootstrap-idris)
            clang-toolchain-12 ; older clang-toolchain versions don't have a bin/cc
            coreutils which git
-           node                         ; only for the tests
-           racket                       ; only for the tests
-           sed))
+           sed
+           ;; Only for the tests
+           node
+           racket
+           ;; Only for the docs
+           python-minimal
+           python-sphinx
+           python-sphinx-rtd-theme))
     (inputs
      (list bash-minimal chez-scheme gmp))
+    (outputs '("out" "doc"))
     (arguments
      (list
       #:tests? tests?
@@ -275,6 +283,15 @@ (define* (make-idris-package source idris-version
          (delete 'bootstrap)
          (delete 'configure)
          (delete 'check)    ; check must happen after install and wrap-program
+         (add-before 'build 'build-doc
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "make" "--directory" "docs/" "html")))
+         (add-after 'build-doc 'install-doc
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((doc (assoc-ref outputs "doc")))
+               (copy-recursively "docs/build/html"
+                                 (string-append doc "/share/doc/"
+                                                ,name "-" ,version)))))
          (add-after 'unpack 'patch-paths
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((files-to-patch (filter file-exists?
-- 
2.35.1