unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 29296@debbugs.gnu.org
Subject: [bug#29296] [PATCH 0/2] gexp: Add 'let-system'
Date: Tue, 14 Nov 2017 17:18:41 +0100	[thread overview]
Message-ID: <20171114161841.8485-1-ludo@gnu.org> (raw)

Hello!

This patch adds the ‘let-system’ form to (guix gexp), as discussed with
Mathieu at <https://bugs.gnu.org/29281>.  It allows you to insert
system-dependent code inside a gexp, as in this example:

      #~(system*
         #+(let-system system
             (cond ((string-prefix? "armhf-" system)
                    (file-append qemu "/bin/qemu-system-arm"))
                   ((string-prefix? "x86_64-" system)
                    (file-append qemu "/bin/qemu-system-x86_64"))
                   (else
                    (error "dunno!"))))
         "-net" "user" #$image)

(Using (%current-system) and (%current-target-system) does *not* achieve
this, in case you’re wondering, because at the time the gexp is defined
they carry their default value.)

Feedback welcome!

Ludo’.

Ludovic Courtès (2):
  gexp: Compilers can now return lowerable objects.
  gexp: Add 'let-system'.

 doc/guix.texi  |  26 ++++++++++++++
 guix/gexp.scm  | 105 ++++++++++++++++++++++++++++++++++++++++++++++++---------
 tests/gexp.scm |  50 +++++++++++++++++++++++++++
 3 files changed, 165 insertions(+), 16 deletions(-)

-- 
2.15.0

             reply	other threads:[~2017-11-14 16:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14 16:18 Ludovic Courtès [this message]
2017-11-14 16:25 ` [bug#29296] [PATCH 1/2] gexp: Compilers can now return lowerable objects Ludovic Courtès
2017-11-14 16:25   ` [bug#29296] [PATCH 2/2] gexp: Add 'let-system' Ludovic Courtès
2017-11-15 11:27     ` Mathieu Othacehe
2017-11-16  9:10       ` Ludovic Courtès
2020-05-22 22:44         ` Danny Milosavljevic
2020-05-22 23:01           ` Marius Bakke

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=20171114161841.8485-1-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=29296@debbugs.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).