Subject: [bug#49461] [PATCH 2/2] gnu: Add searx.

From: Vinicius Monego <[email-masked]>
Date: Thu, 8 Jul 2021 03:55:27 +0000

* gnu/packages/search.scm (searx): New variable.
---
 gnu/packages/search.scm | 53 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 52 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/search.scm b/gnu/packages/search.scm
index 362eb0d95e..44d5b631ca 100644
--- a/gnu/packages/search.scm
+++ b/gnu/packages/search.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2018, 2020, 2021 Tobias Geerinckx-Rice <[email-masked]>
 ;;; Copyright © 2018 Adam Massmann <[email-masked]>
 ;;; Copyright © 2020 Hartmut Goebel <[email-masked]>
+;;; Copyright © 2021 Vinicius Monego <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,7 +25,7 @@
 
 (define-module (gnu packages search)
   #:use-module ((guix licenses)
-                #:select (gpl2 gpl2+ gpl3+ lgpl2.1+ bsd-3 x11 perl-license))
+                #:select (gpl2 gpl2+ gpl3+ agpl3+ lgpl2.1+ bsd-3 x11 perl-license))
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -43,9 +44,11 @@
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pdf)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-crypto)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages sphinx)
+  #:use-module (gnu packages time)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xml))
@@ -207,6 +210,54 @@ files and directories.")
 command line tool for interacting with libtocc.")
     (license gpl3+)))
 
+(define-public searx
+  (package
+    (name "searx")
+    (version "1.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/searx/searx")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0ghkx8g8jnh8yd46p4mlbjn2zm12nx27v7qflr4c8xhlgi0px0mh"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:tests? #f ;what tests do is make online requests to each engine
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'relax-requirements
+           (lambda _
+             ;; These packages are outdated in Guix at the time of packaging.
+             ;; When they are updated, remove corresponding substitutions.
+             ;; Tests can run after build with 'searx-checker' tool in /bin.
+             (substitute* "requirements.txt"
+               (("flask-babel==2.0.0") "flask-babel>=1.0.0")
+               (("jinja2==2.11.3") "jinja2>=2.11.2")
+               (("lxml==4.6.3") "lxml>=4.4.2")
+               (("pygments==2.8.0") "pygments>=2.7.3")
+               (("requests\\[socks\\]==2.25.1") "requests>=2.25")
+               (("==") ">=")))))))
+    (propagated-inputs
+     `(("python-babel" ,python-babel)
+       ("python-certifi" ,python-certifi)
+       ("python-dateutil" ,python-dateutil)
+       ("python-flask" ,python-flask)
+       ("python-flask-babel" ,python-flask-babel)
+       ("python-idna" ,python-idna)
+       ("python-jinja2" ,python-jinja2)
+       ("python-langdetect" ,python-langdetect)
+       ("python-lxml" ,python-lxml)
+       ("python-pygments" ,python-pygments)
+       ("python-pyyaml" ,python-pyyaml)
+       ("python-requests" ,python-requests)))
+    (home-page "https://searx.github.io/searx/")
+    (synopsis "Privacy-respecting metasearch engine")
+    (description "Searx is a privacy-respecting, hackable metasearch engine.")
+    (license agpl3+)))
+
 (define-public bool
   (package
     (name "bool")
-- 
2.32.0