Paste number 342679: mandb profile hook for Guix

Paste number 342679: mandb profile hook for Guix
Pasted by: civodul
When:4 years, 8 months ago
Share:Tweet this! |
Paste contents:
Raw Source | XML | Display As
modified   guix/profiles.scm
@@ -586,10 +586,39 @@ MANIFEST.  Single-file bundles are required by programs such as Git and Lynx."
                     #:modules '((guix build utils))
                     #:local-build? #t))
+(define (manual-database manifest)
+  (define man-db                                  ;lazy reference
+    (module-ref (resolve-interface '(gnu packages man)) 'man-db))
+  (define build
+    #~(begin
+        (use-modules (guix build utils)
+                     (srfi srfi-1))
+        (define entries
+          (filter-map (lambda (directory)
+                        (let ((man (string-append directory "/share/man")))
+                          (and (directory-exists? man)
+                               man)))
+                      '#$(manifest-inputs manifest)))
+        (define man-directory
+          (string-append #$output "/share/man"))
+        (mkdir-p man-directory)
+        (setenv "MANPATH" (string-join entries ":"))
+        (zero? (system* (string-append #+man-db "/bin/mandb") "--debug"
+                        "-cu"))))
+  (gexp->derivation "manual-database" build
+                    #:modules '((guix build utils))
+                    #:local-build? #t))
 (define %default-profile-hooks
   ;; This is the list of derivation-returning procedures that are called by
   ;; default when making a non-empty profile.
   (list info-dir-file
+        manual-database

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.