From 779d96c9b0ee38cbaca9f8577e6cc7f907fb29cb Mon Sep 17 00:00:00 2001 From: shtwzrd Date: Sun, 9 Feb 2020 21:31:09 +0000 Subject: services: xorg: Filter modules based on system MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes . Reported by shtwzrd . * gnu/services/xorg.scm (xorg-configuration): Apply a filter over %default-xorg-modules packages, excluding those for which the %current-system is not among the package's supported-systems. This patch makes it possible to use xorg-configuration on systems other than x86_64 and i686, as without it, xf86-video-intel would be pulled in on the unsupported architecture and fail. Signed-off-by: Jakub Kądziołka --- gnu/services/xorg.scm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'gnu/services') diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 73a32e4b02..df5c350a37 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2018, 2019 Timothy Sample ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2019 Tim Gesthuizen +;;; Copyright © 2020 shtwzrd ;;; ;;; This file is part of GNU Guix. ;;; @@ -152,7 +153,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 -- cgit v1.2.3 From 3c6aca4232d1a3638ec962bc7afe9121626c43ec Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Sun, 16 Feb 2020 09:25:00 +0200 Subject: doc: Fix typo. * doc/guix.texi (X Window)[sddm-service-type]: SSDM -> SDDM typo fix. [sddm-configuration]: Also list 'maya' theme. * gnu/services/sddm.scm (sddm-service): Fix typo in doc string. (sddm-configuration): Also list 'maya' theme. --- doc/guix.texi | 4 ++-- gnu/services/sddm.scm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'gnu/services') diff --git a/doc/guix.texi b/doc/guix.texi index 5d9292b2e9..aa50340fe2 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -14458,7 +14458,7 @@ Command to run when halting. Command to run when rebooting. @item @code{theme} (default "maldives") -Theme to use. Default themes provided by SDDM are "elarun" or "maldives". +Theme to use. Default themes provided by SDDM are "elarun", "maldives" or "maya". @item @code{themes-directory} (default "/run/current-system/profile/share/sddm/themes") Directory to look for themes. @@ -14533,7 +14533,7 @@ Relogin after logout. @cindex X11 login @defvr {Scheme Variable} sddm-service-type This is the type of the service to run the -@uref{https://github.com/sddm/sddm,SSDM display manager}. Its value +@uref{https://github.com/sddm/sddm,SDDM display manager}. Its value must be a @code{sddm-configuration} record (see below). Here's an example use: diff --git a/gnu/services/sddm.scm b/gnu/services/sddm.scm index ac8c9a8403..473b4876a1 100644 --- a/gnu/services/sddm.scm +++ b/gnu/services/sddm.scm @@ -56,7 +56,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 @@ -325,6 +325,6 @@ 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{} object." (service sddm-service-type config)) -- cgit v1.2.3 From 8b9cad01e9619f53dc5a65892ca6a09ca5de3447 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 16 Feb 2020 23:28:54 +0100 Subject: services: shepherd: Spawn services with nothing but the PATH variable. Previously, services spawned with 'make-forkexec-constructor' & co. would all inherit the environment variables of PID 1, which includes things like 'BOOT_IMAGE'. This change resets it to the bare minimum. * gnu/services/shepherd.scm (shepherd-configuration-file): Add call to 'default-environment-variables'. Remove 'setenv' call. --- gnu/services/shepherd.scm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'gnu/services') 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 +;;; Copyright © 2013, 2014, 2015, 2016, 2018, 2019, 2020 Ludovic Courtès ;;; Copyright © 2017 Clément Lassieur ;;; Copyright © 2018 Carlo Zancanaro ;;; @@ -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 -- cgit v1.2.3 From 0372dd1a1e51e39382ee5d1aa968589b40506b8f Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Wed, 19 Feb 2020 03:35:05 +0100 Subject: gnu: services: Fix openvpn boolean fields. * gnu/services/vpn.scm (serialize-boolean): Do not print #t to the file. --- gnu/services/vpn.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu/services') diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm index cbb4a79a7b..4602b3f3db 100644 --- a/gnu/services/vpn.scm +++ b/gnu/services/vpn.scm @@ -61,7 +61,7 @@ (define serialize-string serialize-field) (define (serialize-boolean field-name val) (if val - (serialize-field field-name val) + (serialize-field field-name "") (format #t ""))) (define (ip-mask? val) -- cgit v1.2.3 From c6c447701c9cfdeedf77224399faa9c07b12d045 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Wed, 19 Feb 2020 03:33:12 +0100 Subject: gnu: services: Add openvpn options. * gnu/services/vpn.scm (openvpn-client-configuration) (openvpn-server-configuration): Add fast-io? and auth-user-pass options. --- doc/guix.texi | 22 ++++++++++++++++++++++ gnu/services/vpn.scm | 12 ++++++++++++ 2 files changed, 34 insertions(+) (limited to 'gnu/services') diff --git a/doc/guix.texi b/doc/guix.texi index aa50340fe2..afb70d5378 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -21794,6 +21794,13 @@ Defaults to @samp{#t}. @end deftypevr +@deftypevr {@code{openvpn-client-configuration} parameter} boolean fast-io? +(Experimental) Optimize TUN/TAP/UDP I/O writes by avoiding a call to +poll/epoll/select prior to the write operation. + +Defaults to @samp{#f}. +@end deftypevr + @deftypevr {@code{openvpn-client-configuration} parameter} number verbosity Verbosity level. @@ -21809,6 +21816,14 @@ Defaults to @samp{#f}. @end deftypevr +@deftypevr {@code{openvpn-client-configuration} parameter} maybe-string auth-user-pass +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. + +Defaults to @samp{'disabled}. +@end deftypevr + @deftypevr {@code{openvpn-client-configuration} parameter} key-usage verify-key-usage? Whether to check the server certificate has server usage extension. @@ -21930,6 +21945,13 @@ Defaults to @samp{#t}. @end deftypevr +@deftypevr {@code{openvpn-server-configuration} parameter} boolean fast-io? +(Experimental) Optimize TUN/TAP/UDP I/O writes by avoiding a call to +poll/epoll/select prior to the write operation. + +Defaults to @samp{#f}. +@end deftypevr + @deftypevr {@code{openvpn-server-configuration} parameter} number verbosity Verbosity level. diff --git a/gnu/services/vpn.scm b/gnu/services/vpn.scm index 4602b3f3db..658d5c3e88 100644 --- a/gnu/services/vpn.scm +++ b/gnu/services/vpn.scm @@ -59,6 +59,7 @@ (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 "") @@ -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.") -- cgit v1.2.3 From 00500449b0d53bb9219608a3cbee8faf7a3edae1 Mon Sep 17 00:00:00 2001 From: Florian Pelz Date: Thu, 20 Feb 2020 14:05:06 +0100 Subject: services: udev: Do not rely on shepherd inheriting environment variables. Fixes . * gnu/services/base.scm (udev-shepherd-service)[start] Move or copy environment variables to 'fork+exec-command' instead of 'setenv'. --- gnu/services/base.scm | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 0c154d1c4e..706b3ae7ec 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -11,6 +11,7 @@ ;;; Copyright © 2019 Tobias Geerinckx-Rice ;;; Copyright © 2019 John Soo ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2020 Florian Pelz ;;; ;;; 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. -- cgit v1.2.3 From 50be0da7bfd5c108697679effeb2a893d2f37598 Mon Sep 17 00:00:00 2001 From: Jakub Kądziołka Date: Sun, 16 Feb 2020 12:58:33 +0100 Subject: services: set-xorg-configuration: handle slim and sddm * gnu/services/xorg.scm (handle-xorg-configuration): New syntax. (gdm-service-type, slim-service-type): Use handle-xorg-configuration. * gnu/services/sddm.scm (sddm-service-type): Likewise. --- gnu/services/sddm.scm | 34 ++++++++-------- gnu/services/xorg.scm | 108 +++++++++++++++++++++++++++----------------------- 2 files changed, 77 insertions(+), 65 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/sddm.scm b/gnu/services/sddm.scm index 473b4876a1..1921afce95 100644 --- a/gnu/services/sddm.scm +++ b/gnu/services/sddm.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2016 David Craven ;;; Copyright © 2019 Ludovic Courtès ;;; Copyright © 2019 Jesse Gildersleve +;;; Copyright © 2020 Jakub Kądziołka ;;; ;;; This file is part of GNU Guix. ;;; @@ -306,22 +307,23 @@ 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 diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index df5c350a37..09379d40c3 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2019 Tim Gesthuizen ;;; Copyright © 2020 shtwzrd +;;; Copyright © 2020 Jakub Kądziołka ;;; ;;; This file is part of GNU Guix. ;;; @@ -103,6 +104,8 @@ gdm-configuration gdm-service-type gdm-service + + handle-xorg-configuration set-xorg-configuration)) ;;; Commentary: @@ -459,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. @@ -584,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? @@ -946,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 - ;; 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) -- cgit v1.2.3 From 8f5a0a97b1d04e8ade8c16694dcb72aed176c595 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Thu, 27 Feb 2020 16:42:36 +0100 Subject: services: herd: Add restart-service. * gnu/services/herd.scm (restart-service): New exported procedure. --- gnu/services/herd.scm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'gnu/services') 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 -;;; Copyright © 2017 Mathieu Othacehe +;;; Copyright © 2017, 2020 Mathieu Othacehe ;;; ;;; 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) -- cgit v1.2.3