From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:37728) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRHHG-0002Hx-K5 for guix-patches@gnu.org; Wed, 22 Apr 2020 11:27:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRHHC-0005IQ-Vp for guix-patches@gnu.org; Wed, 22 Apr 2020 11:27:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41369) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRHHC-0005I7-9I for guix-patches@gnu.org; Wed, 22 Apr 2020 11:27:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jRHHC-0001Zy-62 for guix-patches@gnu.org; Wed, 22 Apr 2020 11:27:02 -0400 Subject: [bug#35305] LightDM service Resent-Message-ID: From: L p R n d n References: <87sghcir5k.fsf@lprndn.info> <2d2d720d1fd6a6357a171e13953a593b@waegenei.re> Date: Wed, 22 Apr 2020 17:26:04 +0200 In-Reply-To: <2d2d720d1fd6a6357a171e13953a593b@waegenei.re> (Brice Waegeneire's message of "Sun, 12 Apr 2020 09:53:41 +0000") Message-ID: <87tv1bmtir.fsf@lprndn.info> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 35305@debbugs.gnu.org --=-=-= Content-Type: text/plain Hello, Here is the new set of patches with quite a few modifications for the service, everything rebased on 1.1.0. After a discussion with bricewge on irc, a new design has been adopted allowing use of multiple seats. To use the service, you can instantiate a lightdm-service-type, a lightdm-gtk-greeter-service-type or both. The service should always find a way to start a working instance of LightDM. :) A non exhaustive list of changes that might need further review: * lightdm-gtk-greeter has its own service extending lightdm-service and others. * Seats configuration use now the lightdm-seat-record-type and can be defined both in the lightdm-service and lightdm-gtk-greeter-service. The greeter now extends the LightDM's service by providing a list of seats. * The `compose` and `extend` field of the lightdm-service-type have seen work for this purpose while keeping compatibility with `set-xorg-configuration`. * extra-config fields are list of strings to avoid weird indentation in the user's config. * Fixed customization of lightdm-gtk-greeter's cursor. * Added some fields to deal with accessibility for lightdm-gtk-greeter-configuration. * Takes default background from guix-artwork. Also a review of PAM services might be nice as I'm not versed in security. However, I didn't get rid of etc-service-type's extension as LightDM's seems to ignore `sessions-directory` when configuration is passed through `--config`. Patches to fix that are welcome but can wait a future patch submission, I think. Otherwise, tested in a WM: default configurations, autologin, sway, changing greeter appearance and everything worked fine. For passwordless login, had to actually delete user's password manually to make it work. I don't know if it's expected. Have a nice day and good review :) L p R n d n --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-gnu-lightdm-Update-1.30.0.patch >From fc80fd5c5a4e3ffa1de0f96d2e157e230a6d7afd Mon Sep 17 00:00:00 2001 From: L p R n d n Date: Tue, 16 Apr 2019 13:16:39 +0200 Subject: [PATCH 01/10] gnu: lightdm: Update 1.30.0. * gnu/packages/display-managers.scm (lightdm): Update to 1.30.0. --- gnu/packages/display-managers.scm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gnu/packages/display-managers.scm b/gnu/packages/display-managers.scm index 51605e09aa..f23dc7f573 100644 --- a/gnu/packages/display-managers.scm +++ b/gnu/packages/display-managers.scm @@ -125,16 +125,15 @@ create smooth, animated user interfaces.") (define-public lightdm (package (name "lightdm") - (version "1.24.0") + (version "1.30.0") (source (origin (method url-fetch) - (uri (string-append "https://launchpad.net/lightdm/" - (version-major+minor version) "/" - version "/+download/lightdm-" - version ".tar.xz")) + (uri (string-append + "https://github.com/CanonicalLtd/lightdm/releases/download/" + version "/lightdm-" version ".tar.xz")) (sha256 (base32 - "18j33bm54i8k7ncxcs69zqi4105s62n58jrydqn3ikrb71s9nl6d")))) + "158zb2d0v1309a8v19hh32y4yj3v6yg4yg6m0l7v59d3a2b7f651")))) (build-system gnu-build-system) (arguments '(#:parallel-tests? #f ; fails when run in parallel -- 2.26.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-gnu-lightdm-Add-vala-bindings.patch >From 79e893dd86ff913bb840ba36fe2d9aa36a4e82f0 Mon Sep 17 00:00:00 2001 From: L p R n d n Date: Tue, 16 Apr 2019 13:21:55 +0200 Subject: [PATCH 02/10] gnu: lightdm: Add vala bindings. * gnu/packages/display-managers.scm (lightdm) [native-inputs]: Add vala. --- gnu/packages/display-managers.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/gnu/packages/display-managers.scm b/gnu/packages/display-managers.scm index f23dc7f573..065b1c0000 100644 --- a/gnu/packages/display-managers.scm +++ b/gnu/packages/display-managers.scm @@ -180,6 +180,7 @@ create smooth, animated user interfaces.") ("pkg-config" ,pkg-config) ("itstool" ,itstool) ("intltool" ,intltool) + ("vala" ,vala) ;For vala bindings ;; For tests ("dbus" ,dbus) ("python" ,python-2) -- 2.26.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0003-gnu-lightdm-Disable-python-tests-only.patch >From ac36258c83329462f7b7730ea9a753cd4fe61a66 Mon Sep 17 00:00:00 2001 From: L p R n d n Date: Tue, 16 Apr 2019 13:26:22 +0200 Subject: [PATCH 03/10] gnu: lightdm: Disable python tests only. * gnu/packages/patches/lightdm-disable-python-tests.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/display-managers.scm (lightdm)[source]: Use patch. * gnu/packages/display-managers.scm (lightdm)[arguments]: Remove test-python-greeter wrapping. * gnu/packages/display-managers.scm (lightdm)[native-inputs]: Remove python and python-gobject. --- gnu/local.mk | 1 + gnu/packages/display-managers.scm | 18 ++------- .../lightdm-disable-python-tests.patch | 40 +++++++++++++++++++ 3 files changed, 44 insertions(+), 15 deletions(-) create mode 100644 gnu/packages/patches/lightdm-disable-python-tests.patch diff --git a/gnu/local.mk b/gnu/local.mk index 952fc55df4..880adcd457 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1169,6 +1169,7 @@ dist_patch_DATA = \ %D%/packages/patches/lierolibre-newer-libconfig.patch \ %D%/packages/patches/lierolibre-remove-arch-warning.patch \ %D%/packages/patches/lierolibre-try-building-other-arch.patch \ + %D%/packages/patches/lightdm-disable-python-tests.patch \ %D%/packages/patches/linkchecker-tests-require-network.patch \ %D%/packages/patches/linux-libre-support-for-Pinebook-Pro.patch \ %D%/packages/patches/linux-pam-no-setfsuid.patch \ diff --git a/gnu/packages/display-managers.scm b/gnu/packages/display-managers.scm index 065b1c0000..e8fae583f1 100644 --- a/gnu/packages/display-managers.scm +++ b/gnu/packages/display-managers.scm @@ -133,7 +133,8 @@ create smooth, animated user interfaces.") version "/lightdm-" version ".tar.xz")) (sha256 (base32 - "158zb2d0v1309a8v19hh32y4yj3v6yg4yg6m0l7v59d3a2b7f651")))) + "158zb2d0v1309a8v19hh32y4yj3v6yg4yg6m0l7v59d3a2b7f651")) + (patches (search-patches "lightdm-disable-python-tests.patch")))) (build-system gnu-build-system) (arguments '(#:parallel-tests? #f ; fails when run in parallel @@ -152,19 +153,8 @@ create smooth, animated user interfaces.") (substitute* "src/seat.c" (("/bin/sh") (which "sh"))) #t)) - (add-after 'unpack 'disable-broken-tests - (lambda _ - (substitute* "tests/Makefile.in" - (("test-sessions-gobject ") "") - ((" test-sessions-python ") " ")) - #t)) (add-before 'check 'pre-check - ;; Run test-suite under a dbus session. (lambda* (#:key inputs #:allow-other-keys) - (wrap-program "tests/src/test-python-greeter" - `("PYTHONPATH" ":" prefix (,(getenv "PYTHONPATH"))) - `("GI_TYPELIB_PATH" ":" prefix (,(getenv "GI_TYPELIB_PATH")))) - ;; Avoid printing locale warnings, which trip up the text ;; matching tests. (unsetenv "LC_ALL") @@ -182,9 +172,7 @@ create smooth, animated user interfaces.") ("intltool" ,intltool) ("vala" ,vala) ;For vala bindings ;; For tests - ("dbus" ,dbus) - ("python" ,python-2) - ("python-pygobject" ,python2-pygobject))) + ("dbus" ,dbus))) ;; Required by liblightdm-gobject-1.pc. (propagated-inputs `(("glib" ,glib) diff --git a/gnu/packages/patches/lightdm-disable-python-tests.patch b/gnu/packages/patches/lightdm-disable-python-tests.patch new file mode 100644 index 0000000000..b1850f279c --- /dev/null +++ b/gnu/packages/patches/lightdm-disable-python-tests.patch @@ -0,0 +1,40 @@ + tests/Makefile.in | 23 ----------------------- + 1 file changed, 23 deletions(-) + +diff --git a/tests/Makefile.in b/tests/Makefile.in +index 9451a6f..46c027c 100644 +--- a/tests/Makefile.in ++++ b/tests/Makefile.in +@@ -810,29 +810,6 @@ TESTS = test-xserver-fail-start test-greeter-fail-start \ + test-wayland-autologin test-wayland-greeter \ + test-wayland-session test-invalid-seat \ + test-seatdefaults-still-supported \ +- test-autologin-timeout-python \ +- test-autologin-guest-timeout-python \ +- test-autologin-session-timeout-python \ +- test-cancel-authentication-python test-sessions-python \ +- test-users-python test-login-python test-login-manual-python \ +- test-login-manual-previous-session-python \ +- test-login-no-password-python test-login-long-username-python \ +- test-login-long-password-python test-login-two-factor-python \ +- test-login-new-authtok-python test-login-info-prompt-python \ +- test-login-multi-info-prompt-python \ +- test-login-previous-session-python \ +- test-login-wrong-password-python \ +- test-login-invalid-user-python \ +- test-login-invalid-session-python test-login-logout-python \ +- test-login-pick-session-python \ +- test-login-remember-session-python \ +- test-login-manual-remember-session-python \ +- test-login-guest-python test-login-guest-pick-session-python \ +- test-login-guest-disabled-python \ +- test-login-guest-no-setup-script-python \ +- test-login-guest-fail-setup-script-python \ +- test-login-guest-logout-python \ +- test-login-remote-session-python test-power-python \ + $(am__append_1) $(am__append_2) + EXTRA_DIST = \ + $(TESTS) \ +-- +2.25.1 + -- 2.26.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0004-gnu-lightdm-gtk-greeter-Fix-at-spi-runtime-dependenc.patch >From 3474c4025451a3554ef33ab0712bb40f5626ef6e Mon Sep 17 00:00:00 2001 From: L p R n d n Date: Tue, 16 Apr 2019 13:50:58 +0200 Subject: [PATCH 04/10] gnu: lightdm-gtk-greeter: Fix at-spi runtime dependency. * gnu/packages/display-manager.scm (lightdm): Fix at-spi runtime dependency. [inputs]: Add at-spi2-core. [arguments]: Add '--enable-at-spi-command' configure flag. --- gnu/packages/display-managers.scm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gnu/packages/display-managers.scm b/gnu/packages/display-managers.scm index e8fae583f1..65f7d6ed79 100644 --- a/gnu/packages/display-managers.scm +++ b/gnu/packages/display-managers.scm @@ -204,7 +204,13 @@ display manager which supports different greeters.") ("pkg-config" ,pkg-config))) (inputs `(("lightdm" ,lightdm) + ("at-spi2-core" ,at-spi2-core) ("gtk+" ,gtk+))) + (arguments + `(#:configure-flags + (list (string-append "--enable-at-spi-command=" + (assoc-ref %build-inputs "at-spi2-core") + "/libexec/at-spi-bus-launcher")))) (synopsis "GTK+ greeter for LightDM") (home-page "https://launchpad.net/lightdm-gtk-greeter") (description "This package provides a LightDM greeter implementation using -- 2.26.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0005-gnu-lightdm-gtk-greeter-Fix-.desktop-file.patch >From 86af8348bd21d24856ba48aa067322e08f791551 Mon Sep 17 00:00:00 2001 From: L p R n d n Date: Tue, 16 Apr 2019 13:58:26 +0200 Subject: [PATCH 05/10] gnu: lightdm-gtk-greeter: Fix .desktop file. * gnu/packages/display-managers.scm (lightdm-gtk-greeter): Fix .desktop file path. [arguments]: Add fix-.desktop-path phase. --- gnu/packages/display-managers.scm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gnu/packages/display-managers.scm b/gnu/packages/display-managers.scm index 65f7d6ed79..fa9b47e2f2 100644 --- a/gnu/packages/display-managers.scm +++ b/gnu/packages/display-managers.scm @@ -210,7 +210,17 @@ display manager which supports different greeters.") `(#:configure-flags (list (string-append "--enable-at-spi-command=" (assoc-ref %build-inputs "at-spi2-core") - "/libexec/at-spi-bus-launcher")))) + "/libexec/at-spi-bus-launcher")) + #:phases + (modify-phases %standard-phases + (add-after 'install 'fix-.desktop-path + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (substitute* (string-append + out "/share/xgreeters/lightdm-gtk-greeter.desktop") + (("Exec=lightdm-gtk-greeter") + (string-append "Exec=" out "/sbin/lightdm-gtk-greeter"))) + #t)))))) (synopsis "GTK+ greeter for LightDM") (home-page "https://launchpad.net/lightdm-gtk-greeter") (description "This package provides a LightDM greeter implementation using -- 2.26.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0006-gnu-lightdm-gtk-greeter-Wrap-binary.patch >From d007dad08e28a613ff787a8cd2f2461d965605ba Mon Sep 17 00:00:00 2001 From: L p R n d n Date: Tue, 16 Apr 2019 14:17:18 +0200 Subject: [PATCH 06/10] gnu: lightdm-gtk-greeter: Wrap binary. * gnu/package/display-managers.scm (lightdm-gtk-greeter): Wrap binary. [inputs]: Add shared-mime-info. [arguments]: Add wrap-program phase. --- gnu/packages/display-managers.scm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/gnu/packages/display-managers.scm b/gnu/packages/display-managers.scm index fa9b47e2f2..ecc006ae3c 100644 --- a/gnu/packages/display-managers.scm +++ b/gnu/packages/display-managers.scm @@ -204,6 +204,7 @@ display manager which supports different greeters.") ("pkg-config" ,pkg-config))) (inputs `(("lightdm" ,lightdm) + ("shared-mime-info" ,shared-mime-info) ("at-spi2-core" ,at-spi2-core) ("gtk+" ,gtk+))) (arguments @@ -220,7 +221,21 @@ display manager which supports different greeters.") out "/share/xgreeters/lightdm-gtk-greeter.desktop") (("Exec=lightdm-gtk-greeter") (string-append "Exec=" out "/sbin/lightdm-gtk-greeter"))) - #t)))))) + #t))) + (add-after 'fix-.desktop-path 'wrap-program + ;; try to mimic glib-or-gtk build system + ;; which doesn't wrap files in /sbin + (lambda* (#:key outputs inputs #:allow-other-keys) + (wrap-program (string-append (assoc-ref outputs "out") + "/sbin/lightdm-gtk-greeter") + `("XDG_DATA_DIRS" ":" prefix + ,(cons "/run/current-system/profile/share" + (map (lambda (pkg) + (string-append (assoc-ref inputs pkg) "/share")) + '("gtk+" "shared-mime-info" "glib")))) + `("GTK_PATH" ":" prefix (,(assoc-ref inputs "gtk+"))) + `("GIO_EXTRA_MODULES" ":" prefix (,(assoc-ref inputs "gtk+")))) + #t))))) (synopsis "GTK+ greeter for LightDM") (home-page "https://launchpad.net/lightdm-gtk-greeter") (description "This package provides a LightDM greeter implementation using -- 2.26.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0007-gnu-lightdm-Build-accountsservice-files.patch >From c2ed7ecd53808284386bbaea8dff9f4450653612 Mon Sep 17 00:00:00 2001 From: L p R n d n Date: Tue, 16 Apr 2019 19:46:44 +0200 Subject: [PATCH 07/10] gnu: lightdm: Build accountsservice files. * gnu/packages/display-managers.scm (lightdm)[native-inputs]: Add accountsservice. --- gnu/packages/display-managers.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gnu/packages/display-managers.scm b/gnu/packages/display-managers.scm index ecc006ae3c..f855b17e3f 100644 --- a/gnu/packages/display-managers.scm +++ b/gnu/packages/display-managers.scm @@ -166,7 +166,8 @@ create smooth, animated user interfaces.") ("libgcrypt" ,libgcrypt) ("libxcb" ,libxcb))) (native-inputs - `(("gobject-introspection" ,gobject-introspection) + `(("accountsservice" ,accountsservice) + ("gobject-introspection" ,gobject-introspection) ("pkg-config" ,pkg-config) ("itstool" ,itstool) ("intltool" ,intltool) -- 2.26.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0008-gnu-lightdm-gtk-greeter-Fix-some-warnings.patch >From 396efb44d1976fd9d5b398782f999e4da8f58ecb Mon Sep 17 00:00:00 2001 From: L p R n d n Date: Wed, 17 Apr 2019 12:44:07 +0200 Subject: [PATCH 08/10] gnu: lightdm-gtk-greeter: Fix some warnings. * gnu/packages/display-managers.scm (lightdm-gtk-greeter): Fix some warnings. [arguments]: Add '--disable-indicator-services-command' configure flags. --- gnu/packages/display-managers.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gnu/packages/display-managers.scm b/gnu/packages/display-managers.scm index f855b17e3f..0a9ae8ee61 100644 --- a/gnu/packages/display-managers.scm +++ b/gnu/packages/display-managers.scm @@ -210,7 +210,8 @@ display manager which supports different greeters.") ("gtk+" ,gtk+))) (arguments `(#:configure-flags - (list (string-append "--enable-at-spi-command=" + (list "--disable-indicator-services-command" + (string-append "--enable-at-spi-command=" (assoc-ref %build-inputs "at-spi2-core") "/libexec/at-spi-bus-launcher")) #:phases -- 2.26.1 --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0009-services-Add-lightdm-service-type.patch Content-Transfer-Encoding: quoted-printable >From 0ec82b2ec999d0e28d16912eae1e2848bb0b3cfe Mon Sep 17 00:00:00 2001 From: L p R n d n Date: Thu, 18 Apr 2019 17:58:56 +0200 Subject: [PATCH 09/10] services: Add lightdm-service-type. * gnu/services/lightdm.scm: Add file (, , ): New record types. (lightdm-seat-configuration->list, lightdm-configuration-file, lightdm-pam-services, lightdm-pam-service, lightdm-etc-service, lightdm-shepherd-service, lightdm-profile-service, lightdm-gtk-greeter-configuration-file, lightdm-gtk-greeter-profile-service, lightdm-gtk-greeter-lightdm-service, lightdm-gtk-greeter-etc-service): New procedures. (%lightdm-accounts, %lightdm-activation, lightdm-greeter-pam-service, lightdm-autologin-pam-service, lightdm-service-type, lightdm-gtk-greeter-service-type): New variables. * doc/guix.texi (X Window): Add documentation. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. --- doc/guix.texi | 129 ++++++++++++ gnu/local.mk | 1 + gnu/services/lightdm.scm | 430 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 560 insertions(+) create mode 100644 gnu/services/lightdm.scm diff --git a/doc/guix.texi b/doc/guix.texi index ef5f68db24..c244203dd9 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -14726,6 +14726,135 @@ auto-login session. @end table @end deftp =20 +@defvr {Scheme Variable} lightdm-service-type +Service type for the LightDM graphical login manager. +It uses the @code{lightdm-gtk-greeter} as default greeter. +See @code{lightdm-configuration} below for configuration and greeters' +services for their specific configuration. +@end defvr + +@deftp {Data Type} lightdm-configuration +Data type representing the lightDM service configuration. + +@table @asis +@item @code{lightdm} (default: @code{lightdm}) +The LightDM package to use. + +@item @code{allow-empty-passwords?} (default: @code{#f}) +Whether to allow logins with empty passwords. + +@item @code{xorg-configuration} (default: @code{(xorg-configuration)}) +Default configuration of the Xorg graphical server. This configuration +will be used for all seats unless explicitly defined. + +@item @code{sessions-directory} (default:"/run/current-system/profile/shar= e/xsessions:/run/current-system/profile/share/wayland-sessions") +Directories where LightDM will search for sessions' @code{.desktop} files. + +@item @code{remote-sessions-directory} (default:"/run/current-system/profi= le/share/remote-session") +Directories where LightDM will search for remote sessions' +@code{.desktop} files. + +@item @code{seats} (default: @code{'()}) +A list of @code{lightdm-seat-configuration} records (see below) +to include in configuration. Note that needed additional packages or +configuration will need to be done manually. Thus, we recommend using a +greeter service for defining seats. If none are provided here or by a gree= ter, +a fallback one is added. + +@item @code{extra-config} (default: @code{'()}) +A list of strings each describing a custom setting to append to the LightDM +configuration. + +@end table +@end deftp + +@deftp {Data Type} lightdm-seat-configuration +Record representing a seat configuration for LightDM. + +@table @asis +@item @code{name-glob} (default: @code{"*"}) +Seat configuration is matched to all seats matching the name glob. + +@item @code{type} (default @code{"local"}) +Type of seat. @code{"local"} or @code{"xremote"}. + +@item @code{xorg-configuration} (default: @code{#f}) +Configuration of the Xorg graphical server. + +@item @code{session-wrapper} (default: @code{(xinitrc)}) +Script to run before starting a X session. + +@item @code{greeter-session} (default: "lightdm-gtk-greeter") +The name of the greeter to be used for this seat. + +@item @code{default-user-session} (default: "") +The name of the default @code{.desktop} file describing a session. +Will be used for @code{user-session} and @code{autologin-session} if neces= sary. + +@item @code{autologin-user} (default: "") +If @code{autologin-user} is set, LightDM logs in directly +as @code{autologin-user} to the session defined in +@code{default-user-session}. This user should be part of the +@code{autologin} group. + +@item @code{extra-config} (default: @code{'()}) +A list of strings each describing a custom setting to append to the seat +configuration. + +@end table +@end deftp + +@defvr {Scheme Variable} lightdm-gtk-greeter-service-type +Service type for the lightdm-gtk-greeter for LightDM. +See @code{lightdm-gtk-greeter-configuration} below for configuration. +@end defvr + +@deftp {Data Type} lightdm-gtk-greeter-configuration +This data type represents the configuration for ligtdm-gtk-greeter. +Use it as an argument of lightdm-gtk-greeter-configuration-file to +get the corresponding file. + +@table @asis +@item @code{lightdm-gtk-greeter} (default: @code{lightdm-gtk-greeter}) +lightdm-gtk-greeter package to use. + +@item @code{assets} (default: @code{(list adwaita-icon-theme gnome-themes-= standard)}) +A list of packages needed by the greeter: icons, themes, fonts etc. + +@item @code{theme-name} (default: "Adwaita") +The name of the GTK+ theme to be used. + +@item @code{icon-theme-name} (default: "Adwaita") +The name of the icon theme to be used for displaying icons. + +@item @code{cursor-theme-name} (default: "Adwaita") +The name of the theme to be used for the cursor. + +@item @code{cursor-size} (default: @code{16}) +The size of the cursor. + +@item @code{background} (default: @code{(file-append %artwork-repository "= /grub/GuixSD-fully-black-16-9.svg")}) +Path to the background image to be used. + +@item @code{a11y-state} (default: "contrast font keyboard reader") +String describing states of accessibility features. @code{"name"} saves st= ate +on exit, @code{"-name"} disables at start and @code{"+name"} enables it. + +@item @code{reader} (default: "") +Command to launch screen reader. + +@item @code{seats} (default: @code{'()}) +List of @code{lightdm-seat-configuration} records (see above) to add to +lightdm.conf through extension. @code{greeter-session} fields +will be forced to @code{"lightdm-gtk-greeter"} + +@item @code{extra-config} (default: @code{'()}) +A list of string each describing a custom setting to append to the greeter +configuration. + +@end table +@end deftp + @cindex Xorg, configuration @deftp {Data Type} xorg-configuration This data type represents the configuration of the Xorg graphical display diff --git a/gnu/local.mk b/gnu/local.mk index 880adcd457..8ade7e4b01 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -568,6 +568,7 @@ GNU_SYSTEM_MODULES =3D \ %D%/services/getmail.scm \ %D%/services/guix.scm \ %D%/services/kerberos.scm \ + %D%/services/lightdm.scm \ %D%/services/linux.scm \ %D%/services/lirc.scm \ %D%/services/virtualization.scm \ diff --git a/gnu/services/lightdm.scm b/gnu/services/lightdm.scm new file mode 100644 index 0000000000..52f71f5437 --- /dev/null +++ b/gnu/services/lightdm.scm @@ -0,0 +1,430 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2019,2020 L p R n d n +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + + +(define-module (gnu services lightdm) + #:use-module (srfi srfi-1) + #:use-module (ice-9 match) + #:use-module (ice-9 receive) + + #:use-module (guix gexp) + #:use-module (guix records) + + #:use-module (gnu artwork) + #:use-module (gnu system pam) + #:use-module (gnu system shadow) + + #:use-module (gnu services) + #:use-module (gnu services dbus) + #:use-module (gnu services desktop) + #:use-module (gnu services shepherd) + #:use-module (gnu services xorg) + + #:use-module (gnu packages admin) + #:use-module (gnu packages display-managers) + #:use-module (gnu packages freedesktop) + #:use-module (gnu packages gnome) + #:use-module (gnu packages xorg) + + #:export (lightdm-seat-configuration + + lightdm-configuration + lightdm-configuration? + lightdm-service-type + + lightdm-gtk-greeter-configuration + lightdm-gtk-greeter-configuration? + lightdm-gtk-greeter-service-type)) + + +;; LIGHTDM + +(define-record-type* + lightdm-seat-configuration make-lightdm-seat-configuration + lightdm-seat-configuration? + (name-glob lightdm-seat-configuration-name-glob + (default "*")) + (type lightdm-seat-configuration-type + (default "local")) + (xorg-configuration lightdm-seat-configuration-xorg-configuration + (default #f)) + (session-wrapper lightdm-seat-configuration-session-wrapper + (default (xinitrc))) + (greeter-session lightdm-seat-configuration-greeter-session + (default "lightdm-gtk-greeter")) + (default-user-session lightdm-seat-configuration-default-user-session + (default "")) + (autologin-user lightdm-seat-configuration-autologin-user + (default "")) + (extra-config lightdm-seat-configuration-extra-config + (default '()))) + + +(define (lightdm-seat-configuration->list seat default-xorg-configuration) + "Given a seat, outputs a list to be used by mixed-text-file through `app= ly." + (match-record seat + (name-glob + type xorg-configuration session-wrapper + greeter-session default-user-session + autologin-user extra-config) + (list " + [Seat:" name-glob "] + type =3D " type + ;; If no xorg-configuration is set by the seat use the one provided + ;; by the lightdm service + " + xserver-command =3D " (xorg-start-command + (or xorg-configuration + default-xorg-configuration)) + " + session-wrapper =3D " session-wrapper " + greeter-session =3D " greeter-session + (if (string-null? default-user-session) "" + (string-append " + user-session =3D " default-user-session)) " + " + ;; Turn autologin ON if autologin-user is set + (if (string-null? autologin-user) "" + (string-append " + autologin-user =3D " autologin-user " + autologin-session =3D " default-user-session)) " + " (if (null? extra-config) "" + (string-join extra-config "\n")) " + "))) + + +(define-record-type* + lightdm-configuration make-lightdm-configuration + lightdm-configuration? + ;; General configuration + (lightdm lightdm-configuration-lightdm + (default lightdm)) + (allow-empty-passwords? lightdm-configuration-allow-empty-passwords? + (default #f)) + (sessions-directory + lightdm-configuration-sessions-directory + (default (string-append + "/run/current-system/profile/share/xsessions" + ":/run/current-system/profile/share/wayland-sessions"))) + (greeters-directory lightdm-configuration-greeters-directory + (default "/run/current-system/profile/share/xgreeter= s")) + (remote-sessions-directory lightdm-configuration-remote-sessions-directo= ry + (default (string-append + "/run/current-system/profile/" + "share/remote-sessions"))) + ;; Having a xorg-configuration field here allows us + ;; to benefit from set-xorg-configuration. + (xorg-configuration lightdm-configuration-xorg-configuration + (default (xorg-configuration))) + (seats lightdm-configuration-seats + (default '())) + (extra-config lightdm-configuration-extra-config + (default '()))) + +(define (lightdm-configuration-file config) + (match-record config + (allow-empty-passwords? + sessions-directory greeters-directory + remote-sessions-directory xorg-configuration + seats extra-config) + ;; Little trick to allow unquote-splicing of seats + (apply mixed-text-file `("lightdm.conf" " +[LightDM] +greeter-user =3D lightdm +greeters-directory =3D " ,greeters-directory " +sessions-directory =3D " ,sessions-directory " +remote-sessions-directory =3D " ,remote-sessions-directory " + +#Seats + " ,@(if (null? seats) + (lightdm-seat-configuration->list (lightdm-seat-configuration) + xorg-configuration) + (concatenate (map (lambda (seat) + (lightdm-seat-configuration->list seat xorg-c= onfiguration)) + seats))) " +#Extra config +" ,(if (null? extra-config) "" + (string-join extra-config "\n")) +" +")))) + +(define %lightdm-accounts + (list (user-group (name "lightdm") (system? #t)) + (user-account + (name "lightdm") + (group "lightdm") + (system? #t) + (comment "LightDM user") + (home-directory "/var/lib/lightdm") + (shell (file-append shadow "/sbin/nologin"))))) + +(define %lightdm-activation + ;; Ensure /var/lib/lightdm is owned by the "lightdm" user. + ;; Mimics what is done for gdm + ;; see a43e9157ef479e94c19951cc9d228cf153bf78ee + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + + (define (ensure-ownership directory) + (let* ((lightdm (getpwnam "lightdm")) + (uid (passwd:uid lightdm)) + (gid (passwd:gid lightdm)) + (st (stat directory #f))) + ;; Recurse into directory only if it has wrong ownership. + (when (and st + (or (not (=3D uid (stat:uid st))) + (not (=3D gid (stat:gid st))))) + (for-each (lambda (file) + (chown file uid gid)) + (find-files "directory" + #:directories? #t))))) + + (when (not (stat "/var/lib/lightdm-data" #f)) + (mkdir-p "/var/lib/lightdm-data")) + (for-each ensure-ownership + '("/var/lib/lightdm" + "/var/lib/lightdm-data"))))) + +(define (lightdm-pam-service config) + "Return a PAM service for @command{lightdm}." + (unix-pam-service + "lightdm" + #:login-uid? #t + #:allow-empty-passwords? + (lightdm-configuration-allow-empty-passwords? config))) + + +(define (lightdm-greeter-pam-service) + "Return a PAM service for @command{lightdm-greeter}}." + (pam-service + (name "lightdm-greeter") + (auth + (list + ;; Load environment from /etc/environment and ~/.pam_environment + (pam-entry (control "required") (module "pam_env.so")) + ;; Always let the greeter start without authentication + (pam-entry (control "required") (module "pam_permit.so")))) + ;; No action required for account management + (account + (list + (pam-entry (control "required") (module "pam_permit.so")))) + ;; Can't change password + (password + (list + (pam-entry (control "required") (module "pam_deny.so")))) + ;; Setup session + (session + (list + (pam-entry (control "required") (module "pam_unix.so")))))) + + +(define (lightdm-autologin-pam-service) + "Return a PAM service for @command{lightdm-autologin}}." + (pam-service + (name "lightdm-autologin") + (auth + (list + ;; Block login if they are globally disabled + (pam-entry (control "required") (module "pam_nologin.so")) + + (pam-entry (control "required") (module "pam_succeed_if.so") + (arguments (list "uid >=3D 1000"))) + ;; Allow access without authentication + (pam-entry (control "required") (module "pam_permit.so")))) + ;; Stop autologin if account requires action + (account + (list + (pam-entry (control "required") (module "pam_unix.so")))) + ;; Can't change password + (password + (list + (pam-entry (control "required") (module "pam_deny.so")))) + ;; Setup session + (session + (list + (pam-entry (control "required") (module "pam_unix.so")))))) + +(define (lightdm-pam-services config) + (list (lightdm-pam-service config) + (lightdm-greeter-pam-service) + (lightdm-autologin-pam-service))) + +(define (lightdm-shepherd-service config) + "Return a for LightDM with CONFIG." + + (define lightdm-command + #~(list #$(file-append (lightdm-configuration-lightdm config) + "/sbin/lightdm"))) + + (list (shepherd-service + (documentation "LightDM display manager.") + (requirement '(dbus-system user-processes host-name)) + (provision '(display-manager xorg-server)) + (respawn? #f) + (start #~(lambda () + (fork+exec-command + #$lightdm-command + #:environment-variables + (list + (string-append + "PATH=3D/run/current-system/profile/sbin" + ":/run/current-system/profile/bin"))))) + (stop #~(make-kill-destructor))))) + +(define (lightdm-etc-service config) + `(("xdg/lightdm/lightdm.conf.d/lightdm.conf" + ,(lightdm-configuration-file config)))) + +(define (lightdm-profile-service config) + ;; In case no seats are provided, we fall back on a default one + ;; with lightdm-gtk-greeter. Add necessary packages. + (let ((seats (lightdm-configuration-seats config)) + (lightdm (lightdm-configuration-lightdm config))) + (if (null? seats) + (list lightdm lightdm-gtk-greeter) + (list lightdm)))) + +(define lightdm-service-type + ;; (handle-xorg-configuration lightdm-configuration) + (service-type (name 'lightdm) + (extensions + (list + (service-extension shepherd-root-service-type + lightdm-shepherd-service) + (service-extension activation-service-type + (const %lightdm-activation)) + (service-extension pam-root-service-type + lightdm-pam-services) + (service-extension dbus-root-service-type + (compose list + lightdm-configuration-lightd= m)) + (service-extension account-service-type + (const %lightdm-accounts)) + (service-extension etc-service-type + lightdm-etc-service) + (service-extension profile-service-type + lightdm-profile-service))) + ;; LightDM is extended with lists of seats + ;; or with a xorg-configuration by set-xorg-configuration + ;; Deal with both cases. + (compose + (lambda (extensions) + (receive (xorg-configuration-extensions + seats-extensions) + (partition xorg-configuration? extensions) + (list `("xorg-configuration" . + ;; Mimic handle-xorg-configuration + ,(match xorg-configuration-extensions + (() #f) + ((config . _) config))) + `("seats" . ,(concatenate seats-extensions)))))) + (extend (lambda (config extensions) + (lightdm-configuration + (inherit config) + (xorg-configuration + (or (assoc-ref extensions "xorg-configuration") + (lightdm-configuration-xorg-configuration = config))) + (seats (append (assoc-ref extensions "seats") + (lightdm-configuration-seats con= fig)))))) + (default-value (lightdm-configuration)) + (description "Return a service that spawns the + LightDM graphical login manager."))) + +;; GREETERS + +(define-record-type* + lightdm-gtk-greeter-configuration make-lightdm-gtk-greeter-configuration + lightdm-gtk-greeter-configuration? + + (lightdm-gtk-greeter lightdm-gtk-greeter-configuration-lightdm-gtk-greet= er + (default lightdm-gtk-greeter)) + (assets lightdm-gtk-greeter-configuration-assets + (default (list adwaita-icon-theme + gnome-themes-standard))) + (theme-name lightdm-gtk-greeter-configuration-theme-name + (default "Adwaita")) + (icon-theme-name + lightdm-gtk-greeter-configuration-icon-theme-name + (default "Adwaita")) + (cursor-theme-name + lightdm-gtk-greeter-configuration-cursor-theme-name + (default "Adwaita")) + (cursor-theme-size lightdm-gtk-greeter-configuration-cursor-theme-size + (default 16)) + (background lightdm-gtk-greeter-configuration-background + (default (file-append %artwork-repository + "/grub/GuixSD-fully-black-16-9.svg"))) + (a11y-states lightdm-gtk-greeter-a11y-states + (default "contrast; font; keyboard; reader")) + (reader lightdm-gtk-greeter-reader + (default #f)) + (seats lightdm-gtk-greeter-configuration-seats + (default (list (lightdm-seat-configuration)))) + (extra-config lightdm-gtk-greeter-configuration-extra-config + (default '()))) + +(define (lightdm-gtk-greeter-configuration-file config) + (match-record config + (theme-name icon-theme-name cursor-theme-name + cursor-theme-size background a11y-states + reader extra-config) + (mixed-text-file "lightdm-gtk-greeter.conf" " +[greeter] +theme-name =3D " theme-name " +icon-theme-name =3D " icon-theme-name " +cursor-theme-name =3D " cursor-theme-name " +cursor-theme-size =3D " (number->string cursor-theme-size) " +background =3D " background " +a11y-states =3D " a11y-states " +" (if reader (string-append "reader =3D " reader) + "") " +" (if (null? extra-config) "" + (string-join extra-config "\n"))))) + +(define (lightdm-gtk-greeter-lightdm-service config) + ;; Enforce greeter-session field to lightdm-gtk-greeter + (map + (lambda (seat) + (lightdm-seat-configuration + (inherit seat) + (greeter-session "lightdm-gtk-greeter"))) + (lightdm-gtk-greeter-configuration-seats config))) + +(define (lightdm-gtk-greeter-etc-service config) + `(("xdg/lightdm/lightdm-gtk-greeter.conf" + ,(lightdm-gtk-greeter-configuration-file config)))) + +(define (lightdm-gtk-greeter-profile-service config) + (cons (lightdm-gtk-greeter-configuration-lightdm-gtk-greeter config) + (lightdm-gtk-greeter-configuration-assets config))) + +(define lightdm-gtk-greeter-service-type + (service-type (name 'lightdm-gtk-greeter) + (extensions + (list + (service-extension lightdm-service-type + lightdm-gtk-greeter-lightdm-service) + (service-extension etc-service-type + lightdm-gtk-greeter-etc-service) + (service-extension profile-service-type + lightdm-gtk-greeter-profile-service))) + (default-value (lightdm-gtk-greeter-configuration)) + (description + "Set-up lightdm-gtk-greeter as well +as its configuration file and extends LightDM with its seats."))) --=20 2.26.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0010-gnu-lightdm-gtk-greeter-Set-XCURSOR_PATH-in-wrapper.patch >From bbdb165bd0a0d91b0ef961fec81060a0f376c25f Mon Sep 17 00:00:00 2001 From: L p R n d n Date: Fri, 17 Apr 2020 11:53:51 +0200 Subject: [PATCH 10/10] gnu: lightdm-gtk-greeter: Set XCURSOR_PATH in wrapper. * gnu/packages/display-managers.scm (lightdm-gtk-greeter)[arguments]: Modify wrap-program phase to add XCURSOR_PATH. --- gnu/packages/display-managers.scm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gnu/packages/display-managers.scm b/gnu/packages/display-managers.scm index 0a9ae8ee61..43ca05bee4 100644 --- a/gnu/packages/display-managers.scm +++ b/gnu/packages/display-managers.scm @@ -232,11 +232,12 @@ display manager which supports different greeters.") "/sbin/lightdm-gtk-greeter") `("XDG_DATA_DIRS" ":" prefix ,(cons "/run/current-system/profile/share" - (map (lambda (pkg) - (string-append (assoc-ref inputs pkg) "/share")) - '("gtk+" "shared-mime-info" "glib")))) + (map (lambda (pkg) + (string-append (assoc-ref inputs pkg) "/share")) + '("gtk+" "shared-mime-info" "glib")))) `("GTK_PATH" ":" prefix (,(assoc-ref inputs "gtk+"))) - `("GIO_EXTRA_MODULES" ":" prefix (,(assoc-ref inputs "gtk+")))) + `("GIO_EXTRA_MODULES" ":" prefix (,(assoc-ref inputs "gtk+"))) + `("XCURSOR_PATH" ":" prefix ("/run/current-system/profile/share/icons"))) #t))))) (synopsis "GTK+ greeter for LightDM") (home-page "https://launchpad.net/lightdm-gtk-greeter") -- 2.26.1 --=-=-=--