From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:44454) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jEtlS-0001Qs-SJ for guix-patches@gnu.org; Thu, 19 Mar 2020 07:55:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jEtlO-0002bC-G0 for guix-patches@gnu.org; Thu, 19 Mar 2020 07:55:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35901) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jEtlN-0002aN-QU for guix-patches@gnu.org; Thu, 19 Mar 2020 07:55:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jEtlN-0003mM-Nt for guix-patches@gnu.org; Thu, 19 Mar 2020 07:55:01 -0400 Subject: [bug#35305] LightDM service Resent-Message-ID: From: L p R n d n References: <87zhooso9g.fsf@lprndn.info> <878srf9ava.fsf@lprndn.info> <878sk1e19s.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> Date: Thu, 19 Mar 2020 12:54:30 +0100 In-Reply-To: <878sk1e19s.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> ("=?UTF-8?Q?Nicol=C3=B2?= Balzarotti"'s message of "Sun, 15 Mar 2020 22:50:07 +0100") Message-ID: <874kukh85l.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 reworked patches. I tested it quickly in a vm with xfce and gnome (login, logout, switch user) and it seems ok. I also attach a little scm file with a simple system definition with lightdm and xfce for those willing to test it. (also the password is "q" without quotes). Have a nice day, L p R n d n --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-gnu-lightdm-Update-1.30.0.patch >From 461b4c27816d4340a37209ca5389d7ec9f373581 Mon Sep 17 00:00:00 2001 From: Lprndn 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 bfe1a8f6dd..2f81f10140 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.25.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-gnu-lightdm-Add-vala-bindings.patch >From a2d8e9027e12dabb0acebd3c32aff555727c4129 Mon Sep 17 00:00:00 2001 From: Lprndn 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 2f81f10140..1f4842bff3 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.25.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0003-gnu-lightdm-Disable-python-tests-only.patch >From 356da33c8cf358757fdf39393d6edde1b702b408 Mon Sep 17 00:00:00 2001 From: Lprndn 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 | 30 +++++--------- .../lightdm-disable-python-tests.patch | 40 +++++++++++++++++++ 3 files changed, 50 insertions(+), 21 deletions(-) create mode 100644 gnu/packages/patches/lightdm-disable-python-tests.patch diff --git a/gnu/local.mk b/gnu/local.mk index caa73d44d4..fc9030b7f9 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1144,6 +1144,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-pam-no-setfsuid.patch \ %D%/packages/patches/lirc-localstatedir.patch \ diff --git a/gnu/packages/display-managers.scm b/gnu/packages/display-managers.scm index 1f4842bff3..56725f8302 100644 --- a/gnu/packages/display-managers.scm +++ b/gnu/packages/display-managers.scm @@ -127,13 +127,14 @@ create smooth, animated user interfaces.") (name "lightdm") (version "1.30.0") (source (origin - (method url-fetch) - (uri (string-append - "https://github.com/CanonicalLtd/lightdm/releases/download/" - version "/lightdm-" version ".tar.xz")) - (sha256 - (base32 - "158zb2d0v1309a8v19hh32y4yj3v6yg4yg6m0l7v59d3a2b7f651")))) + (method url-fetch) + (uri (string-append + "https://github.com/CanonicalLtd/lightdm/releases/download/" + version "/lightdm-" version ".tar.xz")) + (sha256 + (base32 + "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.25.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0004-gnu-lightdm-gtk-greeter-Update-to-2.0.7.patch >From b7026a6b9cfb43ae3f7a2105b1681cc73281854d Mon Sep 17 00:00:00 2001 From: Lprndn Date: Tue, 16 Apr 2019 13:40:38 +0200 Subject: [PATCH 04/10] gnu: lightdm-gtk-greeter: Update to 2.0.7. * gnu/packages/display-manager.scm (lightdm-gtk-greeter): Update to 2.0.7. --- gnu/packages/display-managers.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnu/packages/display-managers.scm b/gnu/packages/display-managers.scm index 56725f8302..9e02eaed33 100644 --- a/gnu/packages/display-managers.scm +++ b/gnu/packages/display-managers.scm @@ -187,7 +187,7 @@ display manager which supports different greeters.") (define-public lightdm-gtk-greeter (package (name "lightdm-gtk-greeter") - (version "2.0.2") + (version "2.0.7") (source (origin (method url-fetch) (uri (string-append @@ -196,7 +196,7 @@ display manager which supports different greeters.") "/+download/lightdm-gtk-greeter-" version ".tar.gz")) (sha256 (base32 - "1436sdm83xqhxyr1rzqxhsl8if2xmidlvb341xcv6dv83lyxkrlf")))) + "1g7wc3d3vqfa7mrdhx1w9ywydgjbffla6rbrxq9k3sc62br97qms")))) (build-system gnu-build-system) (native-inputs `(("exo" ,exo) -- 2.25.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0005-gnu-lightdm-gtk-greeter-Fix-at-spi-runtime-dependenc.patch >From 172167821db646e82c1fceef5dced9f2dcf49fd8 Mon Sep 17 00:00:00 2001 From: Lprndn Date: Tue, 16 Apr 2019 13:50:58 +0200 Subject: [PATCH 05/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 9e02eaed33..29f91ad1fc 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.25.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0006-gnu-lightdm-gtk-greeter-Fix-.desktop-file.patch >From 5e77afbfeb70892c7065927ac3223941679e5f59 Mon Sep 17 00:00:00 2001 From: Lprndn Date: Tue, 16 Apr 2019 13:58:26 +0200 Subject: [PATCH 06/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 29f91ad1fc..ec0f685063 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.25.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0007-gnu-lightdm-gtk-greeter-Wrap-binary.patch >From 11ab812bca3d9c2a1a53355d4ea2710861377275 Mon Sep 17 00:00:00 2001 From: Lprndn Date: Tue, 16 Apr 2019 14:17:18 +0200 Subject: [PATCH 07/10] gnu: lightdm-gtk-greeter: Wrap binary. * gnu/package/display-managers.scm (lightdm-gtk-greeter): Wrap binary. [inputs]: Add hicolor-icon-theme. [arguments]: Add wrap-program phase. --- gnu/packages/display-managers.scm | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/gnu/packages/display-managers.scm b/gnu/packages/display-managers.scm index ec0f685063..4c2391951b 100644 --- a/gnu/packages/display-managers.scm +++ b/gnu/packages/display-managers.scm @@ -205,6 +205,7 @@ display manager which supports different greeters.") (inputs `(("lightdm" ,lightdm) ("at-spi2-core" ,at-spi2-core) + ("hicolor-icon-theme" ,hicolor-icon-theme) ("gtk+" ,gtk+))) (arguments `(#:configure-flags @@ -220,7 +221,27 @@ 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 + (lambda* (#:key outputs inputs #:allow-other-keys) + (wrap-program (string-append (assoc-ref outputs "out") + "/sbin/lightdm-gtk-greeter") + `("XDG_DATA_DIRS" ":" prefix (,(string-append (assoc-ref inputs "hicolor-icon-theme") + "/share") + ,(string-append (assoc-ref inputs "glib") + "/share") + ,(string-append (assoc-ref inputs "shared-mime-info") + "/share") + ,(string-append (assoc-ref inputs "gtk+") + "/share") + ,(string-append (assoc-ref inputs "exo") + "/share") + ,(string-append (assoc-ref outputs "out") + "/share") + "/run/current-system/profile/share")) + `("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.25.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0008-gnu-lightdm-Build-accountsservice-files.patch >From d83b7241279cf8d672241cb28bd7f719619e6a61 Mon Sep 17 00:00:00 2001 From: Lprndn Date: Tue, 16 Apr 2019 19:46:44 +0200 Subject: [PATCH 08/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 4c2391951b..50a43c125f 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.25.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0009-gnu-lightdm-gtk-greeter-Fix-some-warnings.patch >From 1d3f159d3b3205c118325266f1867f439d0d9a46 Mon Sep 17 00:00:00 2001 From: Lprndn Date: Wed, 17 Apr 2019 12:44:07 +0200 Subject: [PATCH 09/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 50a43c125f..62387b14a5 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.25.1 --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0010-services-Add-lightdm-service-type.patch Content-Transfer-Encoding: quoted-printable >From 66fadb0425815c9802f06ff96f99349687313cd0 Mon Sep 17 00:00:00 2001 From: Lprndn Date: Thu, 18 Apr 2019 17:58:56 +0200 Subject: [PATCH 10/10] services: Add lightdm-service-type. * gnu/services/lightdm.scm: Add file. * doc/guix.texi (@deftp, @deffn): Add documentation. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. --- doc/guix.texi | 81 ++++++++++++ gnu/local.mk | 1 + gnu/services/lightdm.scm | 272 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 354 insertions(+) create mode 100644 gnu/services/lightdm.scm diff --git a/doc/guix.texi b/doc/guix.texi index a0920adc1c..d66cba28d1 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -14664,6 +14664,87 @@ 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 of both lightdm +and lightdm-gtk-greeter or even using a different greeter. +@end defvr + +@deftp {Data Type} lightdm-configuration +Data type representing the lightDM service configuration. + +@table @asis +@item @code{session-directory} (default:"/run/current-system/profile/share= /xsessions:/run/current-system/profile/share/wayland-sessions") +Directories where LightDM will search for sessions' @code{.desktop} files. + +@item @code{allow-empty-passwords?} (default: @code{#f}) +Whether to allow logins with empty passwords. + +@item @code{greeter-name} (default: "lightdm-gtk-greeter") +The name of the default greeter to be used by LightDM. + +@item @code{greeter-package} (default: @code{lightdm-gtk-greeter}) +The package containing the greeter described by @code{greeter-name} +and that will be included in the system's profile. + +@item @code{greeter-assets} (default: @code{(list adwaita-icon-theme gnome= -themes-standard)}) +A list of packages needed by the greeter: icons, themes, fonts etc. + +@item @code{greeter-configuration-file} (default: (lightdm-gtk-greeter-con= figuration-file (lightdm-gtk-greeter-configuration))) +The file that will be place in @code{/etc/xdg/lightdm/} directory. +A @code{computed-file} is expected. + +@item @code{xorg-configuration} (default: @code{(xorg-configuration)}) +Configuration of the Xorg graphical server. + +@item @code{session-wrapper} (default: @code{(xinitrc)}) +The command to run for a session. It is run as the user and needs +to exec the command passed in the arguments to complete running the sessio= n. + +@item @code{default-session-name} (default: @code{#f}) +The name of the default @code{.desktop} file describing as session. +If @code {autologin-user} and @code{autologin-timeout} are defined, +LightDM logs in directly using the session described by @code{default-sess= ion-name}. + +@item @code{autologin-user} (default: @code{#f}) +If @code {default-session-name} and @code{autologin-timeout} are defined, +LightDM logs in directly as @code{autologin-user}. + +@item @code{autologin-timeout} (default: @code{#f}) +If @code {default-session-name} and @code{autologin-user} are defined, +LightDM logs in automatically after @code{autologin-timeout} seconds. +Any user activity during that time will cancel autologin +and allow usual login through authentification. + +@item @code{lightdm} (default: @code{lightdm}) +The LightDM package to use. + +@end table +@end deftp + +@deftp {Data Type} lightdm-gtk-greeter-configuration +This data type represents the configuration for ligtdm-gtk-greeter. + +@table @asis +@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: "") +Path to the background image to be used. + +@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 fc9030b7f9..5ab96c121e 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -561,6 +561,7 @@ GNU_SYSTEM_MODULES =3D \ %D%/services/getmail.scm \ %D%/services/guix.scm \ %D%/services/kerberos.scm \ + %D%/services/lightdm.scm \ %D%/services/lirc.scm \ %D%/services/virtualization.scm \ %D%/services/mail.scm \ diff --git a/gnu/services/lightdm.scm b/gnu/services/lightdm.scm new file mode 100644 index 0000000000..d0d6c20c2f --- /dev/null +++ b/gnu/services/lightdm.scm @@ -0,0 +1,272 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2019 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 (guix gexp) + #:use-module (guix records) + + #: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-configuration + lightdm-configuration? + lightdm-service-type + lightdm-gtk-greeter-configuration + lightdm-gtk-greeter-configuration-file)) + + +(define-record-type* + lightdm-gtk-greeter-configuration make-lightdm-gtk-greeter-configuration + lightdm-gtk-greeter-configuration? + (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-size lightdm-gtk-greeter-configuration-cursor-size + (default 16)) + (background lightdm-gtk-greeter-configuration-background + (default ""))) + +(define (lightdm-gtk-greeter-configuration-file config) + (mixed-text-file "lightdm-gtk-greeter.conf" " +[greeter] +theme-name =3D " (lightdm-gtk-greeter-configuration-theme-name conf= ig) " +icon-theme-name =3D " (lightdm-gtk-greeter-configuration-icon-theme-name= config) " +cursor-theme-name =3D " (lightdm-gtk-greeter-configuration-cursor-theme-na= me config) " +cursor-theme-size =3D " (number->string + (lightdm-gtk-greeter-configuration-cursor-size conf= ig)) " +background =3D " (lightdm-gtk-greeter-configuration-background conf= ig))) + +(define-record-type* + lightdm-configuration make-lightdm-configuration + lightdm-configuration? + + (lightdm lightdm-configuration-lightdm + (default lightdm)) + (sessions-directory lightdm-configuration-sessions-directory + (default (string-append + "/run/current-system/profile/share/xsessio= ns" + ":/run/current-system/profile/share/waylan= d-sessions"))) + (allow-empty-passwords? lightdm-configuration-allow-empty-passwords? + (default #f)) + ;; [Seat] + (xorg-configuration lightdm-configuration-xorg + (default (xorg-configuration))) + (session-wrapper lightdm-configuration-session-wrapper + (default (xinitrc))) + (default-session-name lightdm-configuration-default-session + (default "")) + + ;; [Autologin] + (autologin-user lightdm-configuration-autologin-user + (default #f)) + (autologin-timeout lightdm-configuration-autologin-timeout + (default #f)) + ;; [Greeter] + (greeter-name lightdm-configuration-greeter-name + (default "lightdm-gtk-greeter")) + (greeter-package lightdm-configuration-greeter-package + (default lightdm-gtk-greeter)) + (greeter-assets lightdm-configuration-greeter-assets + (default (list adwaita-icon-theme + gnome-themes-standard))) + (greeter-configuration-file lightdm-configuration-greeter-configuration + (default (lightdm-gtk-greeter-configuration-= file + (lightdm-gtk-greeter-configuration= ))))) + +(define %lightdm-accounts + (list (user-group (name "lightdm") (system? #t)) + (user-account + (name "lightdm") + (group "lightdm") + (system? #t) + (comment "LighDM user") + (home-directory "/var/lib/lightdm") + (shell (file-append shadow "/sbin/nologin"))))) + + +(define (lightdm-configuration-file config) + (mixed-text-file "lightdm.conf" " +[LightDM] +greeter-user =3D lightdm +greeters-directory =3D /run/current-system/profile/share/xgreeters +sessions-directory =3D " (lightdm-configuration-sessions-directory config= ) " + + +[Seat:*] +xserver-command =3D " (xorg-start-command (lightdm-configuration-xorg con= fig)) " +greeter-session =3D " (lightdm-configuration-greeter-name config) " +user-session =3D " (lightdm-configuration-default-session config) +(if (lightdm-configuration-autologin-user config) (string-append " +autologin-user =3D " (lightdm-configuration-autologin-user config)) "") +(if (string-null? (lightdm-configuration-default-session config)) "" + (string-append " +autologin-session =3D " (lightdm-configuration-default-session config))) +(if (lightdm-configuration-autologin-timeout config) (string-append " +autologin-user-timeout =3D " (lightdm-configuration-autologin-timeout conf= ig)) "") " +session-wrapper =3D " (lightdm-configuration-session-wrapper config))) + + +(define (lightdm-pam-service config) + "Return a PAM service for @command{lightdm}." + (unix-pam-service + "lightdm" + #: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")) + (pam-entry (control "required") (module "pam_env.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")) + ;; Load environment from /etc/environment and ~/.pam_environment + (pam-entry (control "required") (module "pam_env.so")) + ;; 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-shepherd-service config) + "Return a for LightDM with CONFIG." + + (define lightdm-command + #~(list (string-append #$(lightdm-configuration-lightdm config) "/sbin= /lightdm"))) + + (list (shepherd-service + (documentation "LightDM display manager.") + (requirement '(dbus-system user-processes host-name)) + (provision '(display-manager)) + (respawn? #f) + (start #~(lambda () + (fork+exec-command + (list #$(file-append + (lightdm-configuration-lightdm config) + "/sbin/lightdm")) + #: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) + (list `("xdg/lightdm/lightdm.conf.d/lightdm.conf" + ,(lightdm-configuration-file config)) + `(,(string-append "xdg/lightdm/" + (computed-file-name + (lightdm-configuration-greeter-configuration co= nfig))) + ,(lightdm-configuration-greeter-configuration config)))) + +(define (lightdm-pam-services config) + (list (lightdm-pam-service config) + (lightdm-greeter-pam-service) + (lightdm-autologin-pam-service))) + +(define (lightdm-profile-service config) + (append (list lightdm + (lightdm-configuration-greeter-package config)) + (lightdm-configuration-greeter-assets config))) + +(define (lightdm-activation-service config) + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (define %user + (getpw "lightdm")) + (let ((directory "/var/lib/lightdm-data")) + (mkdir-p directory) + (chown directory (passwd:uid %user) (passwd:gid %user)))))) + +(define lightdm-service-type + (service-type (name 'lightdm) + (extensions + (list + (service-extension shepherd-root-service-type + lightdm-shepherd-service) + (service-extension activation-service-type + lightdm-activation-service) + (service-extension pam-root-service-type + lightdm-pam-services) + (service-extension etc-service-type + lightdm-etc-service) + (service-extension dbus-root-service-type + (compose list lightdm-configuration-l= ightdm)) + (service-extension account-service-type + (const %lightdm-accounts)) + (service-extension profile-service-type + lightdm-profile-service))) + (default-value (lightdm-configuration)) + (description "Return a service that spawns the LightDM gra= phical login + manager."))) --=20 2.25.1 --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=lightdm-desktop-test.scm ;; This is an operating system configuration template ;; for a "desktop" setup without full-blown desktop ;; environments. (use-modules (gnu) (gnu system nss) (srfi srfi-1)) (use-service-modules desktop lightdm xorg) (use-package-modules bootloaders certs) (operating-system (host-name "antelope") (timezone "Europe/Paris") (locale "en_US.utf8") ;; Use the UEFI variant of GRUB with the EFI System ;; Partition mounted on /boot/efi. (bootloader (bootloader-configuration (bootloader grub-efi-bootloader) (target "/boot/efi"))) ;; Assume the target root file system is labelled "my-root", ;; and the EFI System Partition has UUID 1234-ABCD. (file-systems (append (list (file-system (device (file-system-label "my-root")) (mount-point "/") (type "ext4")) (file-system (device (uuid "1234-ABCD" 'fat)) (mount-point "/boot/efi") (type "vfat"))) %base-file-systems)) (users (cons (user-account (name "alice") (comment "Bob's sister") ;; Password is "q" (without quotes) (password "a2l/LaE8AKHIY") (group "users") (supplementary-groups '("wheel" "netdev" "audio" "video"))) %base-user-accounts)) ;; Add a bunch of window managers; we can choose one at ;; the log-in screen with F1. (packages (append (list ;; for HTTPS access nss-certs) %base-packages)) ;; Use the "desktop" services, which include the X11 ;; log-in service, networking with NetworkManager, and more. (services (cons* (service lightdm-service-type) (service xfce-desktop-service-type) (modify-services (remove (lambda (service) (eq? (service-kind service) gdm-service-type)) %desktop-services)))) ;; Allow resolution of '.local' host names with mDNS. (name-service-switch %mdns-host-lookup-nss)) --=-=-=--