Subject: [PATCH v3 2/2] gnu: age: Install manpages.

From: Sharlatan Hellseher <[email-masked]>
Date: Thu, 27 Feb 2025 10:33:59 +0000

From: Nicolas Graves <[email-masked]>

* gnu/packages/golang-crypto.scm (go-filippo-io-age): Remove other doc
files.
(age): [arguments] <phases>: Add 'install-man-pages.

Change-Id: I58e10755c907af5a67083fb22682efdd4c4b7c92
---
 gnu/packages/golang-crypto.scm | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/golang-crypto.scm b/gnu/packages/golang-crypto.scm
index b79fa01dbb2..b0420f2a043 100644
--- a/gnu/packages/golang-crypto.scm
+++ b/gnu/packages/golang-crypto.scm
@@ -14,7 +14,7 @@
 ;;; Copyright © 2021 Vagrant Cascadian <[email-masked]>
 ;;; Copyright © 2022 (unmatched-parenthesis <[email-masked]>
 ;;; Copyright © 2022 Tobias Geerinckx-Rice <[email-masked]>
-;;; Copyright © 2022, 2023 Nicolas Graves <[email-masked]>
+;;; Copyright © 2022, 2023, 2025 Nicolas Graves <[email-masked]>
 ;;; Copyright © 2023 Benjamin <[email-masked]>
 ;;; Copyright © 2023 Clément Lassieur <[email-masked]>
 ;;; Copyright © 2023 Felix Lechner <[email-masked]>
@@ -135,7 +135,17 @@ (define-public go-filippo-io-age
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "183iqzmdwk4b35vxrdg2gdzd4277yr5bgbgl9brqv3w1dap5v4pm"))))
+        (base32 "183iqzmdwk4b35vxrdg2gdzd4277yr5bgbgl9brqv3w1dap5v4pm"))
+       (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")))))))
     (build-system go-build-system)
     (arguments
      (list
@@ -2581,7 +2591,12 @@ (define-public age
                           `(,@arguments
                             #:import-path ,(string-append import-path cmd))))
                  (list "/cmd/age"
-                       "/cmd/age-keygen"))))))))
+                       "/cmd/age-keygen"))))
+            (add-after 'install 'install-man-pages
+              (lambda _
+                (let ((man (string-append #$output "/man/man1/")))
+                  (install-file "src/filippo.io/age/doc/age.1" man)
+                  (install-file "src/filippo.io/age/doc/age-keygen.1" man))))))))
     (native-inputs (package-propagated-inputs go-filippo-io-age))
     (propagated-inputs '())
     (inputs '())
-- 
2.48.1