From: "Marek Paśnikowski" <marek@marekpasnikowski.pl>
To: help-guix@gnu.org
Subject: Re: Modification of Services with External Definitions of Clause Bodies
Date: Sun, 26 May 2024 14:24:40 +0200 [thread overview]
Message-ID: <6049373.lOV4Wx5bFT@akashi> (raw)
In-Reply-To: <2186006.irdbgypaU6@akashi>
[-- Attachment #1: Type: text/plain, Size: 1993 bytes --]
23.05.2024 14:58:16 CEST Marek Paśnikowski:
> Good day to you all.
>
> I am trying to achieve the following configuration pattern:
>
> (define-public %distribution-services
> (modify-services %desktop-services
> (1-service-type config => 1-change)
> (2-service-type config => 2-change)
> (3-service-type config => 3-change)
> ...
> (n-service-type config => n-change)))
>
> Each k-change is to be defined in its own, external module almost like this:
>
> (define-public k-change
> (lambda (config)
> (k-service-configuration (inherit config)
> ...
> (n-customization)))
>
> I wrote almost, because the presented pattern still fails to execute.
> Regardless, this is the furthest I was able to go — this approach fails
> during system reconfiguration, as opposed to the other attempts which
> failed during guix pull.
>
> The error message:
>
> In procedure struct-vtable:
> Wrong type argument in posistion 1 (expecting struct):
> #<procedure k-change (config)>
>
> I know WHY it fails - lambdas do return procedures. My question to you is,
> how can I modify the k-change definition to have it return the appropriate
> service configuration structure?
I missed the simplest possible type of abstraction during the initial testing
— the humble function. So here is the solution to my problem:
(define-public (k-change config)
(k-service-configuration (inherit config)
...
(n-field)))
(define-public %distribution-services
(modify-services %desktop-services
(k-service-type config
=>
(k-change config))))
It is not as beautiful as I had aimed for, but this is compromise I must take.
Literally nothing else works.
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2024-05-26 12:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-23 12:58 Modification of Services with External Definitions of Clause Bodies Marek Paśnikowski
2024-05-26 12:24 ` Marek Paśnikowski [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=6049373.lOV4Wx5bFT@akashi \
--to=marek@marekpasnikowski.pl \
--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.
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).