help-guix
[Top][All Lists]
Advanced

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

Re: Building packages in REPL


From: zimoun
Subject: Re: Building packages in REPL
Date: Fri, 26 Jun 2020 12:44:29 +0200

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 via email to

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