From: Maxime Devos <maximedevos@telenet.be>
To: "Andrew Tropin" <andrew@trop.in>, "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org, Xinglu Chen <public@yoctocell.xyz>,
guix-maintainers@gnu.org
Subject: Re: Return back original implementation for text-config serialization
Date: Fri, 21 Jan 2022 10:30:00 +0100 [thread overview]
Message-ID: <405630188ac22fd2a1f1d0e0555ce061584744a3.camel@telenet.be> (raw)
In-Reply-To: <87o846y24v.fsf@trop.in>
[-- Attachment #1: Type: text/plain, Size: 2931 bytes --]
Andrew Tropin schreef op do 20-01-2022 om 16:20 [+0300]:
> [...]
>
> From what I understood from Liliana's and Maxime's replies: I'm not the
> only one finding the original implementation to be more intuitive and
> consistent with the rest of Guix API. Please, correct me if I'm wrong.
To be clear:
* >> source \
>> /gnu/store/00fl96dj2aak4i1vqvdqzlhbmmskc7fx-blabla.sh
How about defining a procedure
(define (source-file file-like)
(mixed-text-file "source " file-like)),
the 'concatenated-file' described below, and giving an example or
two in the manual on how to use it?
(concatenated-file ""
(source-file (local-file "some-bash-functions.sh"))
(mixed-text-file "" (file-append coreutils "/bin/echo")
"hello Guix Home!) "\n"
"invoke-some-function" "argument"))
* I don't like 'slurp-file-gexp' (what are G-exps doing there, and
what's slurping?). A better name would improve things though.
Also, we already have 'mixed-text-file', so maybe we can create
an ‘concatenated-file'?
(appended-file name (plain-file "" "foo") (local-file "bar"))
-->
foo
<contents of the file "bar">
A slight downside is that the plain-file needs to be given a name,
in this case "", as you have noted for 'mixed-text-file', but that
can be avoided to a degree by giving it "" as name.
* IIUC, the reason why 'slurp-file-gexp' or the like was necessary,
was because the implementation doesn't use records for
configuration, but rather some mixture of S-exps and ‘copy this
and that file is the serialisation here and there’.
I would prefer not using S-exps like
(home-service barfoo-service-type
(barfoo-configuration
(config
`((this-option "that")
(foo (bar z)
(foobar (include ,(local-file ...)))))))
and instead write these 'this-option', 'foo', 'bar' and 'foobar'
in records, such that there's to some degree a type system and
some discoverability.
Yes, if there's a lot of options that can be configured,
then initially Guix won't support all, but it should be easy
to patch Guix to support more options on an as-needed basis.
There can also be an 'extra-content' escape hatch.
For software that doesn't support inclusion directives in
configuration, we could:
1. patch upstream to support it (it's free software and
it's potentially useful outside Guix, so why not?)
2. or do something like 'concatenated-file'
with a preference for (1).
As such, I'm not exactly agreeing, since there appear to be better
options than 'slurp-file-gexp'. Renaming 'slurp-file-gexp' to
something more descriptive would help, but there's more that could be
done.
Greetings,
Maxime.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
next prev parent reply other threads:[~2022-01-21 9:32 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-09 9:12 Return back original implementation for text-config serialization Andrew Tropin
2022-01-09 11:19 ` Liliana Marie Prikler
2022-01-09 17:48 ` Andrew Tropin
2022-01-09 19:44 ` Liliana Marie Prikler
2022-01-10 9:49 ` Andrew Tropin
2022-01-10 20:12 ` Liliana Marie Prikler
2022-01-12 15:05 ` Andrew Tropin
2022-01-09 12:17 ` Maxime Devos
2022-01-09 12:19 ` Maxime Devos
2022-01-09 17:59 ` Andrew Tropin
2022-01-09 19:00 ` Maxime Devos
2022-01-18 14:26 ` Ludovic Courtès
2022-01-20 13:20 ` Andrew Tropin
2022-01-21 9:30 ` Maxime Devos [this message]
2022-01-26 8:34 ` Andrew Tropin
2022-01-27 5:04 ` Maxim Cournoyer
2022-01-28 15:48 ` Andrew Tropin
2022-02-05 11:09 ` Ludovic Courtès
2022-02-13 14:14 ` Andrew Tropin
2022-01-26 8:36 ` Andrew Tropin
2022-02-05 11:34 ` Maxime Devos
2022-02-13 14:09 ` Andrew Tropin
2022-01-24 15:37 ` Ludovic Courtès
2022-01-26 9:11 ` Andrew Tropin
2022-01-26 9:21 ` Andrew Tropin
2022-02-05 14:43 ` Xinglu Chen
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=405630188ac22fd2a1f1d0e0555ce061584744a3.camel@telenet.be \
--to=maximedevos@telenet.be \
--cc=andrew@trop.in \
--cc=guix-devel@gnu.org \
--cc=guix-maintainers@gnu.org \
--cc=ludo@gnu.org \
--cc=public@yoctocell.xyz \
/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 public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).