all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#35305] [WIP] LightDM service
@ 2019-04-17 14:24 L p R n d n
  2019-04-18 11:20 ` Jonathan Brielmaier
                   ` (5 more replies)
  0 siblings, 6 replies; 30+ messages in thread
From: L p R n d n @ 2019-04-17 14:24 UTC (permalink / raw)
  To: 35305

[-- Attachment #1: Type: text/plain, Size: 1006 bytes --]

Hello,

Wanted to work on Guix's website but fate led me to try my way on a
lightdm service...
So, here is what I got for now.
It fails to start a window manager but I don't think I'll be able to
debug the last mile with my sole knowledge.

Beside that, here is a list of possible improvements before merging:

* lightdm-greeter-gtk configuration is a part of lightdm's service.
It might be a good idea to give it its own service but it would
mean we need to write a service for each lightdm greeter.

* lightdm complains about the lack of
  org.freedesktop.DisplayManager.AccountsService interface.
  The lightdm package provides the relevent files but it seems
  accountsservice doesn't find them. I think it searches them in
  $XDG_DATA_DIRS/accountservices . See
  https://github.com/NixOS/nixpkgs/issues/45059

* lightdm-gtk-greeter's wrapper is handmade and ugly.

* General refining.

A thorough review would also be welcome as I'm not really sure I know
what I'm doing.

Thanks!

L  p R n  d n   


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-lightdm-Update-1.28.0.patch --]
[-- Type: text/x-patch, Size: 1547 bytes --]

From 826ca620f71f5b219f1402fe4ea582de621b061a Mon Sep 17 00:00:00 2001
From: Lprndn <lprndn@gmail.com>
Date: Tue, 16 Apr 2019 13:16:39 +0200
Subject: [PATCH 01/10] gnu: lightdm: Update 1.28.0.

* gnu/packages/display-managers.scm (lightdm): Update to 1.28.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 afe5cc2b7b..243baebb3d 100644
--- a/gnu/packages/display-managers.scm
+++ b/gnu/packages/display-managers.scm
@@ -208,16 +208,15 @@ create smooth, animated user interfaces.")
 (define-public lightdm
   (package
     (name "lightdm")
-    (version "1.24.0")
+    (version "1.28.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"))))
+                "01zsxim662n2w66j46rv291w9aqmwvlwccyzl9vhpybwinfmj3zj"))))
     (build-system gnu-build-system)
     (arguments
      '(#:parallel-tests? #f ; fails when run in parallel
-- 
2.21.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnu-lightdm-Add-vala-bindings.patch --]
[-- Type: text/x-patch, Size: 851 bytes --]

From c2ead5265c209315fa57cb07b84ead557e191175 Mon Sep 17 00:00:00 2001
From: Lprndn <lprndn@gmail.com>
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 243baebb3d..d1eb3f146e 100644
--- a/gnu/packages/display-managers.scm
+++ b/gnu/packages/display-managers.scm
@@ -263,6 +263,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.21.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-gnu-lightdm-Re-enable-all-tests.patch --]
[-- Type: text/x-patch, Size: 1132 bytes --]

From 6e0bf56cd21964c868b6eaf2867dfbd412c4d279 Mon Sep 17 00:00:00 2001
From: Lprndn <lprndn@gmail.com>
Date: Tue, 16 Apr 2019 13:26:22 +0200
Subject: [PATCH 03/10] gnu: lightdm: Re-enable all tests.

* gnu/packages/display-managers.scm (lightdm)[arguments]: Remove disable-broken-phase.
---
 gnu/packages/display-managers.scm | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/gnu/packages/display-managers.scm b/gnu/packages/display-managers.scm
index d1eb3f146e..7f5678f459 100644
--- a/gnu/packages/display-managers.scm
+++ b/gnu/packages/display-managers.scm
@@ -235,12 +235,6 @@ 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)
-- 
2.21.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-gnu-lightdm-gtk-greeter-Update-to-2.0.6.patch --]
[-- Type: text/x-patch, Size: 1308 bytes --]

From c31f542d6c551ef2b7bef4d576ff7c2ad1e4a01a Mon Sep 17 00:00:00 2001
From: Lprndn <lprndn@gmail.com>
Date: Tue, 16 Apr 2019 13:40:38 +0200
Subject: [PATCH 04/10] gnu: lightdm-gtk-greeter: Update to 2.0.6.

* gnu/packages/display-manager.scm (lightdm-gtk-greeter): Update to 2.0.6.
---
 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 7f5678f459..be365df6a2 100644
--- a/gnu/packages/display-managers.scm
+++ b/gnu/packages/display-managers.scm
@@ -276,7 +276,7 @@ display manager which supports different greeters.")
 (define-public lightdm-gtk-greeter
   (package
     (name "lightdm-gtk-greeter")
-    (version "2.0.2")
+    (version "2.0.6")
     (source (origin
               (method url-fetch)
               (uri (string-append
@@ -285,7 +285,7 @@ display manager which supports different greeters.")
                     "/+download/lightdm-gtk-greeter-" version ".tar.gz"))
               (sha256
                (base32
-                "1436sdm83xqhxyr1rzqxhsl8if2xmidlvb341xcv6dv83lyxkrlf"))))
+                "1pis5qyg95pg31dvnfqq34bzgj00hg4vs547r8h60lxjk81z8p15"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("exo" ,exo)
-- 
2.21.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-gnu-lightdm-gtk-greeter-Fix-at-spi-runtime-dependenc.patch --]
[-- Type: text/x-patch, Size: 1353 bytes --]

From 8b4354bd30dc44c47509f0bc0da9fe95e6b4db8d Mon Sep 17 00:00:00 2001
From: Lprndn <lprndn@gmail.com>
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 | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gnu/packages/display-managers.scm b/gnu/packages/display-managers.scm
index be365df6a2..352ad19efa 100644
--- a/gnu/packages/display-managers.scm
+++ b/gnu/packages/display-managers.scm
@@ -293,7 +293,14 @@ 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 "--localstatedir=/var"
+             (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.21.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0006-gnu-lightdm-gtk-greeter-Fix-.desktop-file.patch --]
[-- Type: text/x-patch, Size: 1693 bytes --]

From ef95fd1a611d24cb5a2f77f758a0495ab231a444 Mon Sep 17 00:00:00 2001
From: Lprndn <lprndn@gmail.com>
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 352ad19efa..4d22d28f02 100644
--- a/gnu/packages/display-managers.scm
+++ b/gnu/packages/display-managers.scm
@@ -300,7 +300,17 @@ display manager which supports different greeters.")
        (list "--localstatedir=/var"
              (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.21.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #8: 0007-gnu-lightdm-gtk-greeter-Wrap-binary.patch --]
[-- Type: text/x-patch, Size: 2958 bytes --]

From 8ed5177d5a188f8722e4cfdede4967b3e73968f8 Mon Sep 17 00:00:00 2001
From: Lprndn <lprndn@gmail.com>
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 4d22d28f02..de2b45d4d6 100644
--- a/gnu/packages/display-managers.scm
+++ b/gnu/packages/display-managers.scm
@@ -294,6 +294,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
@@ -310,7 +311,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.21.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #9: 0008-gnu-lightdm-Build-accountsservice-files.patch --]
[-- Type: text/x-patch, Size: 997 bytes --]

From 56c962ccc54f3c7f83ea288c9ac26524af19b5a0 Mon Sep 17 00:00:00 2001
From: Lprndn <lprndn@gmail.com>
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 de2b45d4d6..a829e74604 100644
--- a/gnu/packages/display-managers.scm
+++ b/gnu/packages/display-managers.scm
@@ -253,7 +253,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.21.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #10: 0009-gnu-lightdm-gtk-greeter-Fix-some-warnings.patch --]
[-- Type: text/x-patch, Size: 1043 bytes --]

From 0d2fa80019cd9d95a0008576fc768fac8ac49c6c Mon Sep 17 00:00:00 2001
From: Lprndn <lprndn@gmail.com>
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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/packages/display-managers.scm b/gnu/packages/display-managers.scm
index a829e74604..67d6d9e5c6 100644
--- a/gnu/packages/display-managers.scm
+++ b/gnu/packages/display-managers.scm
@@ -300,6 +300,7 @@ display manager which supports different greeters.")
     (arguments
      `(#:configure-flags
        (list "--localstatedir=/var"
+             "--disable-indicator-services-command"
              (string-append "--enable-at-spi-command="
                             (assoc-ref %build-inputs "at-spi2-core")
                             "/libexec/at-spi-bus-launcher"))
-- 
2.21.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #11: 0010-services-Add-lightDM-service.patch --]
[-- Type: text/x-patch, Size: 11354 bytes --]

From 3106b950f70aba2851091731bff4030087c6eca4 Mon Sep 17 00:00:00 2001
From: L  p R n  d n <guix@lprndn.info>
Date: Wed, 17 Apr 2019 15:47:52 +0200
Subject: [PATCH 10/10] services: Add lightDM service.

* gnu/services/lightdm.scm: New file.
---
 gnu/services/lightdm.scm | 259 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 259 insertions(+)
 create mode 100644 gnu/services/lightdm.scm

diff --git a/gnu/services/lightdm.scm b/gnu/services/lightdm.scm
new file mode 100644
index 0000000000..b280df49ae
--- /dev/null
+++ b/gnu/services/lightdm.scm
@@ -0,0 +1,259 @@
+(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))
+
+(define (lightdm-pam-service)
+  "Return a PAM service for @command{lightdm}."
+  (unix-pam-service
+   "lightdm"
+   #:allow-empty-passwords? #t)
+  ;; (pam-service
+  ;; (name "lightdm")
+  ;; (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"))
+  ;; Use /etc/passwd and /etc/shadow for passwords
+  ;; (pam-entry (control "required") (module "pam_unix.so"))
+  ;; https://wiki.gentoo.org/wiki/LightDM#Unlock_GNOME_Keyring
+  ;; (pam-entry (control "optional") (module "pam_gnome_keyring.so"))
+  ;; ))
+  ;; Check account is active, change password if required
+  ;; (account
+  ;; (list
+  ;; (pam-entry (control "required") (module "pam_unix.so"))))
+  ;; Allow password to be changed
+  ;; (password
+  ;; (list
+  ;; (pam-entry (control "required") (module "pam_unix.so"))))
+  ;; Setup session
+  ;; (session
+  ;; (list
+  ;; (pam-entry (control "required") (module "pam_unix.so"))
+  ;; https://wiki.gentoo.org/wiki/LightDM#Unlock_GNOME_Keyring
+  ;; (pam-entry (control "optional") (module "pam_gnome_keyring.so")
+  ;; (arguments (list "auto_start")))
+  ;; )))
+  )
+
+(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-record-type* <lightdm-configuration>
+  lightdm-configuration make-lightdm-configuration
+  lightdm-configuration?
+
+  (lightdm lightdm-configuration-lightdm
+           (default lightdm))
+  (user lightdm-configuration-user
+        (default "lightdm"))
+  (greeters-directory lightdm-configuration-greeters-directory
+                      (default "/run/current-system/profile/share/xgreeters"))
+  (sessions-directory lightdm-configuration-sessions-directory
+                      (default (string-append
+                                "/run/current-system/profile/share/xsessions"
+                                ":/run/current-system/profile/share/wayland-sessions")))
+
+  ;; Seat configuration
+  (greeter-session lightdm-configuration-greeter-session
+                   (default "lightdm-gtk-greeter"))
+  (xserver-command lightdm-configuration-xserver-command
+                   (default (xorg-start-command)))
+  (pam-service lightdm-configuration-pam-service
+               (default (lightdm-pam-service)))
+  (pam-autologin-service lightdm-configuration-autologin-pam-service
+                         (default (lightdm-autologin-pam-service)))
+  (pam-greeter-service lightdm-configuration-greeter-pam-service
+                       (default (lightdm-greeter-pam-service)))
+  (autologin-user lightdm-configuration-autologin-user
+                  (default ""))
+  (default-session-name lightdm-configuration-default-session
+    (default ""))
+  (autologin-timeout lightdm-configuration-autologin-timeout
+                     (default ""))
+  ;; lightdm-gtk-greeter specifics
+  ;; Maybe it should have its own service
+  (gtk-greeter-theming-packages lightdm-configuration-gtk-greeter-theming-packages
+                                (default (list adwaita-icon-theme)))
+  (gtk-greeter-theme-name lightdm-configuration-gtk-greeter-theme-name
+                          (default ""))
+  (gtk-greeter-icon-theme-name
+   lightdm-configuration-gtk-greeter-icon-theme-name
+   (default "Adwaita"))
+  (gtk-greeter-cursor-theme-name
+   lightdm-configuration-gtk-greeter-cursor-theme-name
+   (default "Adwaita"))
+  (gtk-greeter-cursor-size lightdm-configuration-gtk-greeter-cursor-size
+                           (default 16))
+  (gtk-greeter-background lightdm-configuration-gtk-greeter-background
+                          (default "")))
+
+(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 = "          (lightdm-configuration-user config) "
+greeters-directory = "    (lightdm-configuration-greeters-directory config) "
+sessions-directory = "    (lightdm-configuration-sessions-directory config) "
+
+
+[Seat:*]
+xserver-command = "       (lightdm-configuration-xserver-command config) "
+greeter-session = "       (lightdm-configuration-greeter-session config) "
+user-session = "          (lightdm-configuration-default-session config) "
+autologin-user = "        (lightdm-configuration-autologin-user config) "
+autologin-session = "     (lightdm-configuration-default-session config) "
+autologin-user-timeout = " (lightdm-configuration-autologin-timeout config)))
+
+(define (lightdm-gtk-greeter-configuration-file config)
+  (mixed-text-file "lightdm-gtk-greeter.conf" "
+[greeter]
+theme-name = "        (lightdm-configuration-gtk-greeter-theme-name config) "
+icon-theme-name = "   (lightdm-configuration-gtk-greeter-icon-theme-name config) "
+cursor-theme-name = " (lightdm-configuration-gtk-greeter-cursor-theme-name config) "
+cursor-theme-size = " (number->string (lightdm-configuration-gtk-greeter-cursor-size config)) "
+background = "        (lightdm-configuration-gtk-greeter-background config)))
+
+(define (lightdm-shepherd-service config)
+  "Return a <lightdm-service> 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=/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))
+        `("xdg/lightdm/lightdm-gtk-greeter.conf"
+          ,(lightdm-gtk-greeter-configuration-file config))))
+
+(define (lightdm-pam-services config)
+  (list (lightdm-configuration-pam-service config)
+        (lightdm-configuration-greeter-pam-service config)
+        (lightdm-configuration-autologin-pam-service config)))
+
+(define (lightdm-profile-service config)
+  (append (list lightdm-gtk-greeter lightdm)
+          (lightdm-configuration-gtk-greeter-theming-packages config)))
+
+(define (lightdm-activation-service config)
+  (with-imported-modules '((guix build utils))
+    #~(begin
+        (use-modules (guix build utils))
+        (define %user
+          (getpw #$(lightdm-configuration-user config)))
+        (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-lightdm))
+                  (service-extension account-service-type
+                                     (const %lightdm-accounts))
+                  (service-extension profile-service-type
+                                     lightdm-profile-service)))
+                (default-value (lightdm-configuration))))
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2022-08-31  7:16 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-17 14:24 [bug#35305] [WIP] LightDM service L p R n d n
2019-04-18 11:20 ` Jonathan Brielmaier
     [not found] ` <handler.35305.B.155550391014002.ack@debbugs.gnu.org>
2019-04-18 13:20   ` [bug#35305] Acknowledgement ([WIP] LightDM service) L p R n d n
2019-04-18 16:03     ` L p R n d n
2019-08-26 15:58   ` L p R n d n
2020-03-15 21:50     ` Nicolò Balzarotti
2020-03-16  7:34       ` Efraim Flashner
2020-03-16  8:36         ` L p R n d n
2020-03-19 11:54       ` [bug#35305] LightDM service L p R n d n
2019-05-23 11:04 ` [bug#35305] [PATCH] " L p R n d n
2020-04-07 17:06 ` [bug#35305] " Brice Waegeneire
2020-04-09 16:02   ` L p R n d n
2020-04-12  9:53     ` Brice Waegeneire
2020-04-14  9:38       ` L p R n d n
2020-04-14 13:17         ` L p R n d n
2020-04-22 15:26       ` L p R n d n
2020-05-06 14:05 ` L p R n d n
2020-05-08 22:18   ` Ricardo Wurmus
2020-05-09 15:09     ` L p R n d n
2020-05-10 19:21       ` Ricardo Wurmus
2020-05-11 10:14         ` L p R n d n
2020-05-12  9:59         ` L p R n d n
2020-05-20 20:51           ` Ricardo Wurmus
2020-05-21  8:28             ` L p R n d n
2020-05-21  9:23               ` Ricardo Wurmus
2020-06-08 15:35                 ` L p R n d n
2022-08-04  5:09                   ` [bug#35305] [WIP] " Maxim Cournoyer
2020-06-19 14:47                 ` [bug#35305] " L p R n d n
2022-08-04  2:19   ` [bug#35305] [WIP] " Maxim Cournoyer
2022-08-31  7:13 ` bug#35305: " Ricardo Wurmus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.