[PATCH 0/1] gnu: home: Add home-dbus-service-type.

  • Done
  • quality assurance status badge
Details
3 participants
  • Andrew Tropin
  • Ludovic Courtès
  • (
Owner
unassigned
Submitted by
(
Severity
normal

Debbugs page

( wrote 2 years ago
(address . guix-patches@gnu.org)(name . ()(address . paren@disroot.org)
20221011194513.26008-1-paren@disroot.org
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
( wrote 2 years ago
[PATCH 1/1] gnu: home: Add home-dbus-service-type.
(address . 58454@debbugs.gnu.org)(name . ()(address . paren@disroot.org)
20221011195430.26160-1-paren@disroot.org
* 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(-)

Toggle diff (111 lines)
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))
;;;
@@ -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
Andrew Tropin wrote 2 years ago
(name . ()(address . paren@disroot.org)
87ilkpmrkk.fsf@trop.in
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:

Toggle quote (85 lines)
> * 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))
>
>
> ;;;
> @@ -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?

Toggle quote (32 lines)
> + (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

Toggle snippet (3 lines)
'(("DBUS_SESSION_BUS_ADDRESS" . "unix:path=$XDG_RUNTIME_DIR/bus"))

?

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

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmNGa+sACgkQIgjSCVjB
3rBtDg/+LUO4ET7FJlJuOxf4ExfusiFX2ftczEeoEXxH9N5UeRDBWy3gv9m2+rBl
nNdlpAJi0CsZm53AxnfXLiSc1RANa2WRxO1k2kgDKdGfa9vz7hnWmhoqtXxjsUZ6
r2/zjd2Anl7+xzYPzSSfwUlUzkZJ8IKrfASKdeIwS/kAYpwGFTUh58n2Ub4DfBcp
meqOCKhsvGq+5woKmIwtWzYpO+08giydOlhh34IxN81coNP/BuiinWprcqMxUexa
ENzvyVLt9f+J31cTomHe2YpBTsLaknzOrsf9S0lryEsvEyfmxssbD+IbAmB4oXpH
yn3teOzHsH5GoKcFz0dBDHLTLpStTMJHOwJ+A3Qh6xUl1pijt94rFmOs5D7jk+g0
GgOUYJ6PmEg7IzL+t/yP8ubgY+hZV3/oYknv3Oh4fF+gtQdJD9FrfhgQYmpXL1pd
FWOI/QSye4UVYyHFzSC1LpO9r+vKVZw1yJCXzXgTHNGz4Hu6AhTFtbetDz7le22A
yLdpN75/OWPbuwiQBjKgZajBOJjvNTpVDCOUM/UFOeGZGr0cTzzPauPyh16jR6He
wIBCsE94cOcdtV1SEAAX1G41TihyNMWHEgnIBwhD+VxbUsAmgJIXpa12mLbl7WXZ
Vpec0y9NzCyQtIsdst+uc8WjRt/X/HmjUJyMiC+Je+cvzFU4d0U=
=Tuex
-----END PGP SIGNATURE-----

( wrote 2 years ago
CNJS5W3NIZZ1.3SQMV2YXIETRE@guix-framework
Hi Andrew,

On Wed Oct 12, 2022 at 8:25 AM BST, Andrew Tropin wrote:
Toggle quote (6 lines)
> 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.

Toggle quote (8 lines)
> 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 :)

-- (
( wrote 2 years ago
[PATCH] gnu: home: Add home-dbus-service-type.
(address . 58454@debbugs.gnu.org)(name . ()(address . paren@disroot.org)
20221012080116.4935-1-paren@disroot.org
* 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(-)

Toggle diff (117 lines)
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))
;;;
@@ -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
( wrote 2 years ago
[PATCH v2] gnu: home: Add home-dbus-service-type.
(address . 58454@debbugs.gnu.org)(name . ()(address . paren@disroot.org)
20221012080147.4971-1-paren@disroot.org
* 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(-)

Toggle diff (117 lines)
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))
;;;
@@ -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
Andrew Tropin wrote 2 years ago
Re: [bug#58454] [PATCH 1/1] gnu: home: Add home-dbus-service-type.
87czaxmiof.fsf@trop.in
On 2022-10-12 08:53, ( wrote:

Toggle quote (15 lines)
> 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.

Toggle quote (11 lines)
>
>> 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.

Toggle quote (4 lines)
>
>
> -- (

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmNGmPAACgkQIgjSCVjB
3rCyBg//RHrORxBfVFBaKtavMrMnIvG2EwRClkdCy8wtWUBu4jjZMIc8amE3OTdC
2AM8RF9nhF/t2uAtQ3GvPKwpkPJ/0qmkceKxylfNC8J4YYvz/0wNQlGLJplL6YMM
3Jq6711ec19HL7aul54zt43Wg4WfrSKqW5WWQqqy0yn66xFWa8y8mkszrD0YcNkK
+mXiCG5kK8pSeoAbpi6uscMnxjXOUAxIMr4ac5It2WaTVpyk+sr+u8s1awVKtlX7
gJhJsTkEC2PTByd39RwoxaJDXgY31UfoA0eesEwomMdPBzTGW5MO50vbQqIoLvy9
raU38sFDjGLciCK/F+WrWYrLofAGod2IucQVLstcnwKqGwrhD7JlruMnLcBEfa0J
Wk/9U0dPxcUKLDtaBiv+SQkYgiXyF1bBmF+jZUEq211xYPwaXjkTWNux5/GA6Pfr
SGlwkkkPLVMqGU71Z8QV/PNh0Q/YW6GMJLUnr7mS+AQXFbLP3GX4KQgjWoyCnNk2
u48XASNqUFaLeAeoo8Cl1IkVNZ/9ncnN/X21S+0ZvaOg1n4oCPVTTffpqS/+2eAy
l2jaona0OCTTWdw8zZupYhj4GkZNIrd5nxmrv7JsLYBt+e4Ihpk9ezhGZyJKhQhn
XRc5TmTjrBGytciLzSRtpApNiUvas8P4nxxm7sXt3uJ2yjljbks=
=odqM
-----END PGP SIGNATURE-----

( wrote 2 years ago
CNK16VTJ6HG7.3U4VSLHTCM8QI@guix-framework
On Wed Oct 12, 2022 at 11:37 AM BST, Andrew Tropin wrote:
Toggle quote (4 lines)
> 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''.

-- (
( wrote 2 years ago
[PATCH v3] gnu: home: Add home-dbus-service-type.
(address . 58454@debbugs.gnu.org)(name . ()(address . paren@disroot.org)
20221012202139.8379-1-paren@disroot.org
* 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(-)

Toggle diff (110 lines)
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))
;;;
@@ -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
Andrew Tropin wrote 2 years ago
(name . ()(address . paren@disroot.org)
87y1tkcn6u.fsf@trop.in
On 2022-10-12 21:21, "\( via Guix-patches" via wrote:

Toggle quote (86 lines)
> * 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))
>
>
> ;;;
> @@ -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.

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

Removed --nosyslog.

Toggle quote (9 lines)
> + (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.

Toggle quote (21 lines)
> + (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 :)

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmNHoJkACgkQIgjSCVjB
3rByLg//TkBpBGQb0/GBBM3Txq2MB4D9iyXiErHjiId/qeGL54yb41gPocnO9ZZU
j3CJAEq8zFAoAf2dGAwyut4j7kYc2z4LEO60Cs6NTTOZU4kYHYTI7m1Xp6dMGLsF
eZPDNOXoxY/ICof/fxQOb5+eUqMWDRcSD3Jo+T9nOXCbW6J4RS4b+YfulcoZuo7Z
K2Oy2Fly70Frd3ZM0TQv3PgZU4qlkVyoJc8YtlZt0zo0LAoKuw/4I4AyJSVsOOV+
9MSM3O68BO51G66tMvbrW2OtRwLguwVfEr1m8mmeuqha+S6P6CjNgXGu6qX82W1I
q8jwT7wFVKe2WAK5nofGcBLShj/yXnb4BNzMC8GoeeEhJzH3t30XtuhdjQhpKgpK
GCR+MLknWjJAjqMS9/nD6rFcT2vzguqjsV2875D8aHsCM+mvtIRJh1zkAHVrGCLu
PekQT3kx0eTROT+59FlhZ7Gq/4o//3JK81EvH/QbUjA07Un+lCyRufMmXOMlHJxj
cIAzk1yH1UO+X2Xw2+9k7svzqUEdqcBu4hWAcCNuzfqJL8czfMMkIaWRElVeUi36
ZmZfb3CNJWD5Y6ab0FaCRUO7CXm7nK3GwtlUj5BcGjsqg/rdnagrdAhaup6YELtr
6pGVi29bLOEr9CgRSee17MFizWt5ML9tD7kMG9MQjdUsIHtmo9o=
=6Sw5
-----END PGP SIGNATURE-----

( wrote 2 years ago
CNKKLNTWMZIP.3PWKB4NI9R0TD@guix-framework
Thanks!

-- (
Andrew Tropin wrote 2 years ago
Applied
(address . control@debbugs.gnu.org)
875ygocj8h.fsf@trop.in
close 58454
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmNHtJ8ACgkQIgjSCVjB
3rBB6xAAhw3szQAtt1JDJJ8097Oai419xkosUdESattCdkx9LSIbCpTD1QlbrAqj
0djpAOg5WSr6jBq4Ka2Hs55WSsLYOLoYZ5LDMazyWPvOO1MtV8RUYkFqJgDORhaz
LKbRuC1tr0Iu0sgOZgDHQpcHu8xdhmXmmo/SbNGA/Z2UpvCEWmVR6av8Fi/YUwE6
Ityg61nSR50htTSsdSlGkudU6djCpbU5Ilkrm3CprcizWaL4YKt0CWYVnQgtXVQI
bqdFmakrH5gDL8xvnUf5zbpE5f0EwqWgqoL5RiJMaDAYhMLiV3M1wRYGuILUAgUq
U+/szgFGJaioC7QBLjnpqyjW3SPtQy04Ubu3Kez0Bh8wy3CwuLFWxZJzhwfgKVjW
0L694+fXTCnP/SvA5iaqH1UpOo7SmN4efL6PG43ewqP/3RHPVM7PIAQUYE0tsete
XiSvtDZvXR1cNhYHUnRw94t783ayoeJOtyw1CmAZ7+e9TooYh9Dgf7iRLzZLQbWT
bC0xPOzXxYKb31kEy6jrGXVvxOqEDf2Cp/WvSmyvsBLt+0Anx7beeepnRQt7TTjF
Zxabo6RGxX+pZE24aZcxsu/QxE5xYqT9vggokDJZ/xXvfW5PlstAZziXDW2L9LQQ
nWUIW15NwF/3GXvg6zF5zzTOqlw/aG0JUzgj29DLQsEtWMyP0Ms=
=R3ex
-----END PGP SIGNATURE-----

Ludovic Courtès wrote 2 years ago
Re: bug#58454: [PATCH 0/1] gnu: home: Add home-dbus-service-type.
(name . ()(address . paren@disroot.org)(address . 58454@debbugs.gnu.org)
87a65yl9ml.fsf@gnu.org
Hi!

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

Toggle quote (5 lines)
> 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’.
( wrote 2 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 58454@debbugs.gnu.org)
CNLW0YID7E9J.20W3Y5TLHZMRV@guix-framework
Hey,

On Fri Oct 14, 2022 at 4:15 PM BST, Ludovic Courtès wrote:
Toggle quote (7 lines)
> 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.

-- (
?
Your comment

This issue is archived.

To comment on this conversation send an email to 58454@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 58454
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help