On Monday, June 10th, 2024 at 9:50 AM, Christopher Baines 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 > > (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` (# "/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