unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: Julien Lepiller <julien@lepiller.eu>,
	help-guix@gnu.org, Konrad Hinsen <konrad.hinsen@fastmail.net>,
	Anthony Quizon <anthoq88@gmail.com>
Subject: Re: Building packages in REPL
Date: Fri, 26 Jun 2020 12:44:29 +0200	[thread overview]
Message-ID: <86tuyy9kdu.fsf@gmail.com> (raw)
In-Reply-To: <D6D026B5-2724-423D-8A54-E9380D29FDE4@lepiller.eu>

Hi Julien,

On Fri, 26 Jun 2020 at 06:17, Julien Lepiller <julien@lepiller.eu> wrote:

> One way to do this with the guix API is to get the derivation, then build it:
>
> (use-modules (guix derivations) (guix store) (gnu packages bash))
> (define package bash-minimal)
> (define store (open-connection))
> (define der (package-derivation store package))
> (build-derivations store (list der))
>
> Is that what you want?

Yes, but provides something like:

--8<---------------cut here---------------start------------->8---
(use-modules
 (guix store)
 (guix derivations)
 (guix packages))
 
(define (build-packages packages)
  (with-store store
    (let ((builds (map (lambda (package)
                         (package-derivation store package))
                       packages)))
      (build-derivations store builds))))

(define (build-package package)
  (build-packages (list package)))
--8<---------------cut here---------------end--------------->8---

Because otherwise, you need to know "package-derivation" and
"build-derivation" and where they are (I run 'ag' or 'git-grep'
to find them which is not handy).  And for example, I knew it was
possible but it was not "obvious". :-)

Cheers,
simon





  reply	other threads:[~2020-06-26 10:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-26  5:13 Building packages in REPL Anthony Quizon
2020-06-26  7:25 ` Konrad Hinsen
2020-06-26 10:00   ` zimoun
2020-06-26 10:17     ` Julien Lepiller
2020-06-26 10:44       ` zimoun [this message]
2020-07-24 14:38         ` Ludovic Courtès
2020-07-27 14:13           ` Pierre Neidhardt
2020-07-27 23:30           ` zimoun
2021-03-20 10:57           ` Xinglu Chen
2020-06-26 14:26     ` Efraim Flashner
2020-06-30  7:58       ` Anthony Quizon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86tuyy9kdu.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=anthoq88@gmail.com \
    --cc=help-guix@gnu.org \
    --cc=julien@lepiller.eu \
    --cc=konrad.hinsen@fastmail.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).