From mboxrd@z Thu Jan 1 00:00:00 1970 From: Myles English Subject: Re: REPL example session for overriding a package? Date: Tue, 24 Jan 2017 15:05:08 +0000 Message-ID: <871svsa47v.fsf@gmail.com> References: <8737g8a8gg.fsf@gmail.com> <87vat4pkvi.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45948) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cW2es-0007Lf-Qb for help-guix@gnu.org; Tue, 24 Jan 2017 10:05:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cW2es-0000rZ-0t for help-guix@gnu.org; Tue, 24 Jan 2017 10:05:18 -0500 In-reply-to: <87vat4pkvi.fsf@gnu.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: help-guix on [2017-01-24] at 14:56 Ludovic Courtès writes: > Myles English 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