Subject: [bug#75408] [PATCH] guix: profiles: Add new manifest generator.

From: Romain GARBAGE <[email-masked]>
Date: Mon, 6 Jan 2025 16:37:25 +0100

* guix/profiles.scm (build-system->manifest): New variable.
* doc/guix.texi (Writing Manifests): Document new procedure.

Change-Id: Ib8336232a0cd17168d7ea6aac5d9ee301309f12a
---
 doc/guix.texi     | 15 +++++++++++++++
 guix/profiles.scm | 15 +++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index da4d2f5ebc..309c48dcc4 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -9068,6 +9068,21 @@ line, which can often be more convenient.
 
 @c TODO: specifications->package, etc.
 
+@deffn {Procedure} build-system->manifest build-system
+Given @var{build-system}, a variable referring to a build system value
+suitable for the @code{build-system} field in the @code{package} record
+type.
+
+In order to be able to use a build system variable, the corresponding
+module must be loaded, as in the following example:
+
+@lisp
+(use-modules (guix build-system  cmake))
+
+(build-system->manifest cmake-build-system)
+@end lisp
+@end deffn
+
 
 @node Build Systems
 @section Build Systems
diff --git a/guix/profiles.scm b/guix/profiles.scm
index a28cf872cf..b31943fe15 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -127,6 +127,7 @@ (define-module (guix profiles)
             package->manifest-entry
             package->development-manifest
             packages->manifest
+            build-system->manifest
             ca-certificate-bundle
             %default-profile-hooks
             %manifest-format-version
@@ -454,6 +455,20 @@ (define (inferior->entry)
          packages)
     manifest-entry=?)))
 
+(define (build-system->manifest build-system)
+  "Return a manifest containing the list of packages pulled by BUILD-SYSTEM, a
+variable that defines a build system suitable for the PACKAGE record type."
+  (let ((empty-package (package
+                         (name "empty")
+                         (version "1")
+                         (source #f)
+                         (build-system build-system)
+                         (home-page #f)
+                         (synopsis #f)
+                         (description #f)
+                         (license #f))))
+    (package->development-manifest empty-package)))
+
 (define %manifest-format-version
   ;; The current manifest format version.
   4)

base-commit: 831b94a1efcea8f793afc949b5123a6235c9bb1a
-- 
2.46.0