all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: 宋文武 <iyzsong@openmailbox.org>
To: ludo@gnu.org
Cc: guix-devel@gnu.org
Subject: Re: How to build a file which depends on the actual contents of store items?
Date: Mon, 23 Nov 2015 17:59:06 +0800	[thread overview]
Message-ID: <401cc1bd5152770cccb7c2ca82ed8ad7@openmailbox.org> (raw)
In-Reply-To: <87io4whia2.fsf@gnu.org>

On 2015-11-20 22:12, ludo@gnu.org wrote:
> 宋文武 <iyzsong@openmailbox.org> skribis:
> 
> [...]
> 
>> +  (define (module-path module)
>> +    (list "  ModulePath \"" module "/lib/xorg/modules\"\n"))
> 
> [...]
> 
>> +" (apply string-append (map module-path modules)) "
> 
> As with NixOS, the solution is to move these computations to the “build
> side” (info "(guix) G-Expressions").
> 
> So you could do something like:
> 
>   (define build
>     #~(call-with-output-file #$output
>         (lambda (port)
>           (for-each emit-driver-stanza '#$@xorg-modules))))
> 
>   (gexp->derivation "xorg.conf" build)
> 
> Does that make sense?
Oh, yes!  I get what I want by replace mixed-text-file with 
gexp->derivation.

While the former is convient for concat strings and packages,
it doesn't have the '#:modules' argument, so I can't do:
   (mixed-text-file "xserver.conf"
     #~(begin (use-modules (guix build utils)) ... (find-files ...

> 
> The big difference with Nix is that we use the same language on both
> sides, so it’s easy to move things from one side to another, but it’s
> also easy to forget about the tradeoffs.
OK, I'm more comfortable with gexp now, thanks!

  reply	other threads:[~2015-11-23  9:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-20  4:22 How to build a file which depends on the actual contents of store items? 宋文武
2015-11-20 14:12 ` Ludovic Courtès
2015-11-23  9:59   ` 宋文武 [this message]
2015-11-23 14:43     ` 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

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

  git send-email \
    --in-reply-to=401cc1bd5152770cccb7c2ca82ed8ad7@openmailbox.org \
    --to=iyzsong@openmailbox.org \
    --cc=guix-devel@gnu.org \
    --cc=iyzsong@member.fsf.org \
    --cc=ludo@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 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.