unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Attila Lendvai <attila@lendvai.name>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: Shepherd config file and GEXP semantics
Date: Sat, 05 Feb 2022 14:59:36 +0100	[thread overview]
Message-ID: <87bkzlifcn.fsf@gnu.org> (raw)
In-Reply-To: <O6d20EDlmZ0lPOt5VWhgqCIBTut5KG6zypl4ygZFXXMO2xA8fHp5j32rSQq82HPA-5GhCYRqu47rPFeD3taXcscLFWQvtb8UVQD3ChHS1eo=@lendvai.name> (Attila Lendvai's message of "Sun, 30 Jan 2022 19:53:00 +0000")

Hi,

Attila Lendvai <attila@lendvai.name> skribis:

> (define (make-user-module)
>   (let ((m (make-fresh-user-module)))
>     ;; The typical configuration file wants to do '(make <service> ...)', and
>     ;; '(register-services ...)', so provide the relevant bindings by default.
>     (module-use! m (resolve-interface '(oop goops)))
>     (module-use! m (resolve-interface '(shepherd service)))
>     m))
>
> (define (load-in-user-module)
>   (let ((user-module (make-user-module)))
>     (save-module-excursion
>      (lambda ()
>        (set-current-module user-module)
>        (use-modules (nongnu services swarm-utils))
>
>        ;; this works, i.e. *log-directory* is not unbound upon execution:
>        ;; (eval '(lambda ()
>        ;;          *log-directory*)
>        ;;       user-module)
>
>        (lambda () *log-directory*)
>        ))))

‘use-modules’ is a macro that should only be used at the top level, even
if it sometimes works in different contexts, for now.

Instead, you should use Guile’s first-class module API (info "(guile)
Module System Reflection").  As you noticed in the code you copied from,
you would call ‘module-use!’ and similar procedures.

I don’t see which module ‘*log-directory*’ is in, though.

HTH,
Ludo’.


      reply	other threads:[~2022-02-05 14:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-30 19:53 Shepherd config file and GEXP semantics Attila Lendvai
2022-02-05 13:59 ` Ludovic Courtès [this message]

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bkzlifcn.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=attila@lendvai.name \
    --cc=guix-devel@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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).