From e57c2adb2a7ed94610f4c35e8710bc1346199de6 Mon Sep 17 00:00:00 2001 From: Timothy Sample Date: Wed, 13 Feb 2019 14:22:14 -0500 Subject: services: gdm: Remove etc service. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/gnome.scm (gdm)[arguments]: Update pre-configure phase to make GDM get the configuration file path from an environment variable. * gnu/services/xorg.scm (gdm-etc-service): Remove function. (gdm-configuration-file): New function. (gdm-shepherd-service): Set GDM_CUSTOM_CONF before invoking GDM. (gdm-service-type)[extensions]: Remove etc-service-type extension. Signed-off-by: Ludovic Courtès --- gnu/services/xorg.scm | 67 ++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 35 deletions(-) (limited to 'gnu/services/xorg.scm') diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 1efb275794..de5438e3fe 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -2,7 +2,7 @@ ;;; Copyright © 2017 Andy Wingo ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019 Ludovic Courtès ;;; Copyright © 2015 Sou Bunnbu -;;; Copyright © 2018 Timothy Sample +;;; Copyright © 2018, 2019 Timothy Sample ;;; ;;; This file is part of GNU Guix. ;;; @@ -633,38 +633,34 @@ makes the good ol' XlockMore usable." (x-server gdm-configuration-x-server (default (xorg-wrapper)))) -(define (gdm-etc-service config) - (define gdm-configuration-file - (mixed-text-file "gdm-custom.conf" - "[daemon]\n" - "#User=gdm\n" - "#Group=gdm\n" - (if (gdm-configuration-auto-login? config) - (string-append - "AutomaticLoginEnable=true\n" - "AutomaticLogin=" - (or (gdm-configuration-default-user config) - (error "missing default user for auto-login")) - "\n") - (string-append - "AutomaticLoginEnable=false\n" - "#AutomaticLogin=\n")) - "#TimedLoginEnable=false\n" - "#TimedLogin=\n" - "#TimedLoginDelay=0\n" - "#InitialSetupEnable=true\n" - ;; Enable me once X is working. - "WaylandEnable=false\n" - "\n" - "[debug]\n" - "#Enable=true\n" - "\n" - "[security]\n" - "#DisallowTCP=true\n" - "#AllowRemoteAutoLogin=false\n")) - `(("gdm" ,(file-union - "gdm" - `(("custom.conf" ,gdm-configuration-file)))))) +(define (gdm-configuration-file config) + (mixed-text-file "gdm-custom.conf" + "[daemon]\n" + "#User=gdm\n" + "#Group=gdm\n" + (if (gdm-configuration-auto-login? config) + (string-append + "AutomaticLoginEnable=true\n" + "AutomaticLogin=" + (or (gdm-configuration-default-user config) + (error "missing default user for auto-login")) + "\n") + (string-append + "AutomaticLoginEnable=false\n" + "#AutomaticLogin=\n")) + "#TimedLoginEnable=false\n" + "#TimedLogin=\n" + "#TimedLoginDelay=0\n" + "#InitialSetupEnable=true\n" + ;; Enable me once X is working. + "WaylandEnable=false\n" + "\n" + "[debug]\n" + "#Enable=true\n" + "\n" + "[security]\n" + "#DisallowTCP=true\n" + "#AllowRemoteAutoLogin=false\n")) (define (gdm-pam-service config) "Return a PAM service for @command{gdm}." @@ -698,6 +694,9 @@ makes the good ol' XlockMore usable." "/bin/gdm")) #:environment-variables (list (string-append + "GDM_CUSTOM_CONF=" + #$(gdm-configuration-file config)) + (string-append "GDM_X_SERVER=" #$(gdm-configuration-x-server config)) ;; XXX: GDM requires access to a handful of @@ -719,8 +718,6 @@ makes the good ol' XlockMore usable." (const %gdm-accounts)) (service-extension pam-root-service-type gdm-pam-service) - (service-extension etc-service-type - gdm-etc-service) (service-extension dbus-root-service-type (compose list gdm-configuration-gdm)))) -- cgit v1.2.3 From 1f564c1573f2d120a55e3b321a0c558a51720bce Mon Sep 17 00:00:00 2001 From: Timothy Sample Date: Wed, 13 Feb 2019 14:22:19 -0500 Subject: gnu: gdm: Run dbus-daemon via a wrapper script. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/gnome.scm (gdm)[arguments]: Modify the pre-configure phase so that GDM propagates the GDM_DBUS_DAEMON variable into the session environment and uses its value to invoke dbus-daemon. * gnu/services/xorg.scm (dbus-daemon-wrapper): New variable. (): Add 'dbus-daemon' field. (gdm-shepherd-service): Set GDM_DBUS_DAEMON before invoking gdm. Signed-off-by: Ludovic Courtès --- gnu/packages/gnome.scm | 3 +++ gnu/services/xorg.scm | 15 +++++++++++++++ 2 files changed, 18 insertions(+) (limited to 'gnu/services/xorg.scm') diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm index dec567a0e0..794f3a8843 100644 --- a/gnu/packages/gnome.scm +++ b/gnu/packages/gnome.scm @@ -5461,6 +5461,7 @@ libxml2.") (("DATADIR \"/gnome") "\"/run/current-system/profile/share/gnome")) (let ((propagate '("GDM_CUSTOM_CONF" + "GDM_DBUS_DAEMON" "GDM_X_SERVER" ;; XXX: Remove this once GNOME Shell is ;; a dependency of GDM. @@ -5486,6 +5487,8 @@ libxml2.") (("\\(X_SERVER X_SERVER_ARG_FORMAT") "(\"%s\" X_SERVER_ARG_FORMAT, g_getenv (\"GDM_X_SERVER\")")) (substitute* '("daemon/gdm-x-session.c") + (("\"dbus-daemon\"") + "g_getenv (\"GDM_DBUS_DAEMON\")") (("X_SERVER") "g_getenv (\"GDM_X_SERVER\")")) ;; Use an absolute path for GNOME Session. diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index de5438e3fe..6a589779b9 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -29,6 +29,7 @@ #:use-module (gnu packages guile) #:use-module (gnu packages xorg) #:use-module (gnu packages gl) + #:use-module (gnu packages glib) #:use-module (gnu packages display-managers) #:use-module (gnu packages gnustep) #:use-module (gnu packages gnome) @@ -623,12 +624,23 @@ makes the good ol' XlockMore usable." (home-directory "/var/lib/gdm") (shell (file-append shadow "/sbin/nologin"))))) +(define dbus-daemon-wrapper + (program-file "gdm-dbus-wrapper" + #~(begin + (setenv "XDG_CONFIG_DIRS" + "/run/current-system/profile/etc/xdg") + (setenv "XDG_DATA_DIRS" + "/run/current-system/profile/share") + (apply execl (string-append #$dbus "/bin/dbus-daemon") + (program-arguments))))) + (define-record-type* gdm-configuration make-gdm-configuration gdm-configuration? (gdm gdm-configuration-gdm (default gdm)) (allow-empty-passwords? gdm-configuration-allow-empty-passwords? (default #t)) (auto-login? gdm-configuration-auto-login? (default #f)) + (dbus-daemon gdm-configuration-dbus-daemon (default dbus-daemon-wrapper)) (default-user gdm-configuration-default-user (default #f)) (x-server gdm-configuration-x-server (default (xorg-wrapper)))) @@ -696,6 +708,9 @@ makes the good ol' XlockMore usable." (list (string-append "GDM_CUSTOM_CONF=" #$(gdm-configuration-file config)) + (string-append + "GDM_DBUS_DAEMON=" + #$(gdm-configuration-dbus-daemon config)) (string-append "GDM_X_SERVER=" #$(gdm-configuration-x-server config)) -- cgit v1.2.3 From 7e61419892aa68f7238e50e71f6e69a2e6a53211 Mon Sep 17 00:00:00 2001 From: Timothy Sample Date: Wed, 13 Feb 2019 14:22:20 -0500 Subject: services: gdm: Make dependencies explicit. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit removes the remaining implicit dependencies that the GDM service had on the GNOME Desktop service. * gnu/services/xorg.scm (gdm-configuration): Add a gnome-shell-assets field for specifying any icons or fonts that the GNOME Shell theme needs. (gdm-shepherd-service): Remove environment variables pointing to '/run/current-system' and set XDG_DATA_DIRS so that it points to 'gnome-shell' and its assets. (gdm-service-type): Extend 'profile-service-type' to ensure that necessary fonts are installed in the system profile. Signed-off-by: Ludovic Courtès --- gnu/services/xorg.scm | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'gnu/services/xorg.scm') diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 6a589779b9..4e6f5ad44f 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -28,6 +28,7 @@ #:use-module ((gnu packages base) #:select (canonical-package)) #:use-module (gnu packages guile) #:use-module (gnu packages xorg) + #:use-module (gnu packages fonts) #:use-module (gnu packages gl) #:use-module (gnu packages glib) #:use-module (gnu packages display-managers) @@ -642,6 +643,8 @@ makes the good ol' XlockMore usable." (auto-login? gdm-configuration-auto-login? (default #f)) (dbus-daemon gdm-configuration-dbus-daemon (default dbus-daemon-wrapper)) (default-user gdm-configuration-default-user (default #f)) + (gnome-shell-assets gdm-configuration-gnome-shell-assets + (default (list adwaita-icon-theme font-cantarell))) (x-server gdm-configuration-x-server (default (xorg-wrapper)))) @@ -714,13 +717,16 @@ makes the good ol' XlockMore usable." (string-append "GDM_X_SERVER=" #$(gdm-configuration-x-server config)) - ;; XXX: GDM requires access to a handful of - ;; programs and components from Gnome (gnome-shell, - ;; dbus, and gnome-session among others). The - ;; following variables only work provided Gnome is - ;; installed. - "XDG_DATA_DIRS=/run/current-system/profile/share" - "PATH=/run/current-system/profile/bin")))) + (string-append + "XDG_DATA_DIRS=" + ((lambda (ls) (string-join ls ":")) + (map (lambda (path) + (string-append path "/share")) + ;; XXX: Remove gnome-shell below when GDM + ;; can depend on GNOME Shell directly. + (cons #$gnome-shell + '#$(gdm-configuration-gnome-shell-assets + config))))))))) (stop #~(make-kill-destructor)) (respawn? #t)))) @@ -733,6 +739,8 @@ makes the good ol' XlockMore usable." (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)))) -- cgit v1.2.3 From 41fa9f1815685ede0d3fdc1c561d2a9cf0ffb158 Mon Sep 17 00:00:00 2001 From: Timothy Sample Date: Wed, 13 Feb 2019 14:22:21 -0500 Subject: services: gdm: Allow for custom X session scripts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/gnome.scm (gdm)[arguments]: Update pre-configure phase so that GDM runs an X session script specified by the variable GDM_X_SESSION; remove the '--enable-gdm-xsession' configuration option. * gnu/services/xorg.scm (): Add 'x-session' field. (gdm-shepherd-service): Set the GDM_X_SESSION variable. Signed-off-by: Ludovic Courtès --- gnu/packages/gnome.scm | 9 ++++----- gnu/services/xorg.scm | 7 ++++++- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'gnu/services/xorg.scm') diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm index 794f3a8843..7001a12b19 100644 --- a/gnu/packages/gnome.scm +++ b/gnu/packages/gnome.scm @@ -5410,10 +5410,6 @@ libxml2.") ;; service for TTY 1 before starting GDM). "--with-initial-vt=7" - ;; By default, GDM expects distributions to install a custom Xsession - ;; script. It provides a generic one if --enable-gdm-xsession is set. - "--enable-gdm-xsession" - ;; Use '/etc/environment' for locale settings instead of the ;; systemd-specific '/etc/locale.conf'. "--with-lang-file=/etc/environment" @@ -5463,6 +5459,7 @@ libxml2.") (let ((propagate '("GDM_CUSTOM_CONF" "GDM_DBUS_DAEMON" "GDM_X_SERVER" + "GDM_X_SESSION" ;; XXX: Remove this once GNOME Shell is ;; a dependency of GDM. "XDG_DATA_DIRS"))) @@ -5490,7 +5487,9 @@ libxml2.") (("\"dbus-daemon\"") "g_getenv (\"GDM_DBUS_DAEMON\")") (("X_SERVER") - "g_getenv (\"GDM_X_SERVER\")")) + "g_getenv (\"GDM_X_SERVER\")") + (("GDMCONFDIR \"/Xsession\"") + "g_getenv (\"GDM_X_SESSION\")")) ;; Use an absolute path for GNOME Session. (substitute* "daemon/gdm-launch-environment.c" (("\"gnome-session\"") diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 4e6f5ad44f..f7d07b309e 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -646,7 +646,9 @@ makes the good ol' XlockMore usable." (gnome-shell-assets gdm-configuration-gnome-shell-assets (default (list adwaita-icon-theme font-cantarell))) (x-server gdm-configuration-x-server - (default (xorg-wrapper)))) + (default (xorg-wrapper))) + (x-session gdm-configuration-x-session + (default (xinitrc)))) (define (gdm-configuration-file config) (mixed-text-file "gdm-custom.conf" @@ -717,6 +719,9 @@ makes the good ol' XlockMore usable." (string-append "GDM_X_SERVER=" #$(gdm-configuration-x-server config)) + (string-append + "GDM_X_SESSION=" + #$(gdm-configuration-x-session config)) (string-append "XDG_DATA_DIRS=" ((lambda (ls) (string-join ls ":")) -- cgit v1.2.3 From 24f11b06bbd2c7f4a236a5ef4b6d9c7bf5be47a8 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Fri, 15 Feb 2019 19:13:55 +0100 Subject: services: xorg: Enable override of xserver-arguments. * gnu/services/xorg.scm (xorg-start-command): Add parameter #:xserver-arguments. * doc/guix.texi (X Window): Document it. --- doc/guix.texi | 19 ++++++++++++++++++- gnu/services/xorg.scm | 8 +++++--- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'gnu/services/xorg.scm') diff --git a/doc/guix.texi b/doc/guix.texi index 04192840a0..2ccc788703 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -31,7 +31,7 @@ Copyright @copyright{} 2016, 2017, 2018 Chris Marusich@* Copyright @copyright{} 2016, 2017, 2018 Efraim Flashner@* Copyright @copyright{} 2016 John Darrington@* Copyright @copyright{} 2016, 2017 Nils Gillmann@* -Copyright @copyright{} 2016, 2017, 2018 Jan Nieuwenhuizen@* +Copyright @copyright{} 2016, 2017, 2018, 2019 Jan Nieuwenhuizen@* Copyright @copyright{} 2016 Julien Lepiller@* Copyright @copyright{} 2016 Alex ter Weele@* Copyright @copyright{} 2016, 2017, 2018, 2019 Christopher Baines@* @@ -13140,6 +13140,7 @@ type @code{}. [#:fonts %default-xorg-fonts] @ [#:configuration-file (xorg-configuration-file @dots{})] @ [#:xorg-server @var{xorg-server}] + [#:xserver-arguments '("-nolisten" "tcp")] Return a @code{startx} script in which @var{modules}, a list of X module packages, and @var{fonts}, a list of X font directories, are available. See @code{xorg-wrapper} for more details on the arguments. The result should be @@ -13148,6 +13149,22 @@ used in place of @code{startx}. Usually the X server is started by a login manager. @end deffn +@cindex @code{-listen tcp}, for X11. +This procedure is useful to override command line options for the X server, +such as having it listen to over TCP: + +@example +(operating-system + ... + (services + (modify-services %desktop-services + (slim-service-type config => + (slim-configuration + (inherit config) + (startx (xorg-start-command + #:xserver-arguments '("-listen" "tcp")))))))) +@end example + @deffn {Scheme Procedure} xorg-configuration-file @ [#:modules %default-xorg-modules] @ [#:fonts %default-xorg-fonts] @ diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index f7d07b309e..f2a3c28c90 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019 Ludovic Courtès ;;; Copyright © 2015 Sou Bunnbu ;;; Copyright © 2018, 2019 Timothy Sample +;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -292,7 +293,8 @@ in place of @code{/usr/bin/X}." (configuration-file (xorg-configuration-file #:modules modules #:fonts fonts)) - (xorg-server xorg-server)) + (xorg-server xorg-server) + (xserver-arguments '("-nolisten" "tcp"))) "Return a @code{startx} script in which @var{modules}, a list of X module packages, and @var{fonts}, a list of X font directories, are available. See @code{xorg-wrapper} for more details on the arguments. The result should be @@ -305,8 +307,8 @@ used in place of @code{startx}." (define exp ;; Write a small wrapper around the X server. #~(apply execl #$X #$X ;; Second #$X is for argv[0]. - "-logverbose" "-verbose" "-nolisten" "tcp" "-terminate" - (cdr (command-line)))) + "-logverbose" "-verbose" "-terminate" #$@xserver-arguments + (cdr (command-line)))) (program-file "startx" exp)) -- cgit v1.2.3