unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Bruno Victal <mirai@makinata.eu>
To: conses <contact@conses.eu>
Cc: 62102@debbugs.gnu.org, Andrew Tropin <andrew@trop.in>
Subject: [bug#62102] [PATCH] services: Add whoogle-service-type.
Date: Fri, 31 Mar 2023 12:30:10 +0100	[thread overview]
Message-ID: <4c4ede32-0615-8134-0d47-ae18ed75531b@makinata.eu> (raw)
In-Reply-To: <86zg8k8iy8.fsf@conses.eu>

Hi,

On 2023-03-10 20:11, conses wrote:
>  
> +            whoogle-service-type
> +            whoogle-configuration
> +

[...]

>              patchwork-database-configuration
>              patchwork-database-configuration?
>              patchwork-database-configuration-engine
> @@ -1575,6 +1580,47 @@ (define varnish-service-type
>     (default-value
>       (varnish-configuration))))
>  
> +\f

Missing page-break character here?
If you're using Emacs you can insert one with C-q C-l.

> +;;;
> +;;; Whoogle
> +;;;
> +
> +(define-configuration/no-serialization whoogle-configuration
> +  (whoogle
> +    (package whoogle-search)
> +    "The @code{whoogle-search} package to use."))

I prefer this field to be named 'package' instead, to make it less prone
to confusion. The accessor, whoogle-configuration-package, should be exported
as well.

> +(define (whoogle-shepherd-service config)
> +  (list
> +   (shepherd-service
> +    (provision '(whoogle-search))
> +    (start #~(make-forkexec-constructor
> +              (list (string-append #$(whoogle-configuration-whoogle config)
> +                                   "/bin/whoogle-search"))

In general, you may prefer to use match-record instead of using accessors
as it results in much less code to type.

> +              #:environment-variables
> +              (append (list "CONFIG_VOLUME=/var/cache/whoogle-search")
> +                      (default-environment-variables))))

Is (default-environment-variables) necessary?

> +    (stop #~(make-kill-destructor))
> +    (documentation "Run a @code{whoogle-search} instance."))))
> +
> +(define (whoogle-profile-service config)
> +  (list
> +   (whoogle-configuration-whoogle config)))

[...]

> +
> +(define whoogle-service-type
> +  (service-type
> +   (name 'whoogle-search)
> +   (extensions
> +    (list
> +     (service-extension
> +      shepherd-root-service-type
> +      whoogle-shepherd-service)
> +     (service-extension
> +      profile-service-type
> +      whoogle-profile-service)))

You can use match-record here or use the accessor here instead.
(e.g., (compose list whoogle-configuration-package))


Could you add a system test for this service as well?
It makes things easier to check and maintain.


Cheers,
Bruno




  reply	other threads:[~2023-03-31 11:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10 20:11 [bug#62102] [PATCH] services: Add whoogle-service-type conses
2023-03-31 11:30 ` Bruno Victal [this message]
2023-06-09 21:03   ` Ludovic Courtès
2023-06-09 21:07     ` Miguel Ángel Moreno
2023-08-08 15:26       ` Ludovic Courtès
2023-08-13 10:57         ` Miguel Ángel Moreno
2023-08-13 10:37 ` [bug#62102] [PATCH v2] " Miguel Ángel Moreno
2024-02-19 21:25   ` Ludovic Courtès
2024-02-11 20:34 ` [bug#62102] [PATCH] " Miguel Ángel Moreno

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=4c4ede32-0615-8134-0d47-ae18ed75531b@makinata.eu \
    --to=mirai@makinata.eu \
    --cc=62102@debbugs.gnu.org \
    --cc=andrew@trop.in \
    --cc=contact@conses.eu \
    /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).