help-guix
[Top][All Lists]
Advanced

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

Re: how to use a variable in a plain-file object?


From: Giovanni Biscuolo
Subject: Re: how to use a variable in a plain-file object?
Date: Fri, 17 May 2024 10:24:50 +0200

Hello Tomas,

Tomas Volf <~@wolfsden.cz> writes:

[...]

> I believe you can use mixed-text-file for this purpose:

Oh yes!  I missed (to understand) mixed-text-file and text-file* in the
G-exp manual section [1], in particular how it can be easily used in
place of local-file and plain-file, because I missed (to understand) the
given example.  Now that I see, I think I'll use that in place of
plain-file... everywhere :-O

[...]

>     (use-modules (gnu packages base)
>                  (guix gexp))
>
>     (define %my-file-object
>       (mixed-text-file "something.conf" "\
>     SED_PATH = " sed "/bin/sed
>     "))
>
>     %my-file-object
>
> And here is the result:
>
>     $ cat $(guix build -e '(load "/tmp/yy.scm")')
>     SED_PATH =
>     /gnu/store/6kkygybkxkzqy3lf6k5kzimk5mjasrvw-sed-4.8/bin/sed

Cristal clear, also thank you for having pointed out a quick way to test
the result by building it and cat(ing) it in a shell session

This could be a nice section in the Cookbook :-)

Thank you and happy hacking!

> There are only two hard things in Computer Science:
> cache invalidation, naming things and off-by-one errors.

P.S.: I'll steal the above sentence, _verbatim_ :-)


[1] IMHO that manual section "talks" to experienced Guile programmers
and not to Guix _users_... and actually is a subsection of "Programming
interface".

-- 
Giovanni Biscuolo

Xelera IT Infrastructures



reply via email to

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