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: Ludovic Courtès
Subject: Re: How to build a file which depends on the actual contents of store items?
Date: Fri, 20 Nov 2015 15:12:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

宋文武 <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?

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.

HTH!

Ludo’.



reply via email to

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