help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do you write a package's deps to a file?


From: Bonface M. K.
Subject: Re: How do you write a package's deps to a file?
Date: Tue, 01 Dec 2020 21:04:22 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi all!

Was finally able to hack something that
works! See below:

zimoun <zimon.toutoune@gmail.com> writes:
>
> (And I am still interested by the answer of «is it possible to get the
> metadata of the inputs in phases?» :-))
>

Yes it's possible. The trick is to use
"this-package" which can *only* be used inside a
package definition and no where else. Stumbled
across that when poring through some guix package
definitions, moreso skriblio.

Here's my working phase:
--8<---------------cut here---------------start------------->8---
(add-after 'install 'generate-dependency-file
                 (lambda* (#:key inputs outputs #:allow-other-keys)
                   (call-with-output-file
                       (string-append
                        (assoc-ref outputs "out")
                        "/lib/python3.8/site-packages"
                        "/wqflask/DEPENDENCIES.md")
                     (lambda (port)
                       (format
                        port "
#### System Inputs (generated from Guix)
|Name | Version | Home Page | Description |
|-----|---------|-----------|-------------|
|~a|
"
                        ,(apply
                          string-append 
                          (map
                           (lambda (input)
                             (let* ((pkg (cadr input))
                                    (name (package-name pkg))
                                    (version (package-version pkg))
                                    (home-page (package-home-page pkg))
                                    (description (package-description pkg)))
                               (string-append
                                "| **" name "** | "
                                version " | "
                                home-page " | "
                                description " | "
                                " |\n")))
                              (package-propagated-inputs this-package)))))
                     )))
--8<---------------cut here---------------end--------------->8---

-- 
Bonface M. K. <https://www.bonfacemunyoki.com>
Chief Emacs Bazu / Rieng ya software sare
Mchochezi of: <https://upbookclub.com> / Twitter: @BonfaceKilz
GPG Key: D4F09EB110177E03C28E2FE1F5BBAE1E0392253F

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]