guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#62102] [PATCH] services: Add whoogle-service-type.


From: conses
Subject: [bug#62102] [PATCH] services: Add whoogle-service-type.
Date: Fri, 10 Mar 2023 21:11:59 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

---
 gnu/services/web.scm | 46 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index d56e893527..66cc640a6d 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -35,6 +35,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)
@@ -46,6 +47,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)
@@ -235,6 +237,9 @@ (define-module (gnu services web)
 
             varnish-service-type
 
+            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))))
 
+
+;;;
+;;; Whoogle
+;;;
+
+(define-configuration/no-serialization whoogle-configuration
+  (whoogle
+    (package whoogle-search)
+    "The @code{whoogle-search} package to use."))
+
+(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"))
+              #:environment-variables
+              (append (list "CONFIG_VOLUME=/var/cache/whoogle-search")
+                      (default-environment-variables))))
+    (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)))
+   (default-value (whoogle-configuration))
+   (description "Run the @code{whoogle-search} engine.")))
+
 
 ;;;
 ;;; Patchwork
-- 
2.39.1



-- 
Best regards,
conses





reply via email to

[Prev in Thread] Current Thread [Next in Thread]