all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* REPL example session for overriding a package?
@ 2017-01-24 13:33 Myles English
  2017-01-24 14:56 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Myles English @ 2017-01-24 13:33 UTC (permalink / raw)
  To: help-guix

Hello,

I am trying to make a package that inherits from an existing package and
overrides a *minimum* number of elements of the original package
definition.

Probably the most efficient way to do this would be to try out some
things in the REPL using tools from (gnu packages).  Having read a bit
about it I am finding it difficult to get my head around working in the
REPL, does anyone have an example session?


- get an element of a package definition
- substitute a nested element

Specifically, for the package eigen in (gnu packages algebra) I'd like
to remove, or maybe add to, the snippet.

Thanks,
Myles

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: REPL example session for overriding a package?
  2017-01-24 13:33 REPL example session for overriding a package? Myles English
@ 2017-01-24 14:56 ` Ludovic Courtès
  2017-01-24 15:05   ` Myles English
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2017-01-24 14:56 UTC (permalink / raw)
  To: Myles English; +Cc: help-guix

Hi Myles,

Myles English <mylesenglish@gmail.com> skribis:

> I am trying to make a package that inherits from an existing package and
> overrides a *minimum* number of elements of the original package
> definition.
>
> Probably the most efficient way to do this would be to try out some
> things in the REPL using tools from (gnu packages).  Having read a bit
> about it I am finding it difficult to get my head around working in the
> REPL, does anyone have an example session?
>
>
> - get an element of a package definition
> - substitute a nested element
>
> Specifically, for the package eigen in (gnu packages algebra) I'd like
> to remove, or maybe add to, the snippet.

Maybe something like this:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,use(gnu packages algebra)
scheme@(guile-user)> ,use(guix)
scheme@(guile-user)> (define my-eigen
		       (package
			 (inherit eigen)
			 (source (origin
				   (inherit (package-source eigen))
				   (snippet
				    `(begin
				       ,(origin-snippet (package-source eigen))
				       (display "hey there!\n")))))))
scheme@(guile-user)> (origin-snippet (package-source my-eigen))
$3 = (begin (substitute* "CMakeLists.txt" …))
--8<---------------cut here---------------end--------------->8---

The snippet here is really pasting together two pieces of code
(imperative code), which can be brittle (“unhygienic” in macro
parlance.)

HTH!

Ludo’.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: REPL example session for overriding a package?
  2017-01-24 14:56 ` Ludovic Courtès
@ 2017-01-24 15:05   ` Myles English
  0 siblings, 0 replies; 3+ messages in thread
From: Myles English @ 2017-01-24 15:05 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: help-guix



on [2017-01-24] at 14:56 Ludovic Courtès writes:

> Myles English <mylesenglish@gmail.com> skribis:
>
>> I am trying to make a package that inherits from an existing package and
>> overrides a *minimum* number of elements of the original package
>> definition.
>>
>> Probably the most efficient way to do this would be to try out some
>> things in the REPL using tools from (gnu packages).  Having read a bit
>> about it I am finding it difficult to get my head around working in the
>> REPL, does anyone have an example session?
>>
>>
>> - get an element of a package definition
>> - substitute a nested element
>>
>> Specifically, for the package eigen in (gnu packages algebra) I'd like
>> to remove, or maybe add to, the snippet.
>
> Maybe something like this:
>
> --8<---------------cut here---------------start------------->8---
> scheme@(guile-user)> ,use(gnu packages algebra)
> scheme@(guile-user)> ,use(guix)
> scheme@(guile-user)> (define my-eigen
> 		       (package
> 			 (inherit eigen)
> 			 (source (origin
> 				   (inherit (package-source eigen))
> 				   (snippet
> 				    `(begin
> 				       ,(origin-snippet (package-source eigen))
> 				       (display "hey there!\n")))))))
> scheme@(guile-user)> (origin-snippet (package-source my-eigen))
> $3 = (begin (substitute* "CMakeLists.txt" …))
> --8<---------------cut here---------------end--------------->8---
>
> The snippet here is really pasting together two pieces of code
> (imperative code), which can be brittle (“unhygienic” in macro
> parlance.)

Thank you Ludo' that's just what I am looking for.

Myles

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-24 15:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24 13:33 REPL example session for overriding a package? Myles English
2017-01-24 14:56 ` Ludovic Courtès
2017-01-24 15:05   ` Myles English

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.