unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: guix-devel <guix-devel@gnu.org>
Subject: (guix modules) and ‘source-module-closure’
Date: Mon, 05 Sep 2016 00:24:41 +0200	[thread overview]
Message-ID: <8760qbi9qu.fsf@gnu.org> (raw)

Hi!

Commit 7ca87354db53fd1e1a7a3dfeddb9a598ea064bbe adds (guix module),
which provides a way to compute the closure of a Scheme module by
looking at its source code.

This has to do with typical ‘with-imported-modules’ usage, as explained
in the manual:

--8<---------------cut here---------------start------------->8---
   Usually you want the _closure_ of the module to be imported—i.e., the
module itself and all the modules it depends on—rather than just the
module; failing to do that, attempts to use the module will fail because
of missing dependent modules.  The ‘source-module-closure’ procedure
computes the closure of a module by looking at its source file headers,
which comes in handy in this case:

     (use-modules (guix modules))   ;for 'source-module-closure'

     (with-imported-modules (source-module-closure
                              '((guix build utils)
                                (gnu build vm)))
       (gexp->derivation "something-with-vms"
                         #~(begin
                             (use-modules (guix build utils)
                                          (gnu build vm))
                             ...)))
--8<---------------cut here---------------end--------------->8---

The benefit can be seen in the next commit:

  http://git.savannah.gnu.org/cgit/guix.git/commit/?id=239c6e276214813f59f761c9dc5cc0e9d266b49b

Comments welcome!

Ludo’.

             reply	other threads:[~2016-09-04 22:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-04 22:24 Ludovic Courtès [this message]
2016-09-05  8:13 ` (guix modules) and ‘source-module-closure’ Ricardo Wurmus
2016-09-05 10:05   ` Andy Wingo
2016-09-05 21:24     ` Ludovic Courtès

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=8760qbi9qu.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).