help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: G-exp that makes use of guile-ini


From: Artyom V. Poptsov
Subject: Re: G-exp that makes use of guile-ini
Date: Wed, 11 Oct 2023 10:03:42 +0300
User-agent: Mozilla Thunderbird

Hello,

FWIW, there was a similar issue with Guile-DSV:

  https://github.com/artyom-poptsov/guile-dsv/issues/10

The difference is that Guile-DSV API allows to set the Guile-SMC logging driver

and its options.


I've added the same functionality to the Guile-INI API:

https://github.com/artyom-poptsov/guile-ini/commit/82ff585070e656f66f874293327fa541382f95ed


Please check if it works for you.


Thanks,


- avp


On 11.10.2023 01:33, Fabio Natali wrote:
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.

Attachment: OpenPGP_0xE9C5A2D90898A02F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]