all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Fabio Natali <me@fabionatali.com>
To: help-guix@gnu.org
Subject: Re: G-exp that makes use of guile-ini
Date: Tue, 10 Oct 2023 23:33:38 +0100	[thread overview]
Message-ID: <877cnup0ot.fsf@fabionatali.com> (raw)

Fabio Natali wrote:
> I've been struggling with the following g-expression that makes use of
> the guile-ini library.

Quick update, this works well:

#+begin_src scheme :noeval
(use-modules (gnu packages guile-xyz)
	     (guix gexp))

(define foo
  (computed-file
   "foo"
   (with-imported-modules '((guix build utils))
     (with-extensions (list guile-ini guile-smc guile-lib)
       #~(begin
           (use-modules (guix build utils)
			(ice-9 pretty-print)
			(ini)
			(smc core log))
	   (mkdir-p "/tmp")
	   (smc-log-init! "file" `((file . "/tmp/test")))
	   (call-with-output-file #$output
	     (lambda (output)
	       (pretty-print
		(call-with-input-file #$(local-file "/tmp/config.ini")
		  ini->scm)
		output))))))))

foo
#+end_src

Now, that was just a stripped down version of what I need to do though!

The real gexp uses =(open-pipe* OPEN_READ command ...)= instead, where
=command= is a script that calls guile-ini (and therefore guile-smc, and
therefore the logger). I can't use =smc-log-init!= the same way
then... I'll keep you posted if something comes to mind.

Cheers, F.


             reply	other threads:[~2023-10-10 22:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-10 22:33 Fabio Natali [this message]
2023-10-11  7:03 ` G-exp that makes use of guile-ini Artyom V. Poptsov
  -- strict thread matches above, loose matches on Subject: below --
2023-10-12 10:07 Fabio Natali
2023-10-11  7:56 Fabio Natali
2023-10-11  8:01 ` Artyom V. Poptsov
2023-10-11 20:03 ` Artyom V. Poptsov
2023-10-10 17:54 Fabio Natali

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=877cnup0ot.fsf@fabionatali.com \
    --to=me@fabionatali.com \
    --cc=87il7epdli.fsf@fabionatali.com \
    --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.