From patchwork Wed Jan 1 19:23:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Runciter X-Patchwork-Id: 36351 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 663E127BBEA; Wed, 1 Jan 2025 19:24:43 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 2693B27BBE2 for ; Wed, 1 Jan 2025 19:24:41 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tT4KE-0006cp-Pz; Wed, 01 Jan 2025 14:24:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tT4K3-0006cS-T2 for guix-patches@gnu.org; Wed, 01 Jan 2025 14:24:05 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tT4K3-000820-AJ for guix-patches@gnu.org; Wed, 01 Jan 2025 14:24:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:From:Date:To:In-Reply-To:References:Subject; bh=9OTzRdtDsToh2q6Jn2/Or+ficyLm9Fw10uyr6Ze3eUM=; b=MGBDBz/lcaDNZe/i2pYI8M9fvi/mJbbNTq/f0vvOBMkWkkHqtWNNg4f/sKp466mZHkPoMIA7932KuO/7GqFL9BoajWTp3xYO7OqOwhnV0F7TNbMirM3vghVjuUNzXXP6gRIKDRjoTCFjX1e4WAlu44NCoE0jVORcvABY7zRllfQKcR//+cnC2xHDrvbmvZ7GdpBGF32g+wIzxaaxuu2kLgMAKBhrUZYQP3KSWrJpF1aq6wKPoTyAklCsAtEKTE4+JaJAXp56JTOwNe2IV/JIn+WfGMxIGEfgkrh2ZON07bRSS9+4NlZ3g8l8L4ugQyXPnOtfjZRso2b/jE4psF8Quw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tT4K2-0008V6-4W for guix-patches@gnu.org; Wed, 01 Jan 2025 14:24:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#75063] [PATCH v2] gnu: dict: Add symbols to help users configure FreeDict with dicod. References: In-Reply-To: Resent-From: Runciter Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 01 Jan 2025 19:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75063 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75063@debbugs.gnu.org Cc: Runciter Received: via spool by 75063-submit@debbugs.gnu.org id=B75063.173575942032635 (code B ref 75063); Wed, 01 Jan 2025 19:24:02 +0000 Received: (at 75063) by debbugs.gnu.org; 1 Jan 2025 19:23:40 +0000 Received: from localhost ([127.0.0.1]:40485 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tT4Jf-0008UJ-RF for submit@debbugs.gnu.org; Wed, 01 Jan 2025 14:23:40 -0500 Received: from mail-4323.proton.ch ([185.70.43.23]:30961) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tT4Jb-0008U0-Un for 75063@debbugs.gnu.org; Wed, 01 Jan 2025 14:23:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=whispers-vpn.org; s=protonmail; t=1735759408; x=1736018608; bh=9OTzRdtDsToh2q6Jn2/Or+ficyLm9Fw10uyr6Ze3eUM=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector: List-Unsubscribe:List-Unsubscribe-Post; b=EH+9wGYxbLXlKHYPR3ATFYXW7y/dd53AaJq5KODqW6KuBh4EF+u93Fc7Q8zM+74Ll sm+ncYL7nc0gXUi6Erq2w7aRPeylMuZKW1vR56dqFM9H52HkWPBDsWetMcdcsk7n4B +oDFpS/I/xA9s1KATif1QKK/H6yKIPahs9HSAaIuCVR52uZN9NNTgeijmKVM36iX8W oNiUNGcgnFCco2l7fjmH6/to4THA7feSUC2L+vJFC6FaAaypJnwiWF/AjFcdCbQTey Z6WRoPZiHTGE1nCI/fxBHp6N8vwmbXY5hV4MigPjOjE/wjOA3xDUva09w9cIClVUxI ORzAfOXu+jhOA== Date: Wed, 01 Jan 2025 19:23:25 +0000 Message-ID: Feedback-ID: 119317227:user:proton X-Pm-Message-ID: 46ecf50adeae276bce650fb589b58f04eca69020 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Runciter X-ACL-Warn: , Runciter via Guix-patches X-Patchwork-Original-From: Runciter via Guix-patches via From: Runciter Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/dict.scm: (%dicod-database:freedict): New procedure; (dicod-freedict-databases): new variable. * doc/guix.texi: (Dictionary Service): Document them. Signed-off-by: Runciter --- doc/guix.texi | 25 +++++++++-- gnu/services/dict.scm | 100 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 121 insertions(+), 4 deletions(-) base-commit: 9dc91360fd2e41fb783ab4af341ac60aee2f5d31 diff --git a/doc/guix.texi b/doc/guix.texi index 08ffbc36d7..30ca842ea5 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -41148,7 +41148,23 @@ Miscellaneous Services Dictionary of English using the @code{gcide} package. @end defvar -The following is an example @code{dicod-service-type} configuration. +@deffn {Procedure} %dicod-database:freedict dictionary-name +"Returns a record of type @code{dicod-database} for purpose of configuring a +database for the FreeDict multilingual dictionary named by the string +@var{dictionary-name} into a service of type @code{dicod-service-type}." +@end deffn + +@defvar dicod-freedict-databases +A relatively large list of records of type @code{dicod-database}, made +available for users who wish to configure all the FreeDict multilingual +dictionaries provided by the @code{freedict-dictionaries} package into a +service of type @code{dicod-service-type}. +@end defvar + +The following is an example @code{dicod-service-type} configuration, +extending a @command{dicod} daemon serving databases for the wordnet and +gcide dictionaries, as well as a selection of FreeDict multilingual +dictionaries. @lisp (service dicod-service-type @@ -41159,12 +41175,15 @@ Miscellaneous Services (module "wordnet") (options (list #~(string-append "wnhome=" #$wordnet)))))) - (databases (list + (databases (cons* (dicod-database (name "wordnet") (complex? #t) (handler "wordnet")) - %dicod-database:gcide)))) + %dicod-database:gcide + (map + %dicod-database:freedict + '("fra-eng" "eng-fra" "eng-spa" "spa-eng")))))) @end lisp @cindex Docker diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm index a4e25f5302..69028ab5d3 100644 --- a/gnu/services/dict.scm +++ b/gnu/services/dict.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2016 Sou Bunnbu ;;; Copyright © 2016, 2017, 2018, 2020, 2022, 2023 Ludovic Courtès ;;; Copyright © 2017 Huang Ying +;;; Copyright © 2024 Runciter ;;; ;;; This file is part of GNU Guix. ;;; @@ -40,7 +41,9 @@ (define-module (gnu services dict) dicod-configuration dicod-handler dicod-database - %dicod-database:gcide)) + %dicod-database:gcide + %dicod-database:freedict + dicod-freedict-databases)) ;;; @@ -94,6 +97,101 @@ (define %dicod-database:gcide (options (list #~(string-append "dbdir=" #$gcide "/share/gcide") #~(string-append "idxdir=" #$%dicod-gcide-index))))) +(define (%dicod-database:freedict dictionary-name) + "Returns a record of type @code{dicod-database} for purpose of configuring a +database for the FreeDict multilingual dictionary named by the string +@var{dictionary-name} into a service of type @code{dicod-service-type}." + (dicod-database (name (string-append "freedict-" + dictionary-name)) + (handler "dictorg") + (options (list #~(string-append "database=" + #$freedict-dictionaries + "/share/dictd/" + #$dictionary-name))))) + +(define dicod-freedict-databases + (map %dicod-database:freedict (list "afr-deu" + "afr-eng" + "ara-eng" + "bre-fra" + "ces-eng" + "ckb-kmr" + "cym-eng" + "dan-eng" + "deu-ita" + "deu-kur" + "deu-nld" + "deu-por" + "deu-tur" + "eng-afr" + "eng-ara" + "eng-ces" + "eng-cym" + "eng-dan" + "eng-ell" + "eng-fra" + "eng-gle" + "eng-hin" + "eng-hrv" + "eng-hun" + "eng-ita" + "eng-lat" + "eng-lit" + "eng-nld" + "eng-pol" + "eng-por" + "eng-rom" + "eng-rus" + "eng-spa" + "eng-srp" + "eng-swh" + "eng-tur" + "fra-bre" + "fra-eng" + "fra-nld" + "gla-deu" + "gle-eng" + "gle-pol" + "hrv-eng" + "hun-eng" + "isl-eng" + "ita-deu" + "ita-eng" + "jpn-deu" + "jpn-eng" + "jpn-fra" + "jpn-rus" + "kha-deu" + "kha-eng" + "kur-deu" + "kur-eng" + "kur-tur" + "lat-deu" + "lat-eng" + "lit-eng" + "mkd-bul" + "nld-deu" + "nld-eng" + "nld-fra" + "nno-nob" + "oci-cat" + "pol-gle" + "por-deu" + "por-eng" + "san-deu" + "slk-eng" + "slv-eng" + "spa-ast" + "spa-eng" + "spa-por" + "srp-eng" + "swe-eng" + "swh-eng" + "swh-pol" + "tur-deu" + "tur-eng" + "wol-fra"))) + (define %dicod-accounts (list (user-group (name "dicod")