GNU bug report logs - #58454
[PATCH 0/1] gnu: home: Add home-dbus-service-type.

Previous Next

Package: guix-patches;

Reported by: "(" <paren <at> disroot.org>

Date: Tue, 11 Oct 2022 19:46:02 UTC

Severity: normal

Tags: patch

Done: Andrew Tropin <andrew <at> trop.in>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 58454 in the body.
You can then email your comments to 58454 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Tue, 11 Oct 2022 19:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "(" <paren <at> disroot.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 11 Oct 2022 19:46:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "(" <paren <at> disroot.org>
To: guix-patches <at> gnu.org
Cc: "\(" <paren <at> disroot.org>
Subject: [PATCH 0/1] gnu: home: Add home-dbus-service-type.
Date: Tue, 11 Oct 2022 20:45:13 +0100
This patch adds a home service for running D-Bus in session mode. It's
a prerequisite for the ``home-mako-service-type'' I'm writing, as Mako
requires a session D-Bus daemon to be running so that it can receive
notifications.

( (1):
  gnu: home: Add home-dbus-service-type.

 doc/guix.texi                 | 17 ++++++++++++
 gnu/home/services/desktop.scm | 52 ++++++++++++++++++++++++++++++++++-
 2 files changed, 68 insertions(+), 1 deletion(-)

-- 
2.38.0





Information forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Tue, 11 Oct 2022 19:55:01 GMT) Full text and rfc822 format available.

Message #8 received at 58454 <at> debbugs.gnu.org (full text, mbox):

From: "(" <paren <at> disroot.org>
To: 58454 <at> debbugs.gnu.org
Cc: "\(" <paren <at> disroot.org>
Subject: [PATCH 1/1] gnu: home: Add home-dbus-service-type.
Date: Tue, 11 Oct 2022 20:54:30 +0100
* gnu/home/services/desktop.scm (home-dbus-service-type): New
  variable.
(home-dbus-configuration): New record type.
* doc/guix.texi: Document them.
---
 doc/guix.texi                 | 17 ++++++++++++
 gnu/home/services/desktop.scm | 52 ++++++++++++++++++++++++++++++++++-
 2 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 5867acb746..990113703b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41262,6 +41262,23 @@ format.
 
 @end deftp
 
+@defvr {Scheme Variable} home-dbus-service-type
+This is the service type for running a session-specific D-Bus, for
+unprivileged applications that require D-Bus to be running.
+@end defvr
+
+@deftp {Data Type} home-dbus-configuration
+The configuration record for @code{home-dbus-service-type}.
+
+@table @asis
+@item @code{dbus} (default: @code{dbus})
+The package providing the @code{/bin/dbus-daemon} command.
+
+@item @code{verbose?} (default: @code{#f})
+Whether to enable logging.
+@end table
+@end deftp
+
 @node Guix Home Services
 @subsection Guix Home Services
 
diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm
index b0f4d969b0..4cf151762d 100644
--- a/gnu/home/services/desktop.scm
+++ b/gnu/home/services/desktop.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2022 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2022 ( <paren <at> disroot.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -20,6 +21,7 @@ (define-module (gnu home services desktop)
   #:use-module (gnu home services)
   #:use-module (gnu home services shepherd)
   #:use-module (gnu services configuration)
+  #:autoload   (gnu packages glib)    (dbus)
   #:autoload   (gnu packages xdisorg) (redshift)
   #:use-module (guix records)
   #:use-module (guix gexp)
@@ -27,8 +29,10 @@ (define-module (gnu home services desktop)
   #:use-module (ice-9 match)
   #:export (home-redshift-configuration
             home-redshift-configuration?
+            home-redshift-service-type
 
-            home-redshift-service-type))
+            home-dbus-configuration
+            home-dbus-service-type))
 
 
 ;;;
@@ -172,3 +176,49 @@ (define home-redshift-service-type
    (description
     "Run Redshift, a program that adjusts the color temperature of display
 according to time of day.")))
+
+
+;;;
+;;; D-Bus.
+;;;
+
+(define-record-type* <home-dbus-configuration>
+  home-dbus-configuration make-home-dbus-configuration
+  home-dbus-configuration?
+  (dbus home-dbus-dbus                  ;file-like
+        (default dbus))
+  (verbose? home-dbus-verbose?          ;boolean
+            (default #f)))
+
+(define (home-dbus-shepherd-services config)
+  (list (shepherd-service
+         (documentation "Run the D-Bus daemon in session-specific mode.")
+         (provision '(dbus-session))
+         (start #~(make-forkexec-constructor
+                   (list #$(file-append (home-dbus-dbus config)
+                                        "/bin/dbus-daemon")
+                         "--nofork" "--session" "--syslog-only"
+                         (format #f "--address=unix:path=~a/bus"
+                                 (or (getenv "XDG_RUNTIME_DIR")
+                                     (format #f "/run/user/~a"
+                                             (getuid)))))
+                   #$@(if (home-dbus-verbose? config)
+                          (list #:environment-variables
+                                #~(list "DBUS_VERBOSE=1")
+                                #:log-file
+                                (format #f "~a/dbus-daemon.log"
+                                        (or (getenv "XDG_LOG_HOME")
+                                            (format #f "~a/.local/var/log"
+                                                    (getenv "HOME")))))
+                          '())))
+         (stop #~(make-kill-destructor)))))
+
+(define home-dbus-service-type
+  (service-type
+   (name 'home-dbus)
+   (extensions
+    (list (service-extension home-shepherd-service-type
+                             home-dbus-shepherd-services)))
+   (default-value (home-dbus-configuration))
+   (description
+    "Run the session-specific D-Bus inter-process message bus.")))
-- 
2.38.0





Information forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Wed, 12 Oct 2022 07:26:02 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: "( via Guix-patches via" <guix-patches <at> gnu.org>, 58454 <at> debbugs.gnu.org
Cc: "\(" <paren <at> disroot.org>
Subject: Re: [bug#58454] [PATCH 1/1] gnu: home: Add home-dbus-service-type.
Date: Wed, 12 Oct 2022 11:25:31 +0400
[Message part 1 (text/plain, inline)]
Hi unmatched-paren!

Thank you for the patch, it looks good and I think can be merged in the
way it is right now, but I wrote a few minor notes/nitpicks below.

On 2022-10-11 20:54, "\( via Guix-patches" via wrote:

> * gnu/home/services/desktop.scm (home-dbus-service-type): New
>   variable.
> (home-dbus-configuration): New record type.
> * doc/guix.texi: Document them.
> ---
>  doc/guix.texi                 | 17 ++++++++++++
>  gnu/home/services/desktop.scm | 52 ++++++++++++++++++++++++++++++++++-
>  2 files changed, 68 insertions(+), 1 deletion(-)
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 5867acb746..990113703b 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -41262,6 +41262,23 @@ format.
>  
>  @end deftp
>  
> +@defvr {Scheme Variable} home-dbus-service-type
> +This is the service type for running a session-specific D-Bus, for
> +unprivileged applications that require D-Bus to be running.
> +@end defvr
> +
> +@deftp {Data Type} home-dbus-configuration
> +The configuration record for @code{home-dbus-service-type}.
> +
> +@table @asis
> +@item @code{dbus} (default: @code{dbus})
> +The package providing the @code{/bin/dbus-daemon} command.
> +
> +@item @code{verbose?} (default: @code{#f})
> +Whether to enable logging.
> +@end table
> +@end deftp
> +
>  @node Guix Home Services
>  @subsection Guix Home Services
>  
> diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm
> index b0f4d969b0..4cf151762d 100644
> --- a/gnu/home/services/desktop.scm
> +++ b/gnu/home/services/desktop.scm
> @@ -1,5 +1,6 @@
>  ;;; GNU Guix --- Functional package management for GNU
>  ;;; Copyright © 2022 Ludovic Courtès <ludo <at> gnu.org>
> +;;; Copyright © 2022 ( <paren <at> disroot.org>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -20,6 +21,7 @@ (define-module (gnu home services desktop)
>    #:use-module (gnu home services)
>    #:use-module (gnu home services shepherd)
>    #:use-module (gnu services configuration)
> +  #:autoload   (gnu packages glib)    (dbus)
>    #:autoload   (gnu packages xdisorg) (redshift)
>    #:use-module (guix records)
>    #:use-module (guix gexp)
> @@ -27,8 +29,10 @@ (define-module (gnu home services desktop)
>    #:use-module (ice-9 match)
>    #:export (home-redshift-configuration
>              home-redshift-configuration?
> +            home-redshift-service-type
>  
> -            home-redshift-service-type))
> +            home-dbus-configuration
> +            home-dbus-service-type))
>  
>  
>  ;;;
> @@ -172,3 +176,49 @@ (define home-redshift-service-type
>     (description
>      "Run Redshift, a program that adjusts the color temperature of display
>  according to time of day.")))
> +
> +
> +;;;
> +;;; D-Bus.
> +;;;
> +
> +(define-record-type* <home-dbus-configuration>
> +  home-dbus-configuration make-home-dbus-configuration
> +  home-dbus-configuration?
> +  (dbus home-dbus-dbus                  ;file-like
> +        (default dbus))
> +  (verbose? home-dbus-verbose?          ;boolean

Sounds a little missleading as it doesn't control the verbosity of
logging, but the logging as a whole.

Also, does logging to file work at all when --syslog-only option
provided?

> +            (default #f)))
> +
> +(define (home-dbus-shepherd-services config)
> +  (list (shepherd-service
> +         (documentation "Run the D-Bus daemon in session-specific mode.")
> +         (provision '(dbus-session))
> +         (start #~(make-forkexec-constructor
> +                   (list #$(file-append (home-dbus-dbus config)
> +                                        "/bin/dbus-daemon")
> +                         "--nofork" "--session" "--syslog-only"
> +                         (format #f "--address=unix:path=~a/bus"
> +                                 (or (getenv "XDG_RUNTIME_DIR")
> +                                     (format #f "/run/user/~a"
> +                                             (getuid)))))
> +                   #$@(if (home-dbus-verbose? config)
> +                          (list #:environment-variables
> +                                #~(list "DBUS_VERBOSE=1")
> +                                #:log-file
> +                                (format #f "~a/dbus-daemon.log"
> +                                        (or (getenv "XDG_LOG_HOME")
> +                                            (format #f "~a/.local/var/log"
> +                                                    (getenv "HOME")))))
> +                          '())))
> +         (stop #~(make-kill-destructor)))))
> +
> +(define home-dbus-service-type
> +  (service-type
> +   (name 'home-dbus)
> +   (extensions
> +    (list (service-extension home-shepherd-service-type
> +                             home-dbus-shepherd-services)))

Do we want to extend environment-variables with

--8<---------------cut here---------------start------------->8---
'(("DBUS_SESSION_BUS_ADDRESS" . "unix:path=$XDG_RUNTIME_DIR/bus"))
--8<---------------cut here---------------end--------------->8---

?

> +   (default-value (home-dbus-configuration))
> +   (description
> +    "Run the session-specific D-Bus inter-process message bus.")))

-- 
Best regards,
Andrew Tropin
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Wed, 12 Oct 2022 07:27:01 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Wed, 12 Oct 2022 07:54:01 GMT) Full text and rfc822 format available.

Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "(" <paren <at> disroot.org>
To: "Andrew Tropin" <andrew <at> trop.in>, "( via Guix-patches via"
 <guix-patches <at> gnu.org>, <58454 <at> debbugs.gnu.org>
Subject: Re: [bug#58454] [PATCH 1/1] gnu: home: Add home-dbus-service-type.
Date: Wed, 12 Oct 2022 08:53:02 +0100
Hi Andrew,

On Wed Oct 12, 2022 at 8:25 AM BST, Andrew Tropin wrote:
> Sounds a little missleading as it doesn't control the verbosity of
> logging, but the logging as a whole.
>
> Also, does logging to file work at all when --syslog-only option
> provided?

The system D-Bus service uses ``verbose?'' to turn on logging, and
I wanted to keep it consistent. I'm not sure whether ``--syslog-only''
stops logging to the log file, but since system D-Bus uses the flag
too, I assumed it doesn't.

> Do we want to extend environment-variables with
> 
> --8<---------------cut here---------------start------------->8---
> '(("DBUS_SESSION_BUS_ADDRESS" . "unix:path=$XDG_RUNTIME_DIR/bus"))
> --8<---------------cut here---------------end--------------->8---
>
> ?

Oh, I didn't know about that variable. I'll add that, one moment :)

    -- (




Information forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Wed, 12 Oct 2022 07:54:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Wed, 12 Oct 2022 08:02:01 GMT) Full text and rfc822 format available.

Message #23 received at 58454 <at> debbugs.gnu.org (full text, mbox):

From: "(" <paren <at> disroot.org>
To: 58454 <at> debbugs.gnu.org
Cc: "\(" <paren <at> disroot.org>
Subject: [PATCH] gnu: home: Add home-dbus-service-type.
Date: Wed, 12 Oct 2022 09:01:16 +0100
* gnu/home/services/desktop.scm (home-dbus-service-type): New
  variable.
(home-dbus-configuration): New record type.
* doc/guix.texi: Document them.
---
 doc/guix.texi                 | 17 ++++++++++
 gnu/home/services/desktop.scm | 58 ++++++++++++++++++++++++++++++++++-
 2 files changed, 74 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 5867acb746..990113703b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41262,6 +41262,23 @@ format.
 
 @end deftp
 
+@defvr {Scheme Variable} home-dbus-service-type
+This is the service type for running a session-specific D-Bus, for
+unprivileged applications that require D-Bus to be running.
+@end defvr
+
+@deftp {Data Type} home-dbus-configuration
+The configuration record for @code{home-dbus-service-type}.
+
+@table @asis
+@item @code{dbus} (default: @code{dbus})
+The package providing the @code{/bin/dbus-daemon} command.
+
+@item @code{verbose?} (default: @code{#f})
+Whether to enable logging.
+@end table
+@end deftp
+
 @node Guix Home Services
 @subsection Guix Home Services
 
diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm
index b0f4d969b0..20d0724055 100644
--- a/gnu/home/services/desktop.scm
+++ b/gnu/home/services/desktop.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2022 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2022 ( <paren <at> disroot.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -20,6 +21,7 @@ (define-module (gnu home services desktop)
   #:use-module (gnu home services)
   #:use-module (gnu home services shepherd)
   #:use-module (gnu services configuration)
+  #:autoload   (gnu packages glib)    (dbus)
   #:autoload   (gnu packages xdisorg) (redshift)
   #:use-module (guix records)
   #:use-module (guix gexp)
@@ -27,8 +29,10 @@ (define-module (gnu home services desktop)
   #:use-module (ice-9 match)
   #:export (home-redshift-configuration
             home-redshift-configuration?
+            home-redshift-service-type
 
-            home-redshift-service-type))
+            home-dbus-configuration
+            home-dbus-service-type))
 
 
 ;;;
@@ -172,3 +176,55 @@ (define home-redshift-service-type
    (description
     "Run Redshift, a program that adjusts the color temperature of display
 according to time of day.")))
+
+
+;;;
+;;; D-Bus.
+;;;
+
+(define-record-type* <home-dbus-configuration>
+  home-dbus-configuration make-home-dbus-configuration
+  home-dbus-configuration?
+  (dbus home-dbus-dbus                  ;file-like
+        (default dbus))
+  (verbose? home-dbus-verbose?          ;boolean
+            (default #f)))
+
+(define (home-dbus-shepherd-services config)
+  (list (shepherd-service
+         (documentation "Run the D-Bus daemon in session-specific mode.")
+         (provision '(dbus-session))
+         (start #~(make-forkexec-constructor
+                   (list #$(file-append (home-dbus-dbus config)
+                                        "/bin/dbus-daemon")
+                         "--nofork" "--session"
+                         (format #f "--address=unix:path=~a/bus"
+                                 (or (getenv "XDG_RUNTIME_DIR")
+                                     (format #f "/run/user/~a"
+                                             (getuid)))))
+                   #$@(if (home-dbus-verbose? config)
+                          (list #:environment-variables
+                                #~(list "DBUS_VERBOSE=1")
+                                #:log-file
+                                (format #f "~a/dbus-daemon.log"
+                                        (or (getenv "XDG_LOG_HOME")
+                                            (format #f "~a/.local/var/log"
+                                                    (getenv "HOME")))))
+                          '())))
+         (stop #~(make-kill-destructor)))))
+
+(define (home-dbus-environment-variables config)
+  '(("DBUS_SESSION_BUS_ADDRESS"
+     . "unix:path=${XDG_RUNTIME_DIR:-/run/user/$UID}/bus")))
+
+(define home-dbus-service-type
+  (service-type
+   (name 'home-dbus)
+   (extensions
+    (list (service-extension home-shepherd-service-type
+                             home-dbus-shepherd-services)
+          (service-extension home-environment-variables-service-type
+                             home-dbus-environment-variables)))
+   (default-value (home-dbus-configuration))
+   (description
+    "Run the session-specific D-Bus inter-process message bus.")))
-- 
2.38.0





Information forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Wed, 12 Oct 2022 08:02:02 GMT) Full text and rfc822 format available.

Message #26 received at 58454 <at> debbugs.gnu.org (full text, mbox):

From: "(" <paren <at> disroot.org>
To: 58454 <at> debbugs.gnu.org
Cc: "\(" <paren <at> disroot.org>
Subject: [PATCH v2] gnu: home: Add home-dbus-service-type.
Date: Wed, 12 Oct 2022 09:01:47 +0100
* gnu/home/services/desktop.scm (home-dbus-service-type): New
  variable.
(home-dbus-configuration): New record type.
* doc/guix.texi: Document them.
---
 doc/guix.texi                 | 17 ++++++++++
 gnu/home/services/desktop.scm | 58 ++++++++++++++++++++++++++++++++++-
 2 files changed, 74 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 5867acb746..990113703b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41262,6 +41262,23 @@ format.
 
 @end deftp
 
+@defvr {Scheme Variable} home-dbus-service-type
+This is the service type for running a session-specific D-Bus, for
+unprivileged applications that require D-Bus to be running.
+@end defvr
+
+@deftp {Data Type} home-dbus-configuration
+The configuration record for @code{home-dbus-service-type}.
+
+@table @asis
+@item @code{dbus} (default: @code{dbus})
+The package providing the @code{/bin/dbus-daemon} command.
+
+@item @code{verbose?} (default: @code{#f})
+Whether to enable logging.
+@end table
+@end deftp
+
 @node Guix Home Services
 @subsection Guix Home Services
 
diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm
index b0f4d969b0..20d0724055 100644
--- a/gnu/home/services/desktop.scm
+++ b/gnu/home/services/desktop.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2022 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2022 ( <paren <at> disroot.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -20,6 +21,7 @@ (define-module (gnu home services desktop)
   #:use-module (gnu home services)
   #:use-module (gnu home services shepherd)
   #:use-module (gnu services configuration)
+  #:autoload   (gnu packages glib)    (dbus)
   #:autoload   (gnu packages xdisorg) (redshift)
   #:use-module (guix records)
   #:use-module (guix gexp)
@@ -27,8 +29,10 @@ (define-module (gnu home services desktop)
   #:use-module (ice-9 match)
   #:export (home-redshift-configuration
             home-redshift-configuration?
+            home-redshift-service-type
 
-            home-redshift-service-type))
+            home-dbus-configuration
+            home-dbus-service-type))
 
 
 ;;;
@@ -172,3 +176,55 @@ (define home-redshift-service-type
    (description
     "Run Redshift, a program that adjusts the color temperature of display
 according to time of day.")))
+
+
+;;;
+;;; D-Bus.
+;;;
+
+(define-record-type* <home-dbus-configuration>
+  home-dbus-configuration make-home-dbus-configuration
+  home-dbus-configuration?
+  (dbus home-dbus-dbus                  ;file-like
+        (default dbus))
+  (verbose? home-dbus-verbose?          ;boolean
+            (default #f)))
+
+(define (home-dbus-shepherd-services config)
+  (list (shepherd-service
+         (documentation "Run the D-Bus daemon in session-specific mode.")
+         (provision '(dbus-session))
+         (start #~(make-forkexec-constructor
+                   (list #$(file-append (home-dbus-dbus config)
+                                        "/bin/dbus-daemon")
+                         "--nofork" "--session"
+                         (format #f "--address=unix:path=~a/bus"
+                                 (or (getenv "XDG_RUNTIME_DIR")
+                                     (format #f "/run/user/~a"
+                                             (getuid)))))
+                   #$@(if (home-dbus-verbose? config)
+                          (list #:environment-variables
+                                #~(list "DBUS_VERBOSE=1")
+                                #:log-file
+                                (format #f "~a/dbus-daemon.log"
+                                        (or (getenv "XDG_LOG_HOME")
+                                            (format #f "~a/.local/var/log"
+                                                    (getenv "HOME")))))
+                          '())))
+         (stop #~(make-kill-destructor)))))
+
+(define (home-dbus-environment-variables config)
+  '(("DBUS_SESSION_BUS_ADDRESS"
+     . "unix:path=${XDG_RUNTIME_DIR:-/run/user/$UID}/bus")))
+
+(define home-dbus-service-type
+  (service-type
+   (name 'home-dbus)
+   (extensions
+    (list (service-extension home-shepherd-service-type
+                             home-dbus-shepherd-services)
+          (service-extension home-environment-variables-service-type
+                             home-dbus-environment-variables)))
+   (default-value (home-dbus-configuration))
+   (description
+    "Run the session-specific D-Bus inter-process message bus.")))
-- 
2.38.0





Information forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Wed, 12 Oct 2022 10:38:01 GMT) Full text and rfc822 format available.

Message #29 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: "(" <paren <at> disroot.org>, "( via Guix-patches via"
 <guix-patches <at> gnu.org>, 58454 <at> debbugs.gnu.org
Subject: Re: [bug#58454] [PATCH 1/1] gnu: home: Add home-dbus-service-type.
Date: Wed, 12 Oct 2022 14:37:36 +0400
[Message part 1 (text/plain, inline)]
On 2022-10-12 08:53, ( wrote:

> Hi Andrew,
>
> On Wed Oct 12, 2022 at 8:25 AM BST, Andrew Tropin wrote:
>> Sounds a little missleading as it doesn't control the verbosity of
>> logging, but the logging as a whole.
>>
>> Also, does logging to file work at all when --syslog-only option
>> provided?
>
> The system D-Bus service uses ``verbose?'' to turn on logging, and
> I wanted to keep it consistent.

> I'm not sure whether ``--syslog-only'' stops logging to the log file,
> but since system D-Bus uses the flag too, I assumed it doesn't.

Can you check it, please?

Also, I don't think that we want session dbus output in
/var/log/messages and probably we don't need this verbose? field at all
and always want to use log-file.

>
>> Do we want to extend environment-variables with
>> 
>> --8<---------------cut here---------------start------------->8---
>> '(("DBUS_SESSION_BUS_ADDRESS" . "unix:path=$XDG_RUNTIME_DIR/bus"))
>> --8<---------------cut here---------------end--------------->8---
>>
>> ?
>
> Oh, I didn't know about that variable. I'll add that, one moment :)

Actually, it was a question :)  It shouldn't break anything and
hardcoding this variable should work in most cases, so I think we can
keep it for now.

>
>
>     -- (

-- 
Best regards,
Andrew Tropin
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Wed, 12 Oct 2022 10:38:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Wed, 12 Oct 2022 14:58:02 GMT) Full text and rfc822 format available.

Message #35 received at 58454 <at> debbugs.gnu.org (full text, mbox):

From: "(" <paren <at> disroot.org>
To: "Andrew Tropin" <andrew <at> trop.in>, "( via Guix-patches via"
 <guix-patches <at> gnu.org>, <58454 <at> debbugs.gnu.org>
Subject: Re: [bug#58454] [PATCH 1/1] gnu: home: Add home-dbus-service-type.
Date: Wed, 12 Oct 2022 15:57:29 +0100
On Wed Oct 12, 2022 at 11:37 AM BST, Andrew Tropin wrote:
> Also, I don't think that we want session dbus output in
> /var/log/messages and probably we don't need this verbose? field at all
> and always want to use log-file.

Fair enough; I'll remove ``verbose?'' and add ``--nosyslog''.

    -- (




Information forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Wed, 12 Oct 2022 14:59:01 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Wed, 12 Oct 2022 20:22:01 GMT) Full text and rfc822 format available.

Message #41 received at 58454 <at> debbugs.gnu.org (full text, mbox):

From: "(" <paren <at> disroot.org>
To: 58454 <at> debbugs.gnu.org
Cc: "\(" <paren <at> disroot.org>
Subject: [PATCH v3] gnu: home: Add home-dbus-service-type.
Date: Wed, 12 Oct 2022 21:21:39 +0100
* gnu/home/services/desktop.scm (home-dbus-service-type): New
  variable.
(home-dbus-configuration): New record type.
* doc/guix.texi: Document them.
---
 doc/guix.texi                 | 14 +++++++++
 gnu/home/services/desktop.scm | 54 ++++++++++++++++++++++++++++++++++-
 2 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 5867acb746..78ada9c301 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41262,6 +41262,20 @@ format.
 
 @end deftp
 
+@defvr {Scheme Variable} home-dbus-service-type
+This is the service type for running a session-specific D-Bus, for
+unprivileged applications that require D-Bus to be running.
+@end defvr
+
+@deftp {Data Type} home-dbus-configuration
+The configuration record for @code{home-dbus-service-type}.
+
+@table @asis
+@item @code{dbus} (default: @code{dbus})
+The package providing the @code{/bin/dbus-daemon} command.
+@end table
+@end deftp
+
 @node Guix Home Services
 @subsection Guix Home Services
 
diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm
index b0f4d969b0..1f41ace766 100644
--- a/gnu/home/services/desktop.scm
+++ b/gnu/home/services/desktop.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2022 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2022 ( <paren <at> disroot.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -20,6 +21,7 @@ (define-module (gnu home services desktop)
   #:use-module (gnu home services)
   #:use-module (gnu home services shepherd)
   #:use-module (gnu services configuration)
+  #:autoload   (gnu packages glib)    (dbus)
   #:autoload   (gnu packages xdisorg) (redshift)
   #:use-module (guix records)
   #:use-module (guix gexp)
@@ -27,8 +29,10 @@ (define-module (gnu home services desktop)
   #:use-module (ice-9 match)
   #:export (home-redshift-configuration
             home-redshift-configuration?
+            home-redshift-service-type
 
-            home-redshift-service-type))
+            home-dbus-configuration
+            home-dbus-service-type))
 
 
 ;;;
@@ -172,3 +176,51 @@ (define home-redshift-service-type
    (description
     "Run Redshift, a program that adjusts the color temperature of display
 according to time of day.")))
+
+
+;;;
+;;; D-Bus.
+;;;
+
+(define-record-type* <home-dbus-configuration>
+  home-dbus-configuration make-home-dbus-configuration
+  home-dbus-configuration?
+  (dbus home-dbus-dbus                  ;file-like
+        (default dbus)))
+
+(define (home-dbus-shepherd-services config)
+  (list (shepherd-service
+         (documentation "Run the D-Bus daemon in session-specific mode.")
+         (provision '(dbus-session))
+         (start #~(make-forkexec-constructor
+                   (list #$(file-append (home-dbus-dbus config)
+                                        "/bin/dbus-daemon")
+                         "--nofork" "--session" "--nosyslog"
+                         (format #f "--address=unix:path=~a/bus"
+                                 (or (getenv "XDG_RUNTIME_DIR")
+                                     (format #f "/run/user/~a"
+                                             (getuid)))))
+                   #:environment-variables
+                   #~(list "DBUS_VERBOSE=1")
+                   #:log-file
+                   (format #f "~a/dbus-daemon.log"
+                           (or (getenv "XDG_LOG_HOME")
+                               (format #f "~a/.local/var/log"
+                                       (getenv "HOME"))))))
+         (stop #~(make-kill-destructor)))))
+
+(define (home-dbus-environment-variables config)
+  '(("DBUS_SESSION_BUS_ADDRESS"
+     . "unix:path=${XDG_RUNTIME_DIR:-/run/user/$UID}/bus")))
+
+(define home-dbus-service-type
+  (service-type
+   (name 'home-dbus)
+   (extensions
+    (list (service-extension home-shepherd-service-type
+                             home-dbus-shepherd-services)
+          (service-extension home-environment-variables-service-type
+                             home-dbus-environment-variables)))
+   (default-value (home-dbus-configuration))
+   (description
+    "Run the session-specific D-Bus inter-process message bus.")))
-- 
2.38.0





Information forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Thu, 13 Oct 2022 05:23:02 GMT) Full text and rfc822 format available.

Message #44 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andrew Tropin <andrew <at> trop.in>
To: "( via Guix-patches via" <guix-patches <at> gnu.org>, 58454 <at> debbugs.gnu.org
Cc: "\(" <paren <at> disroot.org>
Subject: Re: [bug#58454] [PATCH v3] gnu: home: Add home-dbus-service-type.
Date: Thu, 13 Oct 2022 09:22:33 +0400
[Message part 1 (text/plain, inline)]
On 2022-10-12 21:21, "\( via Guix-patches" via wrote:

> * gnu/home/services/desktop.scm (home-dbus-service-type): New
>   variable.
> (home-dbus-configuration): New record type.
> * doc/guix.texi: Document them.
> ---
>  doc/guix.texi                 | 14 +++++++++
>  gnu/home/services/desktop.scm | 54 ++++++++++++++++++++++++++++++++++-
>  2 files changed, 67 insertions(+), 1 deletion(-)
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 5867acb746..78ada9c301 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -41262,6 +41262,20 @@ format.
>  
>  @end deftp
>  
> +@defvr {Scheme Variable} home-dbus-service-type
> +This is the service type for running a session-specific D-Bus, for
> +unprivileged applications that require D-Bus to be running.
> +@end defvr
> +
> +@deftp {Data Type} home-dbus-configuration
> +The configuration record for @code{home-dbus-service-type}.
> +
> +@table @asis
> +@item @code{dbus} (default: @code{dbus})
> +The package providing the @code{/bin/dbus-daemon} command.
> +@end table
> +@end deftp
> +
>  @node Guix Home Services
>  @subsection Guix Home Services
>  
> diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm
> index b0f4d969b0..1f41ace766 100644
> --- a/gnu/home/services/desktop.scm
> +++ b/gnu/home/services/desktop.scm
> @@ -1,5 +1,6 @@
>  ;;; GNU Guix --- Functional package management for GNU
>  ;;; Copyright © 2022 Ludovic Courtès <ludo <at> gnu.org>
> +;;; Copyright © 2022 ( <paren <at> disroot.org>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -20,6 +21,7 @@ (define-module (gnu home services desktop)
>    #:use-module (gnu home services)
>    #:use-module (gnu home services shepherd)
>    #:use-module (gnu services configuration)
> +  #:autoload   (gnu packages glib)    (dbus)
>    #:autoload   (gnu packages xdisorg) (redshift)
>    #:use-module (guix records)
>    #:use-module (guix gexp)
> @@ -27,8 +29,10 @@ (define-module (gnu home services desktop)
>    #:use-module (ice-9 match)
>    #:export (home-redshift-configuration
>              home-redshift-configuration?
> +            home-redshift-service-type
>  
> -            home-redshift-service-type))
> +            home-dbus-configuration
> +            home-dbus-service-type))
>  
>  
>  ;;;
> @@ -172,3 +176,51 @@ (define home-redshift-service-type
>     (description
>      "Run Redshift, a program that adjusts the color temperature of display
>  according to time of day.")))
> +
> +
> +;;;
> +;;; D-Bus.
> +;;;
> +
> +(define-record-type* <home-dbus-configuration>
> +  home-dbus-configuration make-home-dbus-configuration
> +  home-dbus-configuration?
> +  (dbus home-dbus-dbus                  ;file-like
> +        (default dbus)))
> +
> +(define (home-dbus-shepherd-services config)
> +  (list (shepherd-service
> +         (documentation "Run the D-Bus daemon in session-specific mode.")
> +         (provision '(dbus-session))

Changed it to just dbus.

> +         (start #~(make-forkexec-constructor
> +                   (list #$(file-append (home-dbus-dbus config)
> +                                        "/bin/dbus-daemon")
> +                         "--nofork" "--session" "--nosyslog"

Removed --nosyslog.

> +                         (format #f "--address=unix:path=~a/bus"
> +                                 (or (getenv "XDG_RUNTIME_DIR")
> +                                     (format #f "/run/user/~a"
> +                                             (getuid)))))
> +                   #:environment-variables
> +                   #~(list "DBUS_VERBOSE=1")
> +                   #:log-file
> +                   (format #f "~a/dbus-daemon.log"

Changed it to dbus.log.

> +                           (or (getenv "XDG_LOG_HOME")
> +                               (format #f "~a/.local/var/log"
> +                                       (getenv "HOME"))))))
> +         (stop #~(make-kill-destructor)))))
> +
> +(define (home-dbus-environment-variables config)
> +  '(("DBUS_SESSION_BUS_ADDRESS"
> +     . "unix:path=${XDG_RUNTIME_DIR:-/run/user/$UID}/bus")))
> +
> +(define home-dbus-service-type
> +  (service-type
> +   (name 'home-dbus)
> +   (extensions
> +    (list (service-extension home-shepherd-service-type
> +                             home-dbus-shepherd-services)
> +          (service-extension home-environment-variables-service-type
> +                             home-dbus-environment-variables)))
> +   (default-value (home-dbus-configuration))
> +   (description
> +    "Run the session-specific D-Bus inter-process message bus.")))

Applied with small adjustments mentioned above, will push soon, thank
you for the patch.

Now I can also close the TODO in rde :)
https://git.sr.ht/~abcdw/rde/tree/111130ebf3ef4a9143186604c054aeb807a84063/rde/features/base.scm#L305

-- 
Best regards,
Andrew Tropin
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Thu, 13 Oct 2022 05:23:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Thu, 13 Oct 2022 06:11:01 GMT) Full text and rfc822 format available.

Message #50 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "(" <paren <at> disroot.org>
To: "Andrew Tropin" <andrew <at> trop.in>, "( via Guix-patches via"
 <guix-patches <at> gnu.org>, <58454 <at> debbugs.gnu.org>
Subject: Re: [bug#58454] [PATCH v3] gnu: home: Add home-dbus-service-type.
Date: Thu, 13 Oct 2022 07:10:09 +0100
Thanks!

    -- (




Information forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Thu, 13 Oct 2022 06:11:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 58454 <at> debbugs.gnu.org and "(" <paren <at> disroot.org> Request was from Andrew Tropin <andrew <at> trop.in> to control <at> debbugs.gnu.org. (Thu, 13 Oct 2022 06:49:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Fri, 14 Oct 2022 15:16:02 GMT) Full text and rfc822 format available.

Message #58 received at 58454 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "(" <paren <at> disroot.org>
Cc: 58454 <at> debbugs.gnu.org
Subject: Re: bug#58454: [PATCH 0/1] gnu: home: Add home-dbus-service-type.
Date: Fri, 14 Oct 2022 17:15:14 +0200
Hi!

"(" <paren <at> disroot.org> skribis:

> This patch adds a home service for running D-Bus in session mode. It's
> a prerequisite for the ``home-mako-service-type'' I'm writing, as Mako
> requires a session D-Bus daemon to be running so that it can receive
> notifications.

Isn’t the session bus automatically started on demand?  I don’t remember
having to run it explicitly, but maybe it’s because GDM does it for me?

In any case, it would be nice in the manual to document when
‘home-dbus-service-type’ is useful; it doesn’t seem useful for me with
GDM + EXWM at least.

Thoughts?

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#58454; Package guix-patches. (Fri, 14 Oct 2022 19:21:02 GMT) Full text and rfc822 format available.

Message #61 received at 58454 <at> debbugs.gnu.org (full text, mbox):

From: "(" <paren <at> disroot.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 58454 <at> debbugs.gnu.org
Subject: Re: bug#58454: [PATCH 0/1] gnu: home: Add home-dbus-service-type.
Date: Fri, 14 Oct 2022 20:19:59 +0100
Hey,

On Fri Oct 14, 2022 at 4:15 PM BST, Ludovic Courtès wrote:
> Isn’t the session bus automatically started on demand?  I don’t remember
> having to run it explicitly, but maybe it’s because GDM does it for me?
>
> In any case, it would be nice in the manual to document when
> ‘home-dbus-service-type’ is useful; it doesn’t seem useful for me with
> GDM + EXWM at least.

Yeah, I think complex login managers like GDM do start it automatically, but simpler things like greetd don't.

    -- (




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 12 Nov 2022 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 281 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.