all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Myles English <mylesenglish@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: help-guix <help-guix@gnu.org>
Subject: Re: REPL example session for overriding a package?
Date: Tue, 24 Jan 2017 15:05:08 +0000	[thread overview]
Message-ID: <871svsa47v.fsf@gmail.com> (raw)
In-Reply-To: <87vat4pkvi.fsf@gnu.org>



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

      reply	other threads:[~2017-01-24 15:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871svsa47v.fsf@gmail.com \
    --to=mylesenglish@gmail.com \
    --cc=help-guix@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.