Re: Service customization

2015-10-29 Thread Alex Kost
Ludovic Courtès (2015-10-29 00:33 +0300) wrote:

> Hi Guix!
>
> A fairly common pattern in GuixSD is: You want to use whatever is in
> ‘%desktop-services’, say, but you want to tweak the configuration of
> some of the services in there.
>
> This is where the ‘modify-services’ macro comes in, inspired by Taylan’s
> ‘modify-phases’:
>
>  Occasionally, instead of using the base services as is, you will want
>   to customize them.  For instance, to change the configuration of
>   ‘guix-daemon’ and Mingetty (the console log-in), you may write the
>   following instead of %BASE-SERVICES:
>
>(modify-services %base-services
>  (guix-service-type config =>
> (guix-configuration
>  (inherit config)
>  (use-substitutes? #f)
>  (extra-options '("--gc-keep-outputs"
>  (mingetty-service-type config =>
> (mingetty-configuration
>  (inherit config)
>  (motd (plain-file "motd" "Hi there!")
>
>   The effect here is to change the options passed to ‘guix-daemon’ when it
>   is started, as well as the “message of the day” that appears when
>   logging in at the console.  *Note ‘modify-services’: Service Reference,
>   for more on that.
>
> Simple but convenient, no?

This is awesome!  Thank you!!

-- 
Alex



Service customization

2015-10-28 Thread Ludovic Courtès
Hi Guix!

A fairly common pattern in GuixSD is: You want to use whatever is in
‘%desktop-services’, say, but you want to tweak the configuration of
some of the services in there.

This is where the ‘modify-services’ macro comes in, inspired by Taylan’s
‘modify-phases’:

 Occasionally, instead of using the base services as is, you will want
  to customize them.  For instance, to change the configuration of
  ‘guix-daemon’ and Mingetty (the console log-in), you may write the
  following instead of %BASE-SERVICES:

   (modify-services %base-services
 (guix-service-type config =>
(guix-configuration
 (inherit config)
 (use-substitutes? #f)
 (extra-options '("--gc-keep-outputs"
 (mingetty-service-type config =>
(mingetty-configuration
 (inherit config)
 (motd (plain-file "motd" "Hi there!")

  The effect here is to change the options passed to ‘guix-daemon’ when it
  is started, as well as the “message of the day” that appears when
  logging in at the console.  *Note ‘modify-services’: Service Reference,
  for more on that.

Simple but convenient, no?

Ludo’.