Subject: [bug#76581] [PATCH 2/2] gnu: age, age-keygen: Install manpages.

From: Nicolas Graves <[email-masked]>
Date: Wed, 26 Feb 2025 10:37:25 +0100

* gnu/packages/golang-crypto.scm (age, age-keygen)[arguments]{phases}:
Add phase 'install-doc.
(go-filippo-io-age): Remove other doc files.
---
 gnu/packages/golang-crypto.scm | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/golang-crypto.scm b/gnu/packages/golang-crypto.scm
index 3ff3c39698..74df6b8e99 100644
--- a/gnu/packages/golang-crypto.scm
+++ b/gnu/packages/golang-crypto.scm
@@ -139,6 +139,13 @@ (define-public go-filippo-io-age
        (modules '((guix build utils)))
        (snippet
         #~(begin
+            ;; Age source bundles manpages already. Seems OK not to rebuild
+            ;; them with ronn, they are pretty auditable.
+            (with-directory-excursion "doc"
+              (for-each delete-file '("age.1.html"
+                                      "age.1.ronn"
+                                      "age-keygen.1.html"
+                                      "age-keygen.1.ronn")))
             (substitute* '("cmd/age/age.go"
                            "cmd/age-keygen/keygen.go")
               (("var Version string")
@@ -2598,16 +2605,28 @@ (define-public age
                           (list "testdata/scrypt.txt"
                                 "testdata/output_file.txt"
                                 "testdata/encrypted_keys.txt"
-                                "testdata/terminal.txt"))))))))))
+                                "testdata/terminal.txt")))))
+          (add-after 'install 'install-doc
+            (lambda _
+              (let ((man (string-append #$output "/man/man1/")))
+                (install-file "src/filippo.io/age/doc/age.1" man)))))))))
 
 (define-public age-keygen
   (package
     (inherit go-filippo-io-age)
     (name "age-keygen")
     (arguments
-     `(#:import-path "filippo.io/age/cmd/age-keygen"
-       #:unpack-path "filippo.io/age"
-       #:install-source? #f))))
+     (list
+      #:import-path "filippo.io/age/cmd/age-keygen"
+      #:unpack-path "filippo.io/age"
+      #:install-source? #f
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'install 'install-doc
+            (lambda _
+              (let ((man (string-append #$output "/man/man1/")))
+                (install-file
+                 "src/filippo.io/age/doc/age-keygen.1" man)))))))))
 
 (define-public go-jwker
   (package/inherit go-github-com-jphastings-jwker
-- 
2.48.1

-- 
Best regards,
Nicolas Graves