* Building packages in REPL
@ 2020-06-26 5:13 Anthony Quizon
2020-06-26 7:25 ` Konrad Hinsen
0 siblings, 1 reply; 11+ messages in thread
From: Anthony Quizon @ 2020-06-26 5:13 UTC (permalink / raw)
To: help-guix
Is there a way that I can build a package via the repl?
For example,
If I had a channel with a custom package in it, can I do:
`$ guix repl -L .`
`> ,use (my-channel packages base) `
`> (build-package my-package) ;; this is the example imaginary command `
Is something like this possible? I wasn't able to find it in the docs.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building packages in REPL
2020-06-26 5:13 Building packages in REPL Anthony Quizon
@ 2020-06-26 7:25 ` Konrad Hinsen
2020-06-26 10:00 ` zimoun
0 siblings, 1 reply; 11+ messages in thread
From: Konrad Hinsen @ 2020-06-26 7:25 UTC (permalink / raw)
To: Anthony Quizon, help-guix
Anthony Quizon <anthoq88@gmail.com> writes:
> Is there a way that I can build a package via the repl?
As far as I know, no. I have been looking for this as well,
in order to make package development more interactive.
> For example,
> If I had a channel with a custom package in it, can I do:
>
> `$ guix repl -L .`
> `> ,use (my-channel packages base) `
> `> (build-package my-package) ;; this is the example imaginary command `
I'd even want more: access to the individual build steps.
Konrad
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building packages in REPL
2020-06-26 7:25 ` Konrad Hinsen
@ 2020-06-26 10:00 ` zimoun
2020-06-26 10:17 ` Julien Lepiller
2020-06-26 14:26 ` Efraim Flashner
0 siblings, 2 replies; 11+ messages in thread
From: zimoun @ 2020-06-26 10:00 UTC (permalink / raw)
To: Konrad Hinsen, Anthony Quizon, help-guix
Dear,
On Fri, 26 Jun 2020 at 09:25, Konrad Hinsen <konrad.hinsen@fastmail.net> wrote:
> Anthony Quizon <anthoq88@gmail.com> writes:
>
>> Is there a way that I can build a package via the repl?
Well, it is not what you are asking I guess, but it is possible:
--8<---------------cut here---------------start------------->8---
$ guix repl
scheme@(guix-user)> (use-modules (guix scripts build))
scheme@(guix-user)> (guix-build "-L" "." "bonjour")
/gnu/store/m658csbnly6zywfl5nax9glya3rzhbdy-bonjour-2.10
--8<---------------cut here---------------end--------------->8---
And there is no '~' expansion so "-L" "~/somewhere" does not work.
> As far as I know, no. I have been looking for this as well,
> in order to make package development more interactive.
Well, I do not know enough the API but it should be added and exposed if
it does not exist yet. And the question is which level of granularity?
>> For example,
>> If I had a channel with a custom package in it, can I do:
>>
>> `$ guix repl -L .`
>> `> ,use (my-channel packages base) `
>> `> (build-package my-package) ;; this is the example imaginary command `
The entry point is "(guix scripts build)".
> I'd even want more: access to the individual build steps.
Do you mean the "phases"?
All the best,
simon
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building packages in REPL
2020-06-26 10:00 ` zimoun
@ 2020-06-26 10:17 ` Julien Lepiller
2020-06-26 10:44 ` zimoun
2020-06-26 14:26 ` Efraim Flashner
1 sibling, 1 reply; 11+ messages in thread
From: Julien Lepiller @ 2020-06-26 10:17 UTC (permalink / raw)
To: help-guix, zimoun, Konrad Hinsen, Anthony Quizon
Le 26 juin 2020 06:00:17 GMT-04:00, zimoun <zimon.toutoune@gmail.com> a écrit :
>Dear,
>
>On Fri, 26 Jun 2020 at 09:25, Konrad Hinsen
><konrad.hinsen@fastmail.net> wrote:
>> Anthony Quizon <anthoq88@gmail.com> writes:
>>
>>> Is there a way that I can build a package via the repl?
>
>Well, it is not what you are asking I guess, but it is possible:
>
>--8<---------------cut here---------------start------------->8---
>$ guix repl
>scheme@(guix-user)> (use-modules (guix scripts build))
>scheme@(guix-user)> (guix-build "-L" "." "bonjour")
>/gnu/store/m658csbnly6zywfl5nax9glya3rzhbdy-bonjour-2.10
>--8<---------------cut here---------------end--------------->8---
>
>And there is no '~' expansion so "-L" "~/somewhere" does not work.
>
>> As far as I know, no. I have been looking for this as well,
>> in order to make package development more interactive.
>
>Well, I do not know enough the API but it should be added and exposed
>if
>it does not exist yet. And the question is which level of granularity?
>
>
>>> For example,
>>> If I had a channel with a custom package in it, can I do:
>>>
>>> `$ guix repl -L .`
>>> `> ,use (my-channel packages base) `
>>> `> (build-package my-package) ;; this is the example imaginary
>command `
>
>The entry point is "(guix scripts build)".
>
>> I'd even want more: access to the individual build steps.
>
>Do you mean the "phases"?
>
>
>All the best,
>simon
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?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building packages in REPL
2020-06-26 10:17 ` Julien Lepiller
@ 2020-06-26 10:44 ` zimoun
2020-07-24 14:38 ` Ludovic Courtès
0 siblings, 1 reply; 11+ messages in thread
From: zimoun @ 2020-06-26 10:44 UTC (permalink / raw)
To: Julien Lepiller, help-guix, Konrad Hinsen, Anthony Quizon
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building packages in REPL
2020-06-26 10:00 ` zimoun
2020-06-26 10:17 ` Julien Lepiller
@ 2020-06-26 14:26 ` Efraim Flashner
2020-06-30 7:58 ` Anthony Quizon
1 sibling, 1 reply; 11+ messages in thread
From: Efraim Flashner @ 2020-06-26 14:26 UTC (permalink / raw)
To: zimoun; +Cc: help-guix, Anthony Quizon
[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]
On Fri, Jun 26, 2020 at 12:00:17PM +0200, zimoun wrote:
> Dear,
>
> On Fri, 26 Jun 2020 at 09:25, Konrad Hinsen <konrad.hinsen@fastmail.net> wrote:
> > Anthony Quizon <anthoq88@gmail.com> writes:
> >
> >> Is there a way that I can build a package via the repl?
>
> Well, it is not what you are asking I guess, but it is possible:
>
> --8<---------------cut here---------------start------------->8---
> $ guix repl
> scheme@(guix-user)> (use-modules (guix scripts build))
> scheme@(guix-user)> (guix-build "-L" "." "bonjour")
> /gnu/store/m658csbnly6zywfl5nax9glya3rzhbdy-bonjour-2.10
> --8<---------------cut here---------------end--------------->8---
>
As a side note, the various guix-foo commands from guix/scripts/* have
an undefined return value so you can't check for #t or anything to see
if a package built.
--
Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building packages in REPL
2020-06-26 14:26 ` Efraim Flashner
@ 2020-06-30 7:58 ` Anthony Quizon
0 siblings, 0 replies; 11+ messages in thread
From: Anthony Quizon @ 2020-06-30 7:58 UTC (permalink / raw)
To: Efraim Flashner; +Cc: help-guix@gnu.org
Cool thanks. I'll try these out
On Saturday, June 27, 2020, Efraim Flashner <efraim@flashner.co.il> wrote:
> On Fri, Jun 26, 2020 at 12:00:17PM +0200, zimoun wrote:
> > Dear,
> >
> > On Fri, 26 Jun 2020 at 09:25, Konrad Hinsen <konrad.hinsen@fastmail.net>
> wrote:
> > > Anthony Quizon <anthoq88@gmail.com> writes:
> > >
> > >> Is there a way that I can build a package via the repl?
> >
> > Well, it is not what you are asking I guess, but it is possible:
> >
> > --8<---------------cut here---------------start------------->8---
> > $ guix repl
> > scheme@(guix-user)> (use-modules (guix scripts build))
> > scheme@(guix-user)> (guix-build "-L" "." "bonjour")
> > /gnu/store/m658csbnly6zywfl5nax9glya3rzhbdy-bonjour-2.10
> > --8<---------------cut here---------------end--------------->8---
> >
>
> As a side note, the various guix-foo commands from guix/scripts/* have
> an undefined return value so you can't check for #t or anything to see
> if a package built.
>
> --
> Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר
> GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
> Confidentiality cannot be guaranteed on emails sent or received unencrypted
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building packages in REPL
2020-06-26 10:44 ` zimoun
@ 2020-07-24 14:38 ` Ludovic Courtès
2020-07-27 14:13 ` Pierre Neidhardt
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Ludovic Courtès @ 2020-07-24 14:38 UTC (permalink / raw)
To: zimoun; +Cc: Anthony Quizon, help-guix
Hi,
zimoun <zimon.toutoune@gmail.com> skribis:
> 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:
>
> (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)
/gnu/store/yvsd53rkbvy9q8ak6681hai62nm6rf31-coreutils-8.32-debug
/gnu/store/n8awazyldv9hbzb7pjcw76hiifmvrpvd-coreutils-8.32
$2 = #t
--8<---------------cut here---------------end--------------->8---
HTH!
Ludo’.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building packages in REPL
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
2 siblings, 0 replies; 11+ messages in thread
From: Pierre Neidhardt @ 2020-07-27 14:13 UTC (permalink / raw)
To: Ludovic Courtès, zimoun; +Cc: help-guix, Anthony Quizon
[-- Attachment #1: Type: text/plain, Size: 380 bytes --]
Hi!
Thank you Ludovic for sharing these REPL commands.
I cannot build packages this way in Geiser though, because unless a
substitute is available, the Geiser buffer chokes on the very large
output.
Does anyone know how to work around this limitation?
Does anyone build Guix packages from the Geiser REPL?
Cheers!
--
Pierre Neidhardt
https://ambrevar.xyz/
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building packages in REPL
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
2 siblings, 0 replies; 11+ messages in thread
From: zimoun @ 2020-07-27 23:30 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: Anthony Quizon, help-guix
Hi Ludo’,
On Fri, 24 Jul 2020 at 16:38, Ludovic Courtès <ludo@gnu.org> wrote:
> (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
[...]
> scheme@(guix-user)> ,use(guix)
> scheme@(guix-user)> ,use(guix scripts)
> --8<---------------cut here---------------end--------------->8---
Really cool!
Maybe “build-package“ could be imported with ",use(guix)" or moved
elsewhere than (guix scripts) which is maybe not the natural place.
All the best,
simon
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Building packages in REPL
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
2 siblings, 0 replies; 11+ messages in thread
From: Xinglu Chen @ 2021-03-20 10:57 UTC (permalink / raw)
To: Ludovic Courtès, zimoun; +Cc: help-guix, Anthony Quizon
On Fri, Jul 24 2020, Ludovic Courtès wrote:
> (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)
> /gnu/store/yvsd53rkbvy9q8ak6681hai62nm6rf31-coreutils-8.32-debug
> /gnu/store/n8awazyldv9hbzb7pjcw76hiifmvrpvd-coreutils-8.32
> $2 = #t
> --8<---------------cut here---------------end--------------->8---
>
> HTH!
This is great, but if the build fails I just get an error message, there
is not output regarding where and why it failed.
--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,run-in-store (build-package prot-common)
The following derivations will be built:
/gnu/store/scjj4z453cwh88nlrkbxhllvkdyr90h0-prot-common-0.drv
/gnu/store/px4b6c5sc819pjdpn53sh12p3ahyja9n-prot-common.el.drv
While executing meta-command:
ERROR:
1. &store-protocol-error:
message: "build of `/gnu/store/scjj4z453cwh88nlrkbxhllvkdyr90h0-prot-common-0.drv' failed"
status: 1
--8<---------------cut here---------------end--------------->8---
Is there way to make it ouput the same thing as it would if I ran `guix
build` on the CLI?
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-03-20 10:58 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.