Subject: Re: [PATCH] gnu: elogind-service-type: Put user configuration in drop-in dirs.

From: Ludovic Courtès <[email-masked]>
Date: Thu, 24 Apr 2025 23:13:58 +0200

Hey,

Josselin Poiret <[email-masked]> writes:

> From: Josselin Poiret <[email-masked]>
>
> * gnu/services/desktop.scm (elogind-configuration-files): Renamed from
> elogind-configuration-file. Split sections [Login] and [Sleep] in two files.
> (elogind-shepherd-service): Remove useless environment variable.
>
> Change-Id: Ibb4db04152c397c1ed4a35118129a2860ac9c2b5
> +  `(("logind.conf.d/logind.conf" .

[...]

> +    ("sleep.conf.d/sleep.conf" .

Should it be elogind/{logind.conf,sleep.conf}?

>  (define (elogind-etc-directory config)
>    "Return the /etc/elogind directory for CONFIG."
> -  (with-imported-modules (source-module-closure '((guix build utils)))
> +  (with-imported-modules (source-module-closure '((guix build utils) (ice-9 match) (srfi srfi-1)))

This is incorrect: it would import these two modules from the host
Guile into the build environment.

> +         #$@(append-map
> +             (match-lambda
> +               ((name . file)
> +                (list
> +                 #~(mkdir-p (dirname (string-append #$output "/" #$name)))
> +                 #~(copy-file #$file (string-append #$output "/" #$name)))))
> +             (elogind-configuration-files config))))))

I’d rather avoid the list of gexps and instead write:

  #$(map (match-lambda
          ((target . file)
           #~(begin
               (mkdir-p …)
               (copy-file …))))
         …)

> -         (actions (list (shepherd-configuration-action config-file))))))

Too bad we’re losing this.  Perhaps we could have a custom
‘configuration’ action returning the list of config files?
Not a blocker anyway.

Thanks for fixing it, I’ve inadvertently turned off my laptop too many
times!

Ludo’.