From: Josselin Poiret <[email protected]>
* 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
---
Hello everyone,
Here's a fix I just tested. I chose to use drop-in directories instead of the
main conf file as it uses an hardcoded PKGCONFDIR.
Best,
Josselin
gnu/services/desktop.scm | 110 ++++++++++++++++++++-------------------
1 file changed, 57 insertions(+), 53 deletions(-)
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index fe034cfa8f4..628879c73dd 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -1101,7 +1101,7 @@ (define-record-type* <elogind-configuration>
elogind-configuration
(broadcast-suspend-interrupts? elogind-broadcast-suspend-interrupts?
(default #t)))
-(define (elogind-configuration-file config)
+(define (elogind-configuration-files config)
(define (yesno x)
(match x
(#t "yes")
@@ -1152,55 +1152,59 @@ (define (elogind-configuration-file config)
(string-append str "\n")))))
(define-syntax-rule (ini-file config file clause ...)
(plain-file file (string-append (ini-file-clause config clause) ...)))
- (ini-file
- config "logind.conf"
- "[Login]"
- ("KillUserProcesses" (yesno elogind-kill-user-processes?))
- ("KillOnlyUsers" (user-name-list elogind-kill-only-users))
- ("KillExcludeUsers" (user-name-list elogind-kill-exclude-users))
- ("InhibitDelayMaxSec" (non-negative-integer
elogind-inhibit-delay-max-seconds))
- ("HandlePowerKey" (handle-action elogind-handle-power-key))
- ("HandleSuspendKey" (handle-action elogind-handle-suspend-key))
- ("HandleHibernateKey" (handle-action elogind-handle-hibernate-key))
- ("HandleLidSwitch" (handle-action elogind-handle-lid-switch))
- ("HandleLidSwitchDocked" (handle-action elogind-handle-lid-switch-docked))
- ("HandleLidSwitchExternalPower" (handle-action
elogind-handle-lid-switch-external-power))
- ("PowerKeyIgnoreInhibited" (yesno elogind-power-key-ignore-inhibited?))
- ("SuspendKeyIgnoreInhibited" (yesno elogind-suspend-key-ignore-inhibited?))
- ("HibernateKeyIgnoreInhibited" (yesno
elogind-hibernate-key-ignore-inhibited?))
- ("LidSwitchIgnoreInhibited" (yesno elogind-lid-switch-ignore-inhibited?))
- ("HoldoffTimeoutSec" (non-negative-integer elogind-holdoff-timeout-seconds))
- ("IdleAction" (handle-action elogind-idle-action))
- ("IdleActionSec" (non-negative-integer elogind-idle-action-seconds))
- ("RuntimeDirectorySize"
- (identity
- (lambda (config)
- (match (elogind-runtime-directory-size-percent config)
- (#f (non-negative-integer (elogind-runtime-directory-size config)))
- (percent (string-append (non-negative-integer percent) "%"))))))
- ("RemoveIPC" (yesno elogind-remove-ipc?))
- "[Sleep]"
- ("SuspendState" (sleep-list elogind-suspend-state))
- ("SuspendMode" (sleep-list elogind-suspend-mode))
- ("HibernateState" (sleep-list elogind-hibernate-state))
- ("HibernateMode" (sleep-list elogind-hibernate-mode))
- ("HybridSleepState" (sleep-list elogind-hybrid-sleep-state))
- ("HybridSleepMode" (sleep-list elogind-hybrid-sleep-mode))
- ("HibernateDelaySec" (maybe-non-negative-integer
elogind-hibernate-delay-seconds))
- ("SuspendEstimationSec" (maybe-non-negative-integer
elogind-suspend-estimation-seconds))
- ("AllowPowerOffInterrupts" (yesno elogind-allow-power-off-interrupts?))
- ("AllowSuspendInterrupts" (yesno elogind-allow-suspend-interrupts?))
- ("BroadcastPowerOffInterrupts" (yesno
elogind-broadcast-power-off-interrupts?))
- ("BroadcastSuspendInterrupts" (yesno
elogind-broadcast-suspend-interrupts?))))
+ `(("logind.conf.d/logind.conf" .
+ ,(ini-file
+ config "logind.conf"
+ "[Login]"
+ ("KillUserProcesses" (yesno elogind-kill-user-processes?))
+ ("KillOnlyUsers" (user-name-list elogind-kill-only-users))
+ ("KillExcludeUsers" (user-name-list elogind-kill-exclude-users))
+ ("InhibitDelayMaxSec" (non-negative-integer
elogind-inhibit-delay-max-seconds))
+ ("HandlePowerKey" (handle-action elogind-handle-power-key))
+ ("HandleSuspendKey" (handle-action elogind-handle-suspend-key))
+ ("HandleHibernateKey" (handle-action elogind-handle-hibernate-key))
+ ("HandleLidSwitch" (handle-action elogind-handle-lid-switch))
+ ("HandleLidSwitchDocked" (handle-action
elogind-handle-lid-switch-docked))
+ ("HandleLidSwitchExternalPower" (handle-action
elogind-handle-lid-switch-external-power))
+ ("PowerKeyIgnoreInhibited" (yesno elogind-power-key-ignore-inhibited?))
+ ("SuspendKeyIgnoreInhibited" (yesno
elogind-suspend-key-ignore-inhibited?))
+ ("HibernateKeyIgnoreInhibited" (yesno
elogind-hibernate-key-ignore-inhibited?))
+ ("LidSwitchIgnoreInhibited" (yesno
elogind-lid-switch-ignore-inhibited?))
+ ("HoldoffTimeoutSec" (non-negative-integer
elogind-holdoff-timeout-seconds))
+ ("IdleAction" (handle-action elogind-idle-action))
+ ("IdleActionSec" (non-negative-integer elogind-idle-action-seconds))
+ ("RuntimeDirectorySize"
+ (identity
+ (lambda (config)
+ (match (elogind-runtime-directory-size-percent config)
+ (#f (non-negative-integer (elogind-runtime-directory-size
config)))
+ (percent (string-append (non-negative-integer percent) "%"))))))
+ ("RemoveIPC" (yesno elogind-remove-ipc?))))
+ ("sleep.conf.d/sleep.conf" .
+ ,(ini-file
+ config "sleep.conf"
+ "[Sleep]"
+ ("SuspendState" (sleep-list elogind-suspend-state))
+ ("SuspendMode" (sleep-list elogind-suspend-mode))
+ ("HibernateState" (sleep-list elogind-hibernate-state))
+ ("HibernateMode" (sleep-list elogind-hibernate-mode))
+ ("HybridSleepState" (sleep-list elogind-hybrid-sleep-state))
+ ("HybridSleepMode" (sleep-list elogind-hybrid-sleep-mode))
+ ("HibernateDelaySec" (maybe-non-negative-integer
elogind-hibernate-delay-seconds))
+ ("SuspendEstimationSec" (maybe-non-negative-integer
elogind-suspend-estimation-seconds))
+ ("AllowPowerOffInterrupts" (yesno elogind-allow-power-off-interrupts?))
+ ("AllowSuspendInterrupts" (yesno elogind-allow-suspend-interrupts?))
+ ("BroadcastPowerOffInterrupts" (yesno
elogind-broadcast-power-off-interrupts?))
+ ("BroadcastSuspendInterrupts" (yesno
elogind-broadcast-suspend-interrupts?))))))
(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)))
(computed-file
"etc-elogind"
#~(begin
- (use-modules (guix build utils))
+ (use-modules (guix build utils) (ice-9 match) (srfi srfi-1))
(define sleep-directory (string-append #$output "/system-sleep/"))
(define shutdown-directory (string-append #$output
"/system-shutdown/"))
@@ -1218,7 +1222,14 @@ (define (elogind-etc-directory config)
'#$(elogind-system-sleep-hook-files config))
(for-each (lambda (f)
(copy-script f shutdown-directory))
- '#$(elogind-system-shutdown-hook-files config))))))
+ '#$(elogind-system-shutdown-hook-files config))
+ #$@(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))))))
(define (elogind-dbus-service config)
"Return a @file{org.freedesktop.login1.service} file that tells D-Bus how to
@@ -1301,20 +1312,13 @@ (define (pam-extension-procedure config)
(define (elogind-shepherd-service config)
"Return a Shepherd service to start elogind according to @var{config}."
- (define config-file
- (elogind-configuration-file config))
-
(list (shepherd-service
(requirement '(user-processes dbus-system))
(provision '(elogind))
(start #~(make-forkexec-constructor
(list #$(file-append (elogind-package config)
- "/libexec/elogind/elogind"))
- #:environment-variables
- (list (string-append "ELOGIND_CONF_FILE="
- #$config-file))))
- (stop #~(make-kill-destructor))
- (actions (list (shepherd-configuration-action config-file))))))
+ "/libexec/elogind/elogind"))))
+ (stop #~(make-kill-destructor)))))
(define elogind-service-type
(service-type (name 'elogind)
base-commit: a6c96cdb7060ccfc2d0fe27a45b9bcc9590aedd6
prerequisite-patch-id: 1ee329e14fdb8d1e35141e9b5972c5e9b8a2b252
--
2.49.0