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.
signature.asc
Description: This is a digitally signed message part.