From 2e04ab7147948b51d4e437ca9ba910530ac2a788 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 16 Jan 2019 11:18:34 +0100 Subject: services: avahi: Deprecate the 'avahi-service' procedure. * gnu/services/avahi.scm (): Export getters. Add default values. (avahi-service-type)[default-value]: New field. (avahi-service): Mark as deprecated. * gnu/services/desktop.scm (%desktop-services): Use the 'service' form instead of calling 'avahi-service'. * gnu/tests/base.scm (%avahi-os): Likewise. * doc/guix.texi (Base Services): Adjust example accordingly. (Networking Services): Update accordingly. --- gnu/services/avahi.scm | 52 +++++++++++++++++++++++++++++++++--------------- gnu/services/desktop.scm | 4 ++-- 2 files changed, 38 insertions(+), 18 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/avahi.scm b/gnu/services/avahi.scm index 5de30ffb97..547d826551 100644 --- a/gnu/services/avahi.scm +++ b/gnu/services/avahi.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014, 2015, 2016, 2017, 2018 Ludovic Courtès +;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -24,9 +24,22 @@ #:use-module (gnu system shadow) #:use-module (gnu packages avahi) #:use-module (gnu packages admin) + #:use-module (guix deprecation) #:use-module (guix records) #:use-module (guix gexp) #:export (avahi-configuration + avahi-configuration? + + avahi-configuration-avahi + avahi-configuration-debug? + avahi-configuration-host-name + avahi-configuration-publish? + avahi-configuration-publish-workstation? + avahi-configuration-ipv4? + avahi-configuration-ipv6? + avahi-configuration-wide-area? + avahi-configuration-domains-to-browse + avahi-service avahi-service-type)) @@ -37,7 +50,6 @@ ;;; ;;; Code: - ;; TODO: Export. (define-record-type* avahi-configuration make-avahi-configuration avahi-configuration? @@ -45,18 +57,24 @@ (default avahi)) (debug? avahi-configuration-debug? ;Boolean (default #f)) - (host-name avahi-configuration-host-name) ;string - (publish? avahi-configuration-publish?) ;Boolean + (host-name avahi-configuration-host-name ;string | #f + (default #f)) + (publish? avahi-configuration-publish? ;boolean + (default #t)) ;; The default for this was #t in Avahi 0.6.31 and became #f in 0.7. For ;; now we stick to the old default. (publish-workstation? avahi-configuration-publish-workstation? ;Boolean (default #t)) - (ipv4? avahi-configuration-ipv4?) ;Boolean - (ipv6? avahi-configuration-ipv6?) ;Boolean - (wide-area? avahi-configuration-wide-area?) ;Boolean - (domains-to-browse avahi-configuration-domains-to-browse)) ;list of strings + (ipv4? avahi-configuration-ipv4? ;Boolean + (default #t)) + (ipv6? avahi-configuration-ipv6? ;Boolean + (default #t)) + (wide-area? avahi-configuration-wide-area? ;Boolean + (default #f)) + (domains-to-browse avahi-configuration-domains-to-browse ;list of strings + (default '()))) (define* (configuration-file config) "Return an avahi-daemon configuration file based on CONFIG, an @@ -145,14 +163,16 @@ service switch (NSS) with support for @code{.local} host name resolution.") ;; Provide 'avahi-browse', 'avahi-resolve', etc. in ;; the system profile. (service-extension profile-service-type - avahi-package)))))) - -(define* (avahi-service #:key (avahi avahi) debug? - host-name - (publish? #t) - (ipv4? #t) (ipv6? #t) - wide-area? - (domains-to-browse '())) + avahi-package))) + (default-value (avahi-configuration))))) + +(define-deprecated (avahi-service #:key (avahi avahi) debug? + host-name + (publish? #t) + (ipv4? #t) (ipv6? #t) + wide-area? + (domains-to-browse '())) + avahi-service-type "Return a service that runs @command{avahi-daemon}, a system-wide mDNS/DNS-SD responder that allows for service discovery and \"zero-configuration\" host name lookups (see @uref{http://avahi.org/}), and diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm index 47d1096c6d..2d5e900658 100644 --- a/gnu/services/desktop.scm +++ b/gnu/services/desktop.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014, 2015, 2016, 2017, 2018 Ludovic Courtès +;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2015 Andy Wingo ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2016 Sou Bunnbu @@ -986,7 +986,7 @@ as expected."))) ;; The D-Bus clique. (service network-manager-service-type) (service wpa-supplicant-service-type) ;needed by NetworkManager - (avahi-service) + (service avahi-service-type) (udisks-service) (upower-service) (accountsservice-service) -- cgit v1.2.3 From 76421cf0d2e1feb637f174c5c9891e8286965c58 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Fri, 16 Nov 2018 20:35:37 +0900 Subject: services: kmscon: Remove virtual-terminal requirement. kmscon does not require that virtual terminals run in UTF-8 mode. * gnu/services/base.scm (kmscon-service-type): Remove virtual-terminal from requirement list. --- gnu/services/base.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu/services') diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 8395a856fc..b2f39c4aea 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -2138,7 +2138,7 @@ This service is not part of @var{%base-services}." (shepherd-service (documentation "kmscon virtual terminal") - (requirement '(user-processes udev dbus-system virtual-terminal)) + (requirement '(user-processes udev dbus-system)) (provision (list (symbol-append 'term- (string->symbol virtual-terminal)))) (start #~(make-forkexec-constructor #$kmscon-command)) (stop #~(make-kill-destructor))))))) -- cgit v1.2.3 From ca0c43ecf02a5451ab0dd2f855032e316b4a4792 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Wed, 5 Dec 2018 14:13:38 +0900 Subject: services: herd: Allow to pass arguments to start-service. * gnu/services/herd.scm (start-service)[arguments]: New optional argument. --- gnu/services/herd.scm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/herd.scm b/gnu/services/herd.scm index 8ff817759d..9fe757fb73 100644 --- a/gnu/services/herd.scm +++ b/gnu/services/herd.scm @@ -252,9 +252,10 @@ when passed a service with an already-registered name." services (remove registered? services)))))) -(define (start-service name) - (with-shepherd-action name ('start) result - result)) +(define* (start-service name #:optional (arguments '())) + (invoke-action name 'start arguments + (lambda (result) + result))) (define (stop-service name) (with-shepherd-action name ('stop) result -- cgit v1.2.3 From 65cd70ce42d4a46a65f284cbd1386e3e169383e4 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Thu, 17 Jan 2019 17:53:57 +0100 Subject: services: openssh: Add escape hatch. * gnu/services/ssh.scm ()[extra-content]: New field. * doc/guix.texi (Networking Services): Document it. --- doc/guix.texi | 13 +++++++++++++ gnu/services/ssh.scm | 10 ++++++++++ 2 files changed, 23 insertions(+) (limited to 'gnu/services') diff --git a/doc/guix.texi b/doc/guix.texi index ee7cf1da14..245a18bc70 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -12644,6 +12644,19 @@ This is a symbol specifying the logging level: @code{quiet}, @code{fatal}, @code{error}, @code{info}, @code{verbose}, @code{debug}, etc. See the man page for @file{sshd_config} for the full list of level names. +@item @code{extra-content} (default: @code{""}) +This field can be used to append arbitrary text to the configuration file. It +is especially useful for elaborate configurations that cannot be expressed +otherwise. This configuration, for example, would generally disable root +logins, but permit them from one specific IP address: + +@example +(openssh-configuration + (extra-content "\ +Match Address 192.168.0.1 + PermitRootLogin yes")) +@end example + @end table @end deftp diff --git a/gnu/services/ssh.scm b/gnu/services/ssh.scm index bb94c5f41a..97b7f3c07b 100644 --- a/gnu/services/ssh.scm +++ b/gnu/services/ssh.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2016 David Craven ;;; Copyright © 2016 Julien Lepiller ;;; Copyright © 2017 Clément Lassieur +;;; Copyright © 2019 Ricardo Wurmus ;;; ;;; This file is part of GNU Guix. ;;; @@ -323,6 +324,12 @@ The other options should be self-descriptive." (log-level openssh-configuration-log-level (default 'info)) + ;; String + ;; This is an "escape hatch" to provide configuration that isn't yet + ;; supported by this configuration record. + (extra-content openssh-configuration-extra-content + (default "")) + ;; list of user-name/file-like tuples (authorized-keys openssh-authorized-keys (default '())) @@ -471,6 +478,9 @@ of user-name/file-like tuples." (match-lambda ((name command) (format port "Subsystem\t~a\t~a\n" name command))) '#$(openssh-configuration-subsystems config)) + + (format port "~a\n" + #$(openssh-configuration-extra-content config)) #t))))) (define (openssh-shepherd-service config) -- cgit v1.2.3 From 7194745a16008947f6cf1a3aba0f86e8ca18c2f6 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Sun, 20 Jan 2019 15:10:58 +0200 Subject: services: Use guix-service-type. * gnu/services/base.scm (%base-services): Replace guix-service with guix-service-type. * gnu/system/examples/docker-image.tmpl (services): Same. --- gnu/services/base.scm | 2 +- gnu/system/examples/docker-image.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/base.scm b/gnu/services/base.scm index b2f39c4aea..4971f892c6 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -2326,7 +2326,7 @@ to handle." (provision '(loopback))))) (syslog-service) (service urandom-seed-service-type) - (guix-service) + (service guix-service-type) (nscd-service) ;; The LVM2 rules are needed as soon as LVM2 or the device-mapper is diff --git a/gnu/system/examples/docker-image.tmpl b/gnu/system/examples/docker-image.tmpl index d73187398f..9690d651c1 100644 --- a/gnu/system/examples/docker-image.tmpl +++ b/gnu/system/examples/docker-image.tmpl @@ -44,4 +44,4 @@ (type "does-not-matter")))) ;; Guix is all you need! - (services (list (guix-service)))) + (services (list (service guix-service-type)))) -- cgit v1.2.3 From db9035492b26cb646d1eb5e38aa59bd8de18b02a Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Sun, 20 Jan 2019 15:16:44 +0200 Subject: services: %base-services: Use nscd-service-type. * gnu/services/base.scm (nscd-service-type)[default-value]: New field. (%base-services): Replace nscd-service with nscd-service-type. --- gnu/services/base.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gnu/services') diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 4971f892c6..626c5975de 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -7,6 +7,7 @@ ;;; Copyright © 2016 David Craven ;;; Copyright © 2016 Ricardo Wurmus ;;; Copyright © 2018 Mathieu Othacehe +;;; Copyright © 2019 Efraim Flashner ;;; ;;; This file is part of GNU Guix. ;;; @@ -1358,6 +1359,7 @@ the tty to run, among other things." (name-services (append (nscd-configuration-name-services config) name-services))))) + (default-value %nscd-default-configuration) (description "Runs libc's @dfn{name service cache daemon} (nscd) with the given configuration---an @code{} object. @xref{Name @@ -2327,7 +2329,7 @@ to handle." (syslog-service) (service urandom-seed-service-type) (service guix-service-type) - (nscd-service) + (service nscd-service-type) ;; The LVM2 rules are needed as soon as LVM2 or the device-mapper is ;; used, so enable them by default. The FUSE and ALSA rules are -- cgit v1.2.3 From fd779db9e4f95031627efed5a6fc2ffa554d443e Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Sun, 20 Jan 2019 15:18:36 +0200 Subject: services: %base-services: Use udev-service-type. * gnu/services/base.scm (udev-configuration): Fix typo. (udev-service-type)[default-value]: New field. (%base-services): Replace udev-service with udev-service-type. --- gnu/services/base.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 626c5975de..17c953f0d7 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -1815,7 +1815,7 @@ archive}). If that is not the case, the service will fail to start." udev-configuration make-udev-configuration udev-configuration? (udev udev-configuration-udev ; - (default udev)) + (default eudev)) (rules udev-configuration-rules ;list of (default '()))) @@ -1998,6 +1998,7 @@ the udev rules in use.") (udev-configuration (udev udev) (rules (append initial-rules rules))))))) + (default-value (udev-configuration)) (description "Run @command{udev}, which populates the @file{/dev} directory dynamically. Get extra rules from the packages listed in the @@ -2334,7 +2335,9 @@ to handle." ;; The LVM2 rules are needed as soon as LVM2 or the device-mapper is ;; used, so enable them by default. The FUSE and ALSA rules are ;; less critical, but handy. - (udev-service #:rules (list lvm2 fuse alsa-utils crda)) + (service udev-service-type + (udev-configuration + (rules (list lvm2 fuse alsa-utils crda)))) (service special-files-service-type `(("/bin/sh" ,(file-append (canonical-package bash) -- cgit v1.2.3 From 178bce41d8bd7fd25ea33c7e3f10add339746061 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Sun, 20 Jan 2019 15:24:22 +0200 Subject: gnu: %base-services: Use login-service-type. * gnu/services/base.scm (login-service-type)[default-value]: New field. (%base-services): Replace login-service with login-service-type. --- gnu/services/base.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gnu/services') diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 17c953f0d7..5817562860 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -819,6 +819,7 @@ Return a service that sets up Unicode support in @var{tty} and loads (service-type (name 'login) (extensions (list (service-extension pam-root-service-type login-pam-service))) + (default-value (login-configuration)) (description "Provide a console log-in service as specified by its configuration value, a @code{login-configuration} object."))) @@ -2296,7 +2297,7 @@ to handle." (define %base-services ;; Convenience variable holding the basic services. - (list (login-service) + (list (service login-service-type) (service virtual-terminal-service-type) (service console-font-service-type -- cgit v1.2.3 From 76a2b2db1a5c6a68be994712e5273b2ac4e4c82a Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Sun, 20 Jan 2019 15:25:45 +0200 Subject: gnu: %base-services: Use *getty-service-type. * gnu/services/base.scm (%base-services): Replace agetty-service with agetty-service-type, mingetty-service with mingetty-service-type. --- gnu/services/base.scm | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 5817562860..d2baea0dd0 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -2305,23 +2305,23 @@ to handle." (cons tty %default-console-font)) '("tty1" "tty2" "tty3" "tty4" "tty5" "tty6"))) - (agetty-service (agetty-configuration - (extra-options '("-L")) ; no carrier detect - (term "vt100") - (tty #f))) ; automatic - - (mingetty-service (mingetty-configuration - (tty "tty1"))) - (mingetty-service (mingetty-configuration - (tty "tty2"))) - (mingetty-service (mingetty-configuration - (tty "tty3"))) - (mingetty-service (mingetty-configuration - (tty "tty4"))) - (mingetty-service (mingetty-configuration - (tty "tty5"))) - (mingetty-service (mingetty-configuration - (tty "tty6"))) + (service agetty-service-type (agetty-configuration + (extra-options '("-L")) ; no carrier detect + (term "vt100") + (tty #f))) ; automatic + + (service mingetty-service-type (mingetty-configuration + (tty "tty1"))) + (service mingetty-service-type (mingetty-configuration + (tty "tty2"))) + (service mingetty-service-type (mingetty-configuration + (tty "tty3"))) + (service mingetty-service-type (mingetty-configuration + (tty "tty4"))) + (service mingetty-service-type (mingetty-configuration + (tty "tty5"))) + (service mingetty-service-type (mingetty-configuration + (tty "tty6"))) (service static-networking-service-type (list (static-networking (interface "lo") -- cgit v1.2.3 From cc178ac71755aa778df93f70d835e0a6a1a10c23 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Sun, 20 Jan 2019 15:27:52 +0200 Subject: gnu: %desktop-services: Use polkit-service-type. * gnu/services/desktop.scm (%desktop-services): Replace polkit-service with polkit-service-type. --- gnu/services/desktop.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu/services') diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm index 2d5e900658..fbeabf1162 100644 --- a/gnu/services/desktop.scm +++ b/gnu/services/desktop.scm @@ -992,7 +992,7 @@ as expected."))) (accountsservice-service) (colord-service) (geoclue-service) - (polkit-service) + (service polkit-service-type) (elogind-service) (dbus-service) -- cgit v1.2.3