;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016 Sou Bunnbu ;;; Copyright © 2016, 2017, 2018, 2020, 2022, 2023 Ludovic Courtès ;;; Copyright © 2017 Huang Ying ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu services dict) #:use-module (guix deprecation) #:use-module (guix gexp) #:use-module (guix records) #:use-module (guix modules) #:use-module (guix least-authority) #:use-module (gnu services) #:use-module (gnu services shepherd) #:use-module (gnu system shadow) #:use-module ((gnu packages admin) #:select (shadow)) #:use-module (gnu packages dico) #:use-module (gnu packages dictionaries) #:autoload (gnu build linux-container) (%namespaces) #:autoload (gnu system file-systems) (file-system-mapping) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (ice-9 match) #:export (dicod-service ; deprecated dicod-service-type dicod-configuration dicod-handler dicod-database %dicod-database:gcide)) ;;; ;;; GNU Dico. ;;; (define-record-type* dicod-configuration make-dicod-configuration dicod-configuration? (dico dicod-configuration-dico (default dico)) (interfaces dicod-configuration-interfaces ;list of strings (default '("localhost"))) (handlers dicod-configuration-handlers ;list of (default '())) (databases dicod-configuration-databases ;list of (default (list %dicod-database:gcide))) (home-service? dicod-configuration-home-service? ;boolean (default for-home?) (innate))) (define-record-type* dicod-handler make-dicod-handler dicod-handler? (name dicod-handler-name) (module dicod-handler-module (default #f)) (options dicod-handler-options (default '()))) (define-record-type* dicod-database make-dicod-database dicod-database? (name dicod-database-name) (handler dicod-database-handler) (complex? dicod-database-complex? (default #f)) (options dicod-database-options (default '()))) (define %dicod-gcide-index ;; The GCIDE pre-built index. The Dico 'gcide' module can build it lazily; ;; do it upfront so there's no need for a writable directory at run-time. (computed-file "dicod-gcide-index" (with-imported-modules '((guix build utils)) #~(begin (use-modules (guix build utils)) (mkdir #$output) (invoke #+(file-append dico "/libexec/idxgcide") #+(file-append gcide "/share/gcide") #$output))))) (define %dicod-database:gcide (dicod-database (name "gcide") (handler "gcide") (options (list #~(string-append "dbdir=" #$gcide "/share/gcide") #~(string-append "idxdir=" #$%dicod-gcide-index))))) (define %dicod-accounts (list (user-group (name "dicod") (system? #t)) (user-account (name "dicod") (group "dicod") (system? #t) (home-directory "/var/empty") (shell (file-append shadow "/sbin/nologin2021-12-28installer: Recommend 'ntp-service-type' for non-graphical systems....We had several bug reports with a root cause of "the clock was incorrect" from users who used the installer to install a non-graphical Guix System. * gnu/installer/services.scm (%system-services): Add the ntp-service-type. * gnu/installer/newt/services.scm (run-system-administration-cbt-page): New variable. (run-services-page): Use run-system-administration-cbt-page when not installing a desktop. * gnu/installer/tests.scm (choose-services): Add and use a choose-misc-service? procedure. * gnu/tests/install.scm (installation-target-os-for-gui-tests)<services>: Add ntp-service-type. Leo Famulari 2021-12-28installer: Offer the CUPS printing service on a dedicated page....Currently, the installer page RUN-OTHER-SERVICES-CBT-PAGE offers to the user all installer services that are not of the types 'desktop', 'network-management', or 'networking'. Concretely, this means that it offers the CUPS printing service, because that is the only service of a different type defined in the installer. In later commits, we will add some services of a new type, and we only want them to be offered when the user is installing a non-graphical system. At least one of these new services (NTP) is part of %DESKTOP-SERVICES. If it was also offered on RUN-OTHER-SERVICES-CBT-PAGE, and the user had configured a system using %DESKTOP-SERVICES, the user could accidentally add NTP to their services twice, which is an error and would break installation. So, this commit makes the RUN-OTHER-SERVICES-CBT-PAGE be more specific about what services to offer. This makes it easier to discriminate between desktop and non-desktop installations, in terms of when a given service is offered. * gnu/installer/newt/services.scm (RUN-OTHER-SERVICES-CBT-PAGE): Rename to ... (RUN-PRINTING-SERVICES-CBT-PAGE): ... new variable, and select only 'document' services. (RUN-SERVICES-PAGE): Adjust accordingly. * gnu/installer/tests.scm (CHOOSE-SERVICES): Adjust accordingly. Leo Famulari '(user-processes))) (documentation "Run the dicod daemon.") (start #~(make-inetd-constructor (list #$dicod "--inetd" "--foreground" (string-append "--config=" #$dicod.conf)) (map (lambda (interface) (endpoint (addrinfo:addr (car (getaddrinfo interface "dict"))))) '#$interfaces) #:requirements '#$requirement #:user #$(and (not home-service?) "dicod") #:group #$(and (not home-service?) "dicod") #:service-name-stem "dicod")) (stop #~(make-inetd-destructor)) (actions (list (shepherd-configuration-action dicod.conf))))))) (define dicod-service-type (service-type (name 'dict) (extensions (list (service-extension account-service-type (const %dicod-accounts)) (service-extension shepherd-root-service-type dicod-shepherd-service))) (default-value (dicod-configuration)) (description "Run @command{dicod}, the dictionary server of @uref{https://www.gnu.org/software/dico, GNU Dico}. @command{dicod} implements the standard DICT protocol supported by clients such as @command{dico} and GNOME Dictionary."))) (define-deprecated (dicod-service #:key (config (dicod-configuration))) dicod-service-type "Return a service that runs the @command{dicod} daemon, an implementation of DICT server (@pxref{Dicod,,, dico, GNU Dico Manual}). The optional @var{config} argument specifies the configuration for @command{dicod}, which should be a @code{} object, by default it serves the GNU Collaborative International Dictionary of English. You can add @command{open localhost} to your @file{~/.dico} file to make @code{localhost} the default server for @command{dico} client (@pxref{Initialization File,,, dico, GNU Dico Manual})." (service dicod-service-type config))