[Top][All Lists]

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

Re: Building packages in REPL

From: Ludovic Courtès
Subject: Re: Building packages in REPL
Date: Fri, 24 Jul 2020 16:38:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)


zimoun <> skribis:

> On Fri, 26 Jun 2020 at 06:17, Julien Lepiller <> 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:
> (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)))

(guix scripts) has a high-level ‘build-package’ procedure (initially
written for Emacs-Guix) that can be used like this:

--8<---------------cut here---------------start------------->8---
$ guix repl
GNU Guile 3.0.4
Copyright (C) 1995-2020 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guix-user)> ,use(guix)
scheme@(guix-user)> ,use(guix scripts)
scheme@(guix-user)> ,use(gnu packages base)
scheme@(guix-user)> (build-package coreutils)
$1 = #<procedure 7f2170c05540 at guix/scripts.scm:122:2 (state)>
scheme@(guix-user)> ,run-in-store (build-package coreutils)
$2 = #t
--8<---------------cut here---------------end--------------->8---



reply via email to

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