all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* defining package variants automatically
@ 2019-09-07 22:50 Ricardo Wurmus
  2019-09-14 13:34 ` Maxim Cournoyer
  2019-09-24 16:06 ` Ludovic Courtès
  0 siblings, 2 replies; 3+ messages in thread
From: Ricardo Wurmus @ 2019-09-07 22:50 UTC (permalink / raw)
  To: help-guix

Hi Guix,

I played a little with defining package variants automatically, but I
can’t get this to work.  The idea of this module is to define a variant
for every package using the emacs-build-system, such that it uses a
different Emacs variant during the build.

All of these packages should be exported as variables of the (gnu
packages emacs-custom) module.

Unfortunately, none of the dynamically defined variables are visible, so
none of the packages are accessible by Guix.  Is there something
obviously wrong here?

--8<---------------cut here---------------start------------->8---
(define-module (gnu packages emacs-custom)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (gnu packages)
  #:use-module (gnu packages emacs)
  #:use-module (gnu packages emacs-xyz)
  #:use-module (guix build-system emacs))

(define my-custom-emacs emacs-no-x) ; just a test

(define package-with-my-emacs
  (package-mapping
   (lambda (pkg)
     (package
       (inherit pkg)
       (name (string-append (package-name pkg) "-rekado"))
       (arguments
        (substitute-keyword-arguments (package-arguments pkg)
          ((#:emacs _ '())
           my-custom-emacs)))))
   (lambda (pkg)
     (eq? emacs-build-system (package-build-system pkg)))))

(fold-packages (lambda (pkg result)
                 (let ((variable-name
                        (string->symbol (string-append (package-name pkg) "-rekado"))))
                   (module-define!
                    (resolve-module '(gnu packages emacs-custom))
                    variable-name
                    (package-with-my-emacs pkg))
                   (export variable-name))
                 result)
               '()
               #:select?
               (lambda (pkg)
                 (eq? emacs-build-system (package-build-system pkg))))
--8<---------------cut here---------------end--------------->8---

--
Ricardo

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

end of thread, other threads:[~2019-09-24 16:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-07 22:50 defining package variants automatically Ricardo Wurmus
2019-09-14 13:34 ` Maxim Cournoyer
2019-09-24 16:06 ` Ludovic Courtès

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.