From: Giovanni Biscuolo <g@xelera.eu>
To: Tomas Volf <~@wolfsden.cz>
Cc: help-guix@gnu.org
Subject: Re: how to use a variable in a plain-file object?
Date: Fri, 17 May 2024 10:24:50 +0200 [thread overview]
Message-ID: <87ikzc3kx9.fsf@xelera.eu> (raw)
In-Reply-To: <ZkZS-qKQNJsUt74A@ws>
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
prev parent reply other threads:[~2024-05-17 8:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-16 15:57 how to use a variable in a plain-file object? Giovanni Biscuolo
2024-05-16 16:15 ` raingloom
2024-05-17 8:45 ` Giovanni Biscuolo
2024-05-16 18:39 ` Tomas Volf
2024-05-17 8:24 ` Giovanni Biscuolo [this message]
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=87ikzc3kx9.fsf@xelera.eu \
--to=g@xelera.eu \
--cc=help-guix@gnu.org \
--cc=~@wolfsden.cz \
/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.