~ruther/guix-local

3a8e19a61d785ba651c63a3a5991a6e6dcfba9cb — Dariqq 1 year, 6 months ago b9d7e15
gnu: lightdm-service-type: Add lightdm.conf to /etc/lightdm.

* gnu/services/lightdm.scm
(lightdm-configuration->greeters-config-dir): Rename to...
(lightdm-configuration-directory): ... this, and add the
lightdm-configuration-file.
(lightdm-shepherd-service): Don't pass the configuration file, don't set
XDG_CONFIG_DIRS
(lightdm-etc-service): New procedure.
(lightdm-service-type): Use lightdm-etc-service as the etc-extension.

Change-Id: I982ec1f7bdfd085621f45a8a1e4b175ab481202f
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
1 files changed, 21 insertions(+), 27 deletions(-)

M gnu/services/lightdm.scm
M gnu/services/lightdm.scm => gnu/services/lightdm.scm +21 -27
@@ 397,15 397,6 @@ When unspecified, listen for any hosts/IP addresses.")
   (list-of-strings '())
   "Extra configuration values to append to the LightDM configuration file."))

(define (lightdm-configuration->greeters-config-dir config)
  "Return a directory containing all the serialized greeter configurations
from CONFIG, a <lightdm-configuration> object."
  (file-union "etc-lightdm"
              (append-map (lambda (g)
                            `((,(greeter-configuration->conf-name g)
                               ,(greeter-configuration->file g))))
                          (lightdm-configuration-greeters config))))

(define (lightdm-configuration->packages config)
  "Return all the greeter packages and their assets defined in CONFIG, a
<lightdm-configuration> object, as well as the lightdm package itself."


@@ 496,6 487,16 @@ port=" (number->string vnc-server-port) "\n"
                                       lightdm-seat-configuration-fields)))
          seats))))

(define (lightdm-configuration-directory config)
  "Return a directory containing the serialized lightdm configuration
and all the serialized greeter configurations from CONFIG."
  (file-union "etc-lightdm"
              (cons `("lightdm.conf" ,(lightdm-configuration-file config))
                    (map (lambda (g)
                           `(,(greeter-configuration->conf-name g)
                             ,(greeter-configuration->file g)))
                         (lightdm-configuration-greeters config)))))

(define %lightdm-accounts
  (list (user-group (name "lightdm") (system? #t))
        (user-account


@@ 589,9 590,7 @@ port=" (number->string vnc-server-port) "\n"
                           "/sbin/lightdm")
            #$@(if (lightdm-configuration-debug? config)
                   #~("--debug")
                   #~())
            "--config"
            #$(lightdm-configuration-file config)))
                   #~())))

  (define lightdm-paths
    (let ((lightdm (lightdm-configuration-lightdm config)))


@@ 601,9 600,6 @@ port=" (number->string vnc-server-port) "\n"
                 '("/bin" "/sbin" "/libexec"))
         ":")))

  (define greeters-config-dir
    (lightdm-configuration->greeters-config-dir config))

  (define data-dirs
    ;; LightDM itself needs to be in XDG_DATA_DIRS for the accountsservice
    ;; interface it provides to be picked up.  The greeters must also be in


@@ 626,11 622,7 @@ port=" (number->string vnc-server-port) "\n"
                                  ;; Lightdm needs itself in its PATH.
                                  #:environment-variables
                                  (list
                                   ;; It knows to look for greeter
                                   ;; configurations in XDG_CONFIG_DIRS...
                                   (string-append "XDG_CONFIG_DIRS="
                                                  #$greeters-config-dir)
                                   ;; ... and for greeter .desktop files as
                                   ;; It looks for greeter .desktop files as
                                   ;; well as lightdm accountsservice
                                   ;; interface in XDG_DATA_DIRS.
                                   (string-append "XDG_DATA_DIRS="


@@ 638,6 630,11 @@ port=" (number->string vnc-server-port) "\n"
                                   (string-append "PATH=" #$lightdm-paths))))
    (stop #~(make-kill-destructor)))))

(define (lightdm-etc-service config)
  "Return a list of FILES for @var{etc-service-type} to build the
/etc/lightdm directory using CONFIG"
  (list `("lightdm" ,(lightdm-configuration-directory config))))

(define lightdm-service-type
  (handle-xorg-configuration
   lightdm-configuration


@@ 666,13 663,10 @@ port=" (number->string vnc-server-port) "\n"
           ;; https://github.com/NixOS/nixpkgs/issues/45059.
           (service-extension profile-service-type
                              lightdm-configuration->packages)
           ;; This is needed for the greeter itself to find its configuration,
           ;; because XDG_CONF_DIRS gets overridden by /etc/profile.
           (service-extension
            etc-service-type
            (lambda (config)
              `(("lightdm"
                 ,(lightdm-configuration->greeters-config-dir config)))))))
           ;; This is needed for lightdm and greeter
           ;; to find their configuration
           (service-extension etc-service-type
                              lightdm-etc-service)))
    (description "Run @code{lightdm}, the LightDM graphical login manager."))))