From: Abbé <gnu.bonfire@p.atriar.ch>
To: Christopher Baines <mail@cbaines.net>
Cc: "help-guix@gnu.org" <help-guix@gnu.org>
Subject: Re: Seeking help with g-expressions maze
Date: Mon, 10 Jun 2024 23:23:03 +0000 [thread overview]
Message-ID: <171806178849.7.15320532995280398045.352021884@p.atriar.ch> (raw)
In-Reply-To: <875xuh1bk3.fsf@cbaines.net>
[-- Attachment #1.1: Type: text/plain, Size: 2430 bytes --]
On Monday, June 10th, 2024 at 9:50 AM, Christopher Baines <mail@cbaines.net> wrote:
> Abbé gnu.bonfire@p.atriar.ch writes:
>
> > (define-configuration/no-serialization home-rbw-configuration
> > (pinentry-program
> > (file-like (file-append pinentry "/bin/pinentry-curses"))
> > "Pinentry program to use.")
> > (email
> > (string "")
> > "Email address of the user")
>
>
> ...
>
> > (define (rbw-config config)
> > (match-record config <home-rbw-configuration>
> > (pinentry-program email base-url identity-url notifications-url
> > client-cert-path sync-interval lock-timeout)
> > `((pinentry-program . ,pinentry-program)
> > (email . ,email)
> > (base_url . ,base-url)
> > (identity_url . ,identity-url)
> > (notifications_url . ,notifications-url)
> > (client_cert_path . ,client-cert-path)
> > (sync_interval . ,sync-interval)
> > (lock_timeout . ,lock-timeout))))
> > (define (home-rbw-configuration-file config)
> > (let ((xformed-config (rbw-config config)))
> > (computed-file "rbw-config.json"
> >
> > #~(call-with-output-file #$output
> > (lambda (port)
> > (display #$(scm->json-string xformed-config) port))))))
>
>
> Here you're calling scm->json-string on an alist containing the
>
> file-append record for pinentry-program. scm->json-string doesn't know
>
> how to handle that, it's invalid. Hence the exception you're getting.
>
> > `(("rbw/config.json" ,(home-rbw-configuration-file config))))
>
>
> ...
>
> > While applying this module, I end up with following obvious error, but
> > I'm not quite sure how to go about resolving this:
> >
> > ----------------8<----------------------8<-----------------------
> > ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> > Throw to key `json-invalid' with args` (#<file-append #<package pinentry@1.2.1 gnu/packages/gnupg.scm:1016 7df6139219a0> "/bin/pinentry-curses">)'.
> > ----------------8<----------------------8<-----------------------
>
>
> If you want to use scm->json-string, you need to be working with a data
>
> structure it can understand, and it can't understand gexp's. That
> suggests you should run it on the build side, once the file-append
> record has been transformed in to a string.
>
> I think this would be similar to how the transmission service in Guix
> builds it's settings.json file.
Thanks for the hint.
Abbe
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]
prev parent reply other threads:[~2024-06-10 23:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-10 4:35 Seeking help with g-expressions maze Abbé
2024-06-10 7:50 ` Christopher Baines
2024-06-10 23:23 ` Abbé [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
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=171806178849.7.15320532995280398045.352021884@p.atriar.ch \
--to=gnu.bonfire@p.atriar.ch \
--cc=help-guix@gnu.org \
--cc=mail@cbaines.net \
/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.
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).