summary refs log tree commit diff
path: root/gnu/services
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-03-04 23:16:17 +0100
committerMarius Bakke <mbakke@fastmail.com>2020-03-04 23:16:17 +0100
commitebb7cf9e21060105d9950dd5142c0eb918083666 (patch)
tree36c1607b80d92e27fb9d09029d1d3b57a1fd5065 /gnu/services
parent0b870f7915f5da43758753fd088a22033936dc50 (diff)
parentc2d7e800e6788277bc56f31d5836f9d507dc1506 (diff)
downloadguix-ebb7cf9e21060105d9950dd5142c0eb918083666.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/base.scm19
-rw-r--r--gnu/services/herd.scm9
-rw-r--r--gnu/services/sddm.scm38
-rw-r--r--gnu/services/shepherd.scm12
-rw-r--r--gnu/services/vpn.scm14
-rw-r--r--gnu/services/xorg.scm116
6 files changed, 126 insertions, 82 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 6988edc249..f1844fb422 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -11,6 +11,7 @@
 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 John Soo <jsoo1@asu.edu>
 ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2037,11 +2038,6 @@ item of @var{packages}."
                 (setenv "LINUX_MODULE_DIRECTORY"
                         "/run/booted-system/kernel/lib/modules")
 
-                ;; The first one is for udev, the second one for eudev.
-                (setenv "UDEV_CONFIG_FILE" #$udev.conf)
-                (setenv "EUDEV_RULES_DIRECTORY"
-                        #$(file-append rules "/lib/udev/rules.d"))
-
                 (let* ((kernel-release
                         (utsname:release (uname)))
                        (linux-module-directory
@@ -2058,7 +2054,18 @@ item of @var{packages}."
                     (make-static-device-nodes directory))
                   (umask old-umask))
 
-                (let ((pid (fork+exec-command (list udevd))))
+                (let ((pid (fork+exec-command (list udevd)
+                            #:environment-variables
+                            (cons*
+                             ;; The first one is for udev, the second one for
+                             ;; eudev.
+                             (string-append "UDEV_CONFIG_FILE=" #$udev.conf)
+                             (string-append "EUDEV_RULES_DIRECTORY="
+                                            #$(file-append
+                                               rules "/lib/udev/rules.d"))
+                             (string-append "LINUX_MODULE_DIRECTORY="
+                                            (getenv "LINUX_MODULE_DIRECTORY"))
+                             (default-environment-variables)))))
                   ;; Wait until udevd is up and running.  This appears to
                   ;; be needed so that the events triggered below are
                   ;; actually handled.
diff --git a/gnu/services/herd.scm b/gnu/services/herd.scm
index 112a7dc104..35d69376d0 100644
--- a/gnu/services/herd.scm
+++ b/gnu/services/herd.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -55,7 +55,8 @@
             load-services
             load-services/safe
             start-service
-            stop-service))
+            stop-service
+            restart-service))
 
 ;;; Commentary:
 ;;;
@@ -272,6 +273,10 @@ when passed a service with an already-registered name."
   (with-shepherd-action name ('stop) result
     result))
 
+(define (restart-service name)
+  (with-shepherd-action name ('restart) result
+    result))
+
 ;; Local Variables:
 ;; eval: (put 'alist-let* 'scheme-indent-function 2)
 ;; eval: (put 'with-shepherd 'scheme-indent-function 1)
diff --git a/gnu/services/sddm.scm b/gnu/services/sddm.scm
index ac8c9a8403..1921afce95 100644
--- a/gnu/services/sddm.scm
+++ b/gnu/services/sddm.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2016 David Craven <david@craven.ch>
 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2019 Jesse Gildersleve <jessejohngildersleve@protonmail.com>
+;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -56,7 +57,7 @@
                           (default (file-append shepherd "/sbin/reboot")))
 
   ;; [Theme]
-  ;; valid values are elarun or maldives
+  ;; valid values are elarun, maldives or maya
   (theme                  sddm-configuration-theme
                           (default "maldives"))
   (themes-directory       sddm-configuration-themes-directory
@@ -306,25 +307,26 @@ Relogin="              (if (sddm-configuration-relogin? config)
   (compose list sddm-configuration-sddm))
 
 (define sddm-service-type
-  (service-type (name 'sddm)
-                (extensions
-                  (list (service-extension shepherd-root-service-type
-                                           sddm-shepherd-service)
-                        (service-extension etc-service-type
-                                           sddm-etc-service)
-                        (service-extension pam-root-service-type
-                                           sddm-pam-services)
-                        (service-extension account-service-type
-                                           (const %sddm-accounts))
-                        (service-extension profile-service-type
-                                           sddm-profile-service)))
-                (default-value (sddm-configuration))
-                (description
-                 "Run SDDM, a display and log-in manager for X11 and
-Wayland.")))
+  (handle-xorg-configuration sddm-configuration
+    (service-type (name 'sddm)
+                  (extensions
+                    (list (service-extension shepherd-root-service-type
+                                             sddm-shepherd-service)
+                          (service-extension etc-service-type
+                                             sddm-etc-service)
+                          (service-extension pam-root-service-type
+                                             sddm-pam-services)
+                          (service-extension account-service-type
+                                             (const %sddm-accounts))
+                          (service-extension profile-service-type
+                                             sddm-profile-service)))
+                  (default-value (sddm-configuration))
+                  (description
+                   "Run SDDM, a display and log-in manager for X11 and
+Wayland."))))
 
 (define-deprecated (sddm-service #:optional (config (sddm-configuration)))
   sddm-service-type
-  "Run the @uref{https://github.com/sddm/sddm,SSDM display manager}
+  "Run the @uref{https://github.com/sddm/sddm,SDDM display manager}
 with the given @var{config}, a @code{<sddm-configuration>} object."
   (service sddm-service-type config))
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index 08bb33039c..d483ff1a15 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015, 2016, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2018 Carlo Zancanaro <carlo@zancanaro.id.au>
 ;;;
@@ -281,6 +281,12 @@ and return the resulting '.go' file."
           (use-modules (srfi srfi-34)
                        (system repl error-handling))
 
+          ;; Specify the default environment visible to all the services.
+          ;; Without this statement, all the environment variables of PID 1
+          ;; are inherited by child services.
+          (default-environment-variables
+            '("PATH=/run/current-system/profile/bin"))
+
           ;; Arrange to spawn a REPL if something goes wrong.  This is better
           ;; than a kernel panic.
           (call-with-error-handling
@@ -288,10 +294,6 @@ and return the resulting '.go' file."
               (apply register-services
                      (map load-compiled '#$(map scm->go files)))))
 
-          ;; guix-daemon 0.6 aborts if 'PATH' is undefined, so work around
-          ;; it.
-          (setenv "PATH" "/run/current-system/profile/bin")
-
           (format #t "starting services...~%")
           (for-each (lambda (service)
                       ;; In the Shepherd 0.3 the 'start' method can raise
diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm
index cbb4a79a7b..658d5c3e88 100644
--- a/gnu/services/vpn.scm
+++ b/gnu/services/vpn.scm
@@ -59,9 +59,10 @@
       (format #t "")
       (format #t "~a ~a\n" (uglify-field-name field-name) val)))
 (define serialize-string serialize-field)
+(define-maybe string)
 (define (serialize-boolean field-name val)
   (if val
-      (serialize-field field-name val)
+      (serialize-field field-name "")
       (format #t "")))
 
 (define (ip-mask? val)
@@ -298,6 +299,11 @@ certificate is @code{cert}.")
     "Don't close and reopen TUN/TAP device or run up/down scripts across
 SIGUSR1 or --ping-restart restarts.")
 
+   (fast-io?
+     (boolean #f)
+     "(Experimental) Optimize TUN/TAP/UDP I/O writes by avoiding a call to
+poll/epoll/select prior to the write operation.")
+
    (verbosity
     (number 3)
     "Verbosity level."))
@@ -307,6 +313,12 @@ SIGUSR1 or --ping-restart restarts.")
     "Add an additional layer of HMAC authentication on top of the TLS control
 channel to protect against DoS attacks.")
 
+   (auth-user-pass
+     (maybe-string 'disabled)
+     "Authenticate with server using username/password.  The option is a file
+containing username/password on 2 lines.  Do not use a file-like object as it
+would be added to the store and readable by any user.")
+
    (verify-key-usage?
     (key-usage #t)
     "Whether to check the server certificate has server usage extension.")
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index 881521cccf..a6dbec6957 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -5,6 +5,8 @@
 ;;; Copyright © 2018, 2019 Timothy Sample <samplet@ngyro.com>
 ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2019 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
+;;; Copyright © 2020 shtwzrd <shtwzrd@protonmail.com>
+;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -102,6 +104,8 @@
             gdm-configuration
             gdm-service-type
             gdm-service
+
+            handle-xorg-configuration
             set-xorg-configuration))
 
 ;;; Commentary:
@@ -152,7 +156,12 @@
   xorg-configuration make-xorg-configuration
   xorg-configuration?
   (modules          xorg-configuration-modules    ;list of packages
-                    (default %default-xorg-modules))
+                    ; filter out modules not supported on current system
+                    (default (filter
+                              (lambda (p)
+                                (member (%current-system)
+                                        (package-supported-systems p)))
+                              %default-xorg-modules)))
   (fonts            xorg-configuration-fonts      ;list of packges
                     (default %default-xorg-fonts))
   (drivers          xorg-configuration-drivers    ;list of strings
@@ -453,6 +462,25 @@ desktop session from the system or user profile will be used."
 
   (program-file "xinitrc" builder))
 
+(define-syntax handle-xorg-configuration
+  (syntax-rules ()
+    "Generate the `compose' and `extend' entries of a login manager
+`service-type' to handle specifying the `xorg-configuration' through
+a `service-extension', as used by `set-xorg-configuration'."
+    ((_ configuration-record service-type-definition)
+     (service-type
+       (inherit service-type-definition)
+       (compose (lambda (extensions)
+                  (match extensions
+                    (() #f)
+                    ((config . _) config))))
+       (extend (lambda (config xorg-configuration)
+                 (if xorg-configuration
+                     (configuration-record
+                      (inherit config)
+                      (xorg-configuration xorg-configuration))
+                     config)))))))
+
 
 ;;;
 ;;; SLiM log-in manager.
@@ -578,18 +606,20 @@ reboot_cmd " shepherd "/sbin/reboot\n"
            (respawn? #t)))))
 
 (define slim-service-type
-  (service-type (name 'slim)
-                (extensions
-                 (list (service-extension shepherd-root-service-type
-                                          slim-shepherd-service)
-                       (service-extension pam-root-service-type
-                                          slim-pam-service)
+  (handle-xorg-configuration slim-configuration
+    (service-type (name 'slim)
+                  (extensions
+                   (list (service-extension shepherd-root-service-type
+                                            slim-shepherd-service)
+                         (service-extension pam-root-service-type
+                                            slim-pam-service)
 
-                       ;; Unconditionally add xterm to the system profile, to
-                       ;; avoid bad surprises.
-                       (service-extension profile-service-type
-                                          (const (list xterm)))))
-                (default-value (slim-configuration))))
+                         ;; Unconditionally add xterm to the system profile, to
+                         ;; avoid bad surprises.
+                         (service-extension profile-service-type
+                                            (const (list xterm)))))
+
+                  (default-value (slim-configuration)))))
 
 (define-deprecated (slim-service #:key (slim slim)
                                  (allow-empty-passwords? #t) auto-login?
@@ -940,44 +970,30 @@ the GNOME desktop environment.")
          (respawn? #t))))
 
 (define gdm-service-type
-  (service-type (name 'gdm)
-                (extensions
-                 (list (service-extension shepherd-root-service-type
-                                          gdm-shepherd-service)
-                       (service-extension activation-service-type
-                                          (const %gdm-activation))
-                       (service-extension account-service-type
-                                          (const %gdm-accounts))
-                       (service-extension pam-root-service-type
-                                          gdm-pam-service)
-                       (service-extension profile-service-type
-                                          gdm-configuration-gnome-shell-assets)
-                       (service-extension dbus-root-service-type
-                                          (compose list
-                                                   gdm-configuration-gdm))
-                       (service-extension localed-service-type
-                                          (compose
-                                           xorg-configuration-keyboard-layout
-                                           gdm-configuration-xorg))))
-
-                ;; For convenience, this service can be extended with an
-                ;; <xorg-configuration> record.  Take the first one that
-                ;; comes.
-                (compose (lambda (extensions)
-                           (match extensions
-                             (() #f)
-                             ((config . _) config))))
-                (extend (lambda (config xorg-configuration)
-                          (if xorg-configuration
-                              (gdm-configuration
-                               (inherit config)
-                               (xorg-configuration xorg-configuration))
-                              config)))
-
-                (default-value (gdm-configuration))
-                (description
-                 "Run the GNOME Desktop Manager (GDM), a program that allows
-you to log in in a graphical session, whether or not you use GNOME.")))
+  (handle-xorg-configuration gdm-configuration
+    (service-type (name 'gdm)
+                  (extensions
+                   (list (service-extension shepherd-root-service-type
+                                            gdm-shepherd-service)
+                         (service-extension activation-service-type
+                                            (const %gdm-activation))
+                         (service-extension account-service-type
+                                            (const %gdm-accounts))
+                         (service-extension pam-root-service-type
+                                            gdm-pam-service)
+                         (service-extension profile-service-type
+                                            gdm-configuration-gnome-shell-assets)
+                         (service-extension dbus-root-service-type
+                                            (compose list
+                                                     gdm-configuration-gdm))
+                         (service-extension localed-service-type
+                                            (compose
+                                             xorg-configuration-keyboard-layout
+                                             gdm-configuration-xorg))))
+                  (default-value (gdm-configuration))
+                  (description
+                   "Run the GNOME Desktop Manager (GDM), a program that allows
+you to log in in a graphical session, whether or not you use GNOME."))))
 
 (define-deprecated (gdm-service #:key (gdm gdm)
                                 (allow-empty-passwords? #t)