From: Christopher Baines <mail@cbaines.net>
To: Abbé <gnu.bonfire@p.atriar.ch>
Cc: help-guix@gnu.org
Subject: Re: Seeking help with g-expressions maze
Date: Mon, 10 Jun 2024 08:50:20 +0100 [thread overview]
Message-ID: <875xuh1bk3.fsf@cbaines.net> (raw)
In-Reply-To: <171799411588.7.857514431154339738.351278683@p.atriar.ch> ("Abbé"'s message of "Mon, 10 Jun 2024 04:35:09 +0000")
[-- Attachment #1: Type: text/plain, Size: 2461 bytes --]
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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]
next prev parent reply other threads:[~2024-06-10 7:51 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 [this message]
2024-06-10 23:23 ` Abbé
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=875xuh1bk3.fsf@cbaines.net \
--to=mail@cbaines.net \
--cc=gnu.bonfire@p.atriar.ch \
--cc=help-guix@gnu.org \
/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.