unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#58454] [PATCH 0/1] gnu: home: Add home-dbus-service-type.
@ 2022-10-11 19:45 ( via Guix-patches via
  2022-10-11 19:54 ` [bug#58454] [PATCH 1/1] " ( via Guix-patches via
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: ( via Guix-patches via @ 2022-10-11 19:45 UTC (permalink / raw)
  To: 58454; +Cc: (

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





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

* [bug#58454] [PATCH 1/1] gnu: home: Add home-dbus-service-type.
  2022-10-11 19:45 [bug#58454] [PATCH 0/1] gnu: home: Add home-dbus-service-type ( via Guix-patches via
@ 2022-10-11 19:54 ` ( via Guix-patches via
  2022-10-12  7:25   ` Andrew Tropin
  2022-10-12  8:01 ` [bug#58454] [PATCH] " ( via Guix-patches via
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: ( via Guix-patches via @ 2022-10-11 19:54 UTC (permalink / raw)
  To: 58454; +Cc: (

* 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@gnu.org>
+;;; Copyright © 2022 ( <paren@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))
 
 \f
 ;;;
@@ -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.")))
+
+\f
+;;;
+;;; 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





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

* [bug#58454] [PATCH 1/1] gnu: home: Add home-dbus-service-type.
  2022-10-11 19:54 ` [bug#58454] [PATCH 1/1] " ( via Guix-patches via
@ 2022-10-12  7:25   ` Andrew Tropin
  2022-10-12  7:53     ` ( via Guix-patches via
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Tropin @ 2022-10-12  7:25 UTC (permalink / raw)
  To: 58454; +Cc: (

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

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@gnu.org>
> +;;; Copyright © 2022 ( <paren@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))
>  
>  \f
>  ;;;
> @@ -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.")))
> +
> +\f
> +;;;
> +;;; 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* [bug#58454] [PATCH 1/1] gnu: home: Add home-dbus-service-type.
  2022-10-12  7:25   ` Andrew Tropin
@ 2022-10-12  7:53     ` ( via Guix-patches via
  2022-10-12 10:37       ` Andrew Tropin
  0 siblings, 1 reply; 13+ messages in thread
From: ( via Guix-patches via @ 2022-10-12  7:53 UTC (permalink / raw)
  To: andrew, 58454

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 :)

    -- (




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

* [bug#58454] [PATCH] gnu: home: Add home-dbus-service-type.
  2022-10-11 19:45 [bug#58454] [PATCH 0/1] gnu: home: Add home-dbus-service-type ( via Guix-patches via
  2022-10-11 19:54 ` [bug#58454] [PATCH 1/1] " ( via Guix-patches via
@ 2022-10-12  8:01 ` ( via Guix-patches via
  2022-10-12  8:01 ` [bug#58454] [PATCH v2] " ( via Guix-patches via
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: ( via Guix-patches via @ 2022-10-12  8:01 UTC (permalink / raw)
  To: 58454; +Cc: (

* 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@gnu.org>
+;;; Copyright © 2022 ( <paren@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))
 
 \f
 ;;;
@@ -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.")))
+
+\f
+;;;
+;;; 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





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

* [bug#58454] [PATCH v2] gnu: home: Add home-dbus-service-type.
  2022-10-11 19:45 [bug#58454] [PATCH 0/1] gnu: home: Add home-dbus-service-type ( via Guix-patches via
  2022-10-11 19:54 ` [bug#58454] [PATCH 1/1] " ( via Guix-patches via
  2022-10-12  8:01 ` [bug#58454] [PATCH] " ( via Guix-patches via
@ 2022-10-12  8:01 ` ( via Guix-patches via
  2022-10-12 20:21 ` [bug#58454] [PATCH v3] " ( via Guix-patches via
  2022-10-14 15:15 ` [bug#58454] [PATCH 0/1] " Ludovic Courtès
  4 siblings, 0 replies; 13+ messages in thread
From: ( via Guix-patches via @ 2022-10-12  8:01 UTC (permalink / raw)
  To: 58454; +Cc: (

* 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@gnu.org>
+;;; Copyright © 2022 ( <paren@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))
 
 \f
 ;;;
@@ -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.")))
+
+\f
+;;;
+;;; 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





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

* [bug#58454] [PATCH 1/1] gnu: home: Add home-dbus-service-type.
  2022-10-12  7:53     ` ( via Guix-patches via
@ 2022-10-12 10:37       ` Andrew Tropin
  2022-10-12 14:57         ` ( via Guix-patches via
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Tropin @ 2022-10-12 10:37 UTC (permalink / raw)
  To: paren, 58454

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

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* [bug#58454] [PATCH 1/1] gnu: home: Add home-dbus-service-type.
  2022-10-12 10:37       ` Andrew Tropin
@ 2022-10-12 14:57         ` ( via Guix-patches via
  0 siblings, 0 replies; 13+ messages in thread
From: ( via Guix-patches via @ 2022-10-12 14:57 UTC (permalink / raw)
  To: andrew, 58454

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''.

    -- (




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

* [bug#58454] [PATCH v3] gnu: home: Add home-dbus-service-type.
  2022-10-11 19:45 [bug#58454] [PATCH 0/1] gnu: home: Add home-dbus-service-type ( via Guix-patches via
                   ` (2 preceding siblings ...)
  2022-10-12  8:01 ` [bug#58454] [PATCH v2] " ( via Guix-patches via
@ 2022-10-12 20:21 ` ( via Guix-patches via
  2022-10-13  5:22   ` Andrew Tropin
  2022-10-14 15:15 ` [bug#58454] [PATCH 0/1] " Ludovic Courtès
  4 siblings, 1 reply; 13+ messages in thread
From: ( via Guix-patches via @ 2022-10-12 20:21 UTC (permalink / raw)
  To: 58454; +Cc: (

* 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@gnu.org>
+;;; Copyright © 2022 ( <paren@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))
 
 \f
 ;;;
@@ -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.")))
+
+\f
+;;;
+;;; 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





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

* [bug#58454] [PATCH v3] gnu: home: Add home-dbus-service-type.
  2022-10-12 20:21 ` [bug#58454] [PATCH v3] " ( via Guix-patches via
@ 2022-10-13  5:22   ` Andrew Tropin
  2022-10-13  6:10     ` ( via Guix-patches via
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Tropin @ 2022-10-13  5:22 UTC (permalink / raw)
  To: 58454; +Cc: (

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

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@gnu.org>
> +;;; Copyright © 2022 ( <paren@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))
>  
>  \f
>  ;;;
> @@ -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.")))
> +
> +\f
> +;;;
> +;;; 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* [bug#58454] [PATCH v3] gnu: home: Add home-dbus-service-type.
  2022-10-13  5:22   ` Andrew Tropin
@ 2022-10-13  6:10     ` ( via Guix-patches via
  0 siblings, 0 replies; 13+ messages in thread
From: ( via Guix-patches via @ 2022-10-13  6:10 UTC (permalink / raw)
  To: andrew, 58454

Thanks!

    -- (




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

* [bug#58454] [PATCH 0/1] gnu: home: Add home-dbus-service-type.
  2022-10-11 19:45 [bug#58454] [PATCH 0/1] gnu: home: Add home-dbus-service-type ( via Guix-patches via
                   ` (3 preceding siblings ...)
  2022-10-12 20:21 ` [bug#58454] [PATCH v3] " ( via Guix-patches via
@ 2022-10-14 15:15 ` Ludovic Courtès
  2022-10-14 19:19   ` ( via Guix-patches via
  4 siblings, 1 reply; 13+ messages in thread
From: Ludovic Courtès @ 2022-10-14 15:15 UTC (permalink / raw)
  To: (; +Cc: 58454

Hi!

"(" <paren@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’.




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

* [bug#58454] [PATCH 0/1] gnu: home: Add home-dbus-service-type.
  2022-10-14 15:15 ` [bug#58454] [PATCH 0/1] " Ludovic Courtès
@ 2022-10-14 19:19   ` ( via Guix-patches via
  0 siblings, 0 replies; 13+ messages in thread
From: ( via Guix-patches via @ 2022-10-14 19:19 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 58454

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.

    -- (




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

end of thread, other threads:[~2022-10-14 19:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-11 19:45 [bug#58454] [PATCH 0/1] gnu: home: Add home-dbus-service-type ( via Guix-patches via
2022-10-11 19:54 ` [bug#58454] [PATCH 1/1] " ( via Guix-patches via
2022-10-12  7:25   ` Andrew Tropin
2022-10-12  7:53     ` ( via Guix-patches via
2022-10-12 10:37       ` Andrew Tropin
2022-10-12 14:57         ` ( via Guix-patches via
2022-10-12  8:01 ` [bug#58454] [PATCH] " ( via Guix-patches via
2022-10-12  8:01 ` [bug#58454] [PATCH v2] " ( via Guix-patches via
2022-10-12 20:21 ` [bug#58454] [PATCH v3] " ( via Guix-patches via
2022-10-13  5:22   ` Andrew Tropin
2022-10-13  6:10     ` ( via Guix-patches via
2022-10-14 15:15 ` [bug#58454] [PATCH 0/1] " Ludovic Courtès
2022-10-14 19:19   ` ( via Guix-patches via

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).