unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Recursive substitute-keyword-arguments / setting default on build system
@ 2023-09-26 11:08 nils
  2023-09-27 14:13 ` Hilton Chain
  0 siblings, 1 reply; 3+ messages in thread
From: nils @ 2023-09-26 11:08 UTC (permalink / raw)
  To: help-guix@gnu.org

Hello,

I use a slightly customized emacs package, and want to use it as the package that is used in emacs-build-system for the emacs plugins I'm using.
The default emacs gets garbage collected and takes quite a while to reinstall, I would like to avoid that. Also, it seems cleaner to build the plugins with the exact version that they will be used with.

Here's what I have:

(define emacs-package
  ((const
     ((options->transformation
        '((with-configure-flag . "emacs=--program-transform-name='s/^ctags$/ctags.emacs/'")))
      emacs))))

(define (set-build-system-emacs plugin-package)
  (package
    (inherit plugin-package)
    (arguments
      (substitute-keyword-arguments (package-arguments plugin-package)
                                    ((#:emacs emacs) `,emacs-package)))))

(map set-build-system-emacs package-list)

From what I can tell this does work for the packages in package-list, but not for any inputs to those packages. That makes total sense to me, but I don't know how to solve it.
Any pointers? Or is it possible to set the default package for a build system, removing the need for this mapping altogether?

Nils


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

* Re: Recursive substitute-keyword-arguments / setting default on build system
  2023-09-26 11:08 Recursive substitute-keyword-arguments / setting default on build system nils
@ 2023-09-27 14:13 ` Hilton Chain
  2023-09-27 17:41   ` nils
  0 siblings, 1 reply; 3+ messages in thread
From: Hilton Chain @ 2023-09-27 14:13 UTC (permalink / raw)
  To: nils; +Cc: help-guix

Hi Nils,

On Tue, 26 Sep 2023 19:08:06 +0800,
nils@landt.email wrote:
>
> Hello,
>
> I use a slightly customized emacs package, and want to use it as the package that is used in emacs-build-system for the emacs plugins I'm using.
> The default emacs gets garbage collected and takes quite a while to reinstall, I would like to avoid that. Also, it seems cleaner to build the plugins with the exact version that they will be used with.
>
> Here's what I have:
>
> (define emacs-package
>   ((const
>      ((options->transformation
>         '((with-configure-flag . "emacs=--program-transform-name='s/^ctags$/ctags.emacs/'")))
>       emacs))))
>
> (define (set-build-system-emacs plugin-package)
>   (package
>     (inherit plugin-package)
>     (arguments
>       (substitute-keyword-arguments (package-arguments plugin-package)
>                                     ((#:emacs emacs) `,emacs-package)))))
>
> (map set-build-system-emacs package-list)
>
> From what I can tell this does work for the packages in package-list, but not for any inputs to those packages. That makes total sense to me, but I don't know how to solve it.
> Any pointers? Or is it possible to set the default package for a build system, removing the need for this mapping altogether?

`package-input-rewriting' (documented in [1]) can be used for the
purpose:

--8<---------------cut here---------------start------------->8---
(map (package-input-rewriting
      `((,emacs-minimal . ,emacs-package)
        (,emacs . ,emacs-package)))
     package-list)
--8<---------------cut here---------------end--------------->8---

Thanks
---
[1]: https://guix.gnu.org/en/manual/devel/en/html_node/Defining-Package-Variants.html


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

* Re: Recursive substitute-keyword-arguments / setting default on build system
  2023-09-27 14:13 ` Hilton Chain
@ 2023-09-27 17:41   ` nils
  0 siblings, 0 replies; 3+ messages in thread
From: nils @ 2023-09-27 17:41 UTC (permalink / raw)
  To: Hilton Chain; +Cc: help-guix


> Hilton Chain <hako@ultrarare.space> hat am 27.09.2023 16:13 CEST geschrieben:
> 
>  
> Hi Nils,
> 
> On Tue, 26 Sep 2023 19:08:06 +0800,
> nils@landt.email wrote:
> >
> > Hello,
> >
> > I use a slightly customized emacs package, and want to use it as the package that is used in emacs-build-system for the emacs plugins I'm using.
> > The default emacs gets garbage collected and takes quite a while to reinstall, I would like to avoid that. Also, it seems cleaner to build the plugins with the exact version that they will be used with.
> >
> > Here's what I have:
> >
> > (define emacs-package
> >   ((const
> >      ((options->transformation
> >         '((with-configure-flag . "emacs=--program-transform-name='s/^ctags$/ctags.emacs/'")))
> >       emacs))))
> >
> > (define (set-build-system-emacs plugin-package)
> >   (package
> >     (inherit plugin-package)
> >     (arguments
> >       (substitute-keyword-arguments (package-arguments plugin-package)
> >                                     ((#:emacs emacs) `,emacs-package)))))
> >
> > (map set-build-system-emacs package-list)
> >
> > From what I can tell this does work for the packages in package-list, but not for any inputs to those packages. That makes total sense to me, but I don't know how to solve it.
> > Any pointers? Or is it possible to set the default package for a build system, removing the need for this mapping altogether?
> 
> `package-input-rewriting' (documented in [1]) can be used for the
> purpose:
> 
> --8<---------------cut here---------------start------------->8---
> (map (package-input-rewriting
>       `((,emacs-minimal . ,emacs-package)
>         (,emacs . ,emacs-package)))
>      package-list)
> --8<---------------cut here---------------end--------------->8---
> 
> Thanks
> ---
> [1]: https://guix.gnu.org/en/manual/devel/en/html_node/Defining-Package-Variants.html

Thank you for the reply. I was already using package-input-rewriting (well, the /spec version of it) but supplemented it with the keyword argument substitution because I thought it only worked on the inputs / native-inputs / propagated-inputs fields.
But you are right, just the input-rewriting works!


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

end of thread, other threads:[~2023-09-27 17:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-26 11:08 Recursive substitute-keyword-arguments / setting default on build system nils
2023-09-27 14:13 ` Hilton Chain
2023-09-27 17:41   ` nils

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).