unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Miguel Ángel Moreno" <mail@migalmoreno.com>
To: 62102@debbugs.gnu.org
Subject: [bug#62102] [PATCH v2] services: Add whoogle-service-type.
Date: Sun, 13 Aug 2023 12:37:04 +0200	[thread overview]
Message-ID: <864jl344a7.fsf@migalmoreno.com> (raw)
In-Reply-To: <86zg8k8iy8.fsf@conses.eu>

* gnu/services/web.scm (whoogle-service-type): New variable.
* doc/guix.texi (Web Services): Document it.
---
 doc/guix.texi        | 32 +++++++++++++++++++++++++
 gnu/services/web.scm | 56 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 88 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 409ca2ad62..35746ec21e 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -31031,6 +31031,38 @@ Web Services
 @end table
 @end deftp
 
+@subheading Whoogle Search
+@cindex Whoogle Search
+@uref{https://github.com/benbusby/whoogle-search, Whoogle Search} is a
+self-hosted, ad-free, privacy-respecting metasearch engine that collects
+and displays Google search results.
+
+@defvar whoogle-service-type
+Service type for Whoogle Search.
+@end defvar
+
+@deftp {Data Type} whoogle-configuration
+Data type representing Whoogle Search service configuration.
+
+@table @asis
+@item @code{package} (default: @code{whoogle-search})
+The Whoogle Search package to use.
+
+@item @code{host} (default: @code{"127.0.0.1"})
+The host address to run Whoogle on.
+
+@item @code{port} (default: @code{5000})
+The port where Whoogle will be exposed.
+
+@item @code{environment-variables} (default: @code{'()})
+A list of strings with the environment variables to configure Whoogle.
+You can consult
+@uref{https://github.com/benbusby/whoogle-search/blob/main/whoogle.template.env,
+its environment variables template} for the list of available options.
+
+@end table
+@end deftp
+
 @subsubheading Patchwork
 @cindex Patchwork
 Patchwork is a patch tracking system.  It can collect patches sent to a
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 818226a4f7..ed53572eec 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -16,6 +16,7 @@
 ;;; Copyright © 2020, 2021 Alexandru-Sergiu Marton <brown121407@posteo.ro>
 ;;; Copyright © 2022 Simen Endsjø <simendsjo@gmail.com>
 ;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
+;;; Copyright © 2023 Miguel Ángel Moreno <mail@migalmoreno.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -36,6 +37,7 @@ (define-module (gnu services web)
   #:use-module (gnu services)
   #:use-module (gnu services shepherd)
   #:use-module (gnu services admin)
+  #:use-module (gnu services configuration)
   #:use-module (gnu services getmail)
   #:use-module (gnu services mail)
   #:use-module (gnu system pam)
@@ -47,6 +49,7 @@ (define-module (gnu services web)
   #:use-module (gnu packages patchutils)
   #:use-module (gnu packages php)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-web)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages logging)
@@ -240,6 +243,13 @@ (define-module (gnu services web)
 
             varnish-service-type
 
+            whoogle-service-type
+            whoogle-configuration
+            whoogle-configuration-package
+            whoogle-configuration-host
+            whoogle-configuration-port
+            whoogle-configuration-environment-variables
+
             patchwork-database-configuration
             patchwork-database-configuration?
             patchwork-database-configuration-engine
@@ -1604,6 +1614,52 @@ (define varnish-service-type
    (default-value
      (varnish-configuration))))
 
+\f
+;;;
+;;; Whoogle
+;;;
+
+(define-configuration/no-serialization whoogle-configuration
+  (package
+    (package whoogle-search)
+    "The @code{whoogle-search} package to use.")
+  (host
+   (string "127.0.0.1")
+   "The host address to run Whoogle on.")
+  (port
+   (integer 5000)
+   "The port to run Whoogle on.")
+  (environment-variables
+   (list-of-strings '())
+   "A list of strings specifying environment variables used to configure
+Whoogle."))
+
+(define (whoogle-shepherd-service config)
+  (match-record config <whoogle-configuration>
+    (package host port environment-variables)
+    (list
+     (shepherd-service
+      (provision '(whoogle-search))
+      (start #~(make-forkexec-constructor
+                (list (string-append #$package "/bin/whoogle-search")
+                      "--host" #$host "--port" #$(number->string port))
+                #:environment-variables
+                (append (list "CONFIG_VOLUME=/var/cache/whoogle-search")
+                        '#$environment-variables)))
+      (stop #~(make-kill-destructor))
+      (documentation "Run a @code{whoogle-search} instance.")))))
+
+(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
+                             (compose list whoogle-configuration-package))))
+   (default-value (whoogle-configuration))
+   (description "Set up the @code{whoogle-search} metasearch engine.")))
+
 \f
 ;;;
 ;;; Patchwork
-- 
2.41.0

-- 
Best regards,
Miguel Ángel Moreno




  parent reply	other threads:[~2023-08-13 11:45 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
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 ` Miguel Ángel Moreno [this message]
2024-02-19 21:25   ` [bug#62102] [PATCH v2] " 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=864jl344a7.fsf@migalmoreno.com \
    --to=mail@migalmoreno.com \
    --cc=62102@debbugs.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.
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).