all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to add service(s) from a service?
@ 2023-10-14 22:57 Tomas Volf
  2023-10-15 15:32 ` paul
  0 siblings, 1 reply; 2+ messages in thread
From: Tomas Volf @ 2023-10-14 22:57 UTC (permalink / raw)
  To: help-guix

[-- Attachment #1: Type: text/plain, Size: 1000 bytes --]

Hi Guix,

I know that I can add services into my Guix configuration using this pattern:

    (operating-system
      ...
      (services (cons* SERVICE
                       %base-services)))

And for packages I can use this pattern:

    (operating-system
      ...
      (packages (cons* PACKAGE
                       %base-packages)))

Now, I would like to be able to do both from a service.  I now that the packages
I do using the profile-service-type, like this:

(define my-service-service-type
  (service-type
   (name 'my-service)
   (description "This is my service.")
   (extensions
    (list (service-extension profile-service-type (list PACKAGE))))
   (default-value (my-service-configuration))))

However, I am unsure how to do this for services.  Would anyone have any ideas
how to do this?

Thank you and have a nice day,
Tomas Volf

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to add service(s) from a service?
  2023-10-14 22:57 How to add service(s) from a service? Tomas Volf
@ 2023-10-15 15:32 ` paul
  0 siblings, 0 replies; 2+ messages in thread
From: paul @ 2023-10-15 15:32 UTC (permalink / raw)
  To: help-guix

Hello Tomas,

On 10/15/23 00:57, Tomas Volf wrote:
> However, I am unsure how to do this for services.  Would anyone have any ideas
> how to do this?

I may be wrong, I believe you can't add services from within a service 
but you can extend them (extension entails instantiation iiuc): so in 
your example SERVICE should expose an extension api and 
my-service-service-type should make use of it through a 
(service-extension ...) call.

Hope this helps,

giacomo



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-15 15:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-14 22:57 How to add service(s) from a service? Tomas Volf
2023-10-15 15:32 ` paul

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.