guix-commits
[Top][All Lists]
Advanced

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

04/05: services: Add a default value to various service types.


From: Ludovic Courtès
Subject: 04/05: services: Add a default value to various service types.
Date: Sat, 15 Apr 2017 18:48:31 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 3d3c56500843b5573ba6419db5e66075fb8ac8ef
Author: Ludovic Courtès <address@hidden>
Date:   Sun Apr 16 00:06:43 2017 +0200

    services: Add a default value to various service types.
    
    * gnu/services/admin.scm (rottlog-service-type)[default-value]: New
    field.
    * gnu/services/base.scm (guix-service-type)[default-value]: New field.
    (guix-publish-service-type)[default-value]: New field.
    * gnu/services/cups.scm (cups-service-type)[default-value]: New field.
    * gnu/services/dict.scm (dicod-service-type)[default-value]: New field.
    * gnu/services/mcron.scm (mcron-service-type)[default-value]: New field.
    * gnu/services/networking.scm (<tor-configuration>)[config-file]: Add
    default value.
    (tor-service-type)[default-value]: New field.
    (<bitlbee-configuration>)[interface, port, extra-settings]: Add default
    values.
    (bitlbee-service-type)[default-value]: New field.
    (wpa-supplicant-service-type)[default-value]: New field.
    (tlp-service-type)[default-value]: New field.
    (openssh-service-type)[default-value]: New field.
    * doc/guix.texi (Base Services, Log Rotation)
    (Networking Services, Printing Services):
    (Power management Services): Adjust examples accordingly.
---
 doc/guix.texi               | 21 +++++++++++----------
 gnu/services/admin.scm      |  5 +++--
 gnu/services/base.scm       |  6 ++++--
 gnu/services/cups.scm       |  4 +++-
 gnu/services/dict.scm       |  3 ++-
 gnu/services/mcron.scm      |  5 +++--
 gnu/services/networking.scm | 21 ++++++++++++++-------
 gnu/services/pm.scm         |  3 ++-
 gnu/services/ssh.scm        |  5 +++--
 9 files changed, 45 insertions(+), 28 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index fdd7114..810139d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -9066,9 +9066,9 @@ This service is not part of @var{%base-services}.
 @end deffn
 
 @anchor{guix-publish-service-type}
address@hidden {Scheme Variable} guix-publish-service-type @var{config}
address@hidden {Scheme Variable} guix-publish-service-type
 This is the service type for @command{guix publish} (@pxref{Invoking
-guix publish}).  @var{config} must be a @code{guix-configuration}
+guix publish}).  Its value must be a @code{guix-configuration}
 object, as described below.
 
 This assumes that @file{/etc/guix} already contains a signing key pair as
@@ -9256,7 +9256,7 @@ with the default settings.
 (operating-system
   ;; @dots{}
   (services (cons* (mcron-service)
-                   (service rottlog-service-type (rottlog-configuration)) 
+                   (service rottlog-service-type)
                    %base-services)))
 @end lisp
 
@@ -9433,10 +9433,9 @@ The value of this service is the @code{wpa-supplicant} 
package to use.
 Thus, it can be instantiated like this:
 
 @lisp
-(use-modules (gnu services networking)
-             (gnu packages admin))
+(use-modules (gnu services networking))
 
-(service wpa-supplicant-service-type wpa-supplicant)
+(service wpa-supplicant-service-type)
 @end lisp
 @end defvr
 
@@ -10044,9 +10043,10 @@ system, add a @code{cups-service} to the operating 
system definition:
 
 @deffn {Scheme Variable} cups-service-type
 The service type for the CUPS print server.  Its value should be a valid
-CUPS configuration (see below).  For example:
+CUPS configuration (see below).  To use the default settings, simply
+write:
 @example
-(service cups-service-type (cups-configuration))
+(service cups-service-type)
 @end example
 @end deffn
 
@@ -13874,9 +13874,10 @@ source is detected.  More information can be found at
 
 @deffn {Scheme Variable} tlp-service-type
 The service type for the TLP tool.  Its value should be a valid
-TLP configuration (see below).  For example:
+TLP configuration (see below).  To use the default settings, simply
+write:
 @example
-(service tlp-service-type (tlp-configuration))
+(service tlp-service-type)
 @end example
 @end deffn
 
diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm
index deaf677..6ac24e3 100644
--- a/gnu/services/admin.scm
+++ b/gnu/services/admin.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 Jan Nieuwenhuizen <address@hidden>
-;;; Copyright © 2016 Ludovic Courtès <address@hidden>
+;;; Copyright © 2016, 2017 Ludovic Courtès <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -115,6 +115,7 @@
                      ;; Add Rottlog to the global profile so users can access
                      ;; the documentation.
                      (service-extension profile-service-type
-                                        (compose list rottlog-rottlog))))))
+                                        (compose list rottlog-rottlog))))
+   (default-value (rottlog-configuration))))
 
 ;;; admin.scm ends here
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 95a1ba2..79ba205 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1424,7 +1424,8 @@ failed to register hydra.gnu.org public key: ~a~%" 
status))))))))
           (service-extension account-service-type guix-accounts)
           (service-extension activation-service-type guix-activation)
           (service-extension profile-service-type
-                             (compose list guix-configuration-guix))))))
+                             (compose list guix-configuration-guix))))
+   (default-value (guix-configuration))))
 
 (define* (guix-service #:optional (config %default-guix-configuration))
   "Return a service that runs the Guix build daemon according to
@@ -1477,7 +1478,8 @@ failed to register hydra.gnu.org public key: ~a~%" 
status))))))))
                  (list (service-extension shepherd-root-service-type
                                           guix-publish-shepherd-service)
                        (service-extension account-service-type
-                                          (const %guix-publish-accounts))))))
+                                          (const %guix-publish-accounts))))
+                (default-value (guix-publish-configuration))))
 
 (define* (guix-publish-service #:key (guix guix) (port 80) (host "localhost"))
   "Return a service that runs @command{guix publish} listening on @var{host}
diff --git a/gnu/services/cups.scm b/gnu/services/cups.scm
index 70a71ef..4c62e6a 100644
--- a/gnu/services/cups.scm
+++ b/gnu/services/cups.scm
@@ -1022,7 +1022,9 @@ extensions that it uses."
                       (inherit config)
                       (extensions
                        (append (opaque-cups-configuration-extensions config)
-                               extensions)))))))))
+                               extensions)))))))
+
+                (default-value (cups-configuration))))
 
 ;; A little helper to make it easier to document all those fields.
 (define (generate-cups-documentation)
diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm
index 64de111..69eadaf 100644
--- a/gnu/services/dict.scm
+++ b/gnu/services/dict.scm
@@ -162,7 +162,8 @@ database {
           (service-extension activation-service-type
                              (const %dicod-activation))
           (service-extension shepherd-root-service-type
-                             dicod-shepherd-service)))))
+                             dicod-shepherd-service)))
+   (default-value (dicod-configuration))))
 
 (define* (dicod-service #:key (config (dicod-configuration)))
   "Return a service that runs the @command{dicod} daemon, an implementation
diff --git a/gnu/services/mcron.scm b/gnu/services/mcron.scm
index 313c836..b6cb8bc 100644
--- a/gnu/services/mcron.scm
+++ b/gnu/services/mcron.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016 Ludovic Courtès <address@hidden>
+;;; Copyright © 2016, 2017 Ludovic Courtès <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -97,7 +97,8 @@
                           (mcron-configuration
                            (inherit config)
                            (jobs (append (mcron-configuration-jobs config)
-                                         jobs)))))))
+                                         jobs)))))
+                (default-value (mcron-configuration)))) ;empty job list
 
 (define* (mcron-service jobs #:optional (mcron mcron2))
   "Return an mcron service running @var{mcron} that schedules @var{jobs}, a
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index ae9b8f8..99a3d49 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -529,7 +529,8 @@ make an initial adjustment of more than 1,000 seconds."
   tor-configuration?
   (tor              tor-configuration-tor
                     (default tor))
-  (config-file      tor-configuration-config-file)
+  (config-file      tor-configuration-config-file
+                    (default (plain-file "empty" "")))
   (hidden-services  tor-configuration-hidden-services
                     (default '())))
 
@@ -666,7 +667,8 @@ HiddenServicePort ~a ~a~%"
                            (inherit config)
                            (hidden-services
                             (append (tor-configuration-hidden-services config)
-                                    services)))))))
+                                    services)))))
+                (default-value (tor-configuration))))
 
 (define* (tor-service #:optional
                       (config-file (plain-file "empty" ""))
@@ -719,9 +721,12 @@ project's documentation} for more information."
   bitlbee-configuration?
   (bitlbee bitlbee-configuration-bitlbee
            (default bitlbee))
-  (interface bitlbee-configuration-interface)
-  (port bitlbee-configuration-port)
-  (extra-settings bitlbee-configuration-extra-settings))
+  (interface bitlbee-configuration-interface
+             (default "127.0.0.1"))
+  (port bitlbee-configuration-port
+        (default 6667))
+  (extra-settings bitlbee-configuration-extra-settings
+                  (default "")))
 
 (define bitlbee-shepherd-service
   (match-lambda
@@ -789,7 +794,8 @@ project's documentation} for more information."
                        (service-extension account-service-type
                                           (const %bitlbee-accounts))
                        (service-extension activation-service-type
-                                          (const %bitlbee-activation))))))
+                                          (const %bitlbee-activation))))
+                (default-value (bitlbee-configuration))))
 
 (define* (bitlbee-service #:key (bitlbee bitlbee)
                           (interface "127.0.0.1") (port 6667)
@@ -1002,7 +1008,8 @@ dns=" dns "
                  (list (service-extension shepherd-root-service-type
                                           wpa-supplicant-shepherd-service)
                        (service-extension dbus-root-service-type list)
-                       (service-extension profile-service-type list)))))
+                       (service-extension profile-service-type list)))
+                (default-value wpa-supplicant)))
 
 
 ;;;
diff --git a/gnu/services/pm.scm b/gnu/services/pm.scm
index fe55647..3cefe18 100644
--- a/gnu/services/pm.scm
+++ b/gnu/services/pm.scm
@@ -396,7 +396,8 @@ shutdown on system startup."))
      (service-extension udev-service-type
                         (compose list tlp-configuration-tlp))
      (service-extension activation-service-type
-                        tlp-activation)))))
+                        tlp-activation)))
+   (default-value (tlp-configuration))))
 
 (define (generate-tlp-documentation)
   (generate-documentation
diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm
index b7f9887..9917c31 100644
--- a/gnu/services/ssh.scm
+++ b/gnu/services/ssh.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <address@hidden>
+;;; Copyright © 2014, 2015, 2016, 2017 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2016 David Craven <address@hidden>
 ;;; Copyright © 2016 Julien Lepiller <address@hidden>
 ;;; Copyright © 2017 Clément Lassieur <address@hidden>
@@ -408,7 +408,8 @@ The other options should be self-descriptive."
                        (service-extension activation-service-type
                                           openssh-activation)
                        (service-extension account-service-type
-                                          (const %openssh-accounts))))))
+                                          (const %openssh-accounts))))
+                (default-value (openssh-configuration))))
 
 
 ;;;



reply via email to

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