[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: REPL example session for overriding a package?
From: |
Ludovic Courtès |
Subject: |
Re: REPL example session for overriding a package? |
Date: |
Tue, 24 Jan 2017 15:56:17 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
Hi Myles,
Myles English <address@hidden> 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’.