guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to build a file which depends on the actual contents of store it


From: 宋文武
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
User-agent: Roundcube Webmail/1.0.6

On 2015-11-20 22:12, address@hidden wrote:
宋文武 <address@hidden> 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 'address@hidden))))

  (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 via email to

[Prev in Thread] Current Thread [Next in Thread]