[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: |
Ludovic Courtès |
Subject: |
Re: How to build a file which depends on the actual contents of store items? |
Date: |
Mon, 23 Nov 2015 15:43:33 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
宋文武 <address@hidden> skribis:
> 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.
You can also use ‘computed-file’, which is the non-monadic equivalent.
Ludo’.