unofficial mirror of help-guix@gnu.org 
 help / color / Atom feed
* Building packages in REPL
@ 2020-06-26  5:13 Anthony Quizon
  2020-06-26  7:25 ` Konrad Hinsen
  0 siblings, 1 reply; 7+ 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] 7+ 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; 7+ 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] 7+ 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; 7+ 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] 7+ 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; 7+ 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] 7+ messages in thread

* Re: Building packages in REPL
  2020-06-26 10:17     ` Julien Lepiller
@ 2020-06-26 10:44       ` zimoun
  0 siblings, 0 replies; 7+ 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] 7+ 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; 7+ 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] 7+ 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; 7+ messages in thread
From: Anthony Quizon @ 2020-06-30  7:58 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: help-guix

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] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ 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-06-26 14:26     ` Efraim Flashner
2020-06-30  7:58       ` Anthony Quizon

unofficial mirror of help-guix@gnu.org 

Archives are clonable:
	git clone --mirror https://yhetil.org/guix-user/0 guix-user/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-user guix-user/ https://yhetil.org/guix-user \
		help-guix@gnu.org
	public-inbox-index guix-user

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.user
	nntp://news.gmane.io/gmane.comp.gnu.guix.user


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git