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: Fabio Natali
Subject: Re: G-exp that makes use of guile-ini
Date: Tue, 10 Oct 2023 23:33:38 +0100

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 via email to

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