1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

home: services: niri: Use existing session dbus.

Spawning niri with `dbus-run-session` as is done here causes the compositor
and children applications to run within it's own D-Bus session bus rather than
relying on the already existing one.  This causes Guix home services that rely
on a session bus to misbehave within a niri session, as the bus the services
are talking to is not the same as the one niri & applications see.  Guix home
already provides a `home-dbus-service-type` for ensuring a D-Bus session bus
exists, so it makes sense to just rely on that.

* gnu/home/services/niri.scm (home-niri-service-type): Add
HOME-DBUS-SERVICE-TYPE extension.
(home-niri-shepherd-service)[requirement]: Add DBUS requirement.
[start]: Drop the 'dbus-run-session' call in favour of extending
HOME-DBUS-SERVICE-TYPE.

Change-Id: I1d402064128fe94aaaa2868e174752ef640dd31e
Signed-off-by: Oleg Pykhalov <go.wigust@gmail.com>
This commit is contained in:
Estevan Castilho
2026-03-22 18:02:20 +00:00
committed by Oleg Pykhalov
parent 02c36a8ad8
commit c3a13b2593

View File

@@ -19,6 +19,7 @@
(define-module (gnu home services niri)
#:use-module (gnu home services)
#:use-module (gnu home services shepherd)
#:use-module (gnu home services desktop)
#:use-module (gnu packages bash)
#:use-module (gnu packages freedesktop)
#:use-module (gnu packages glib)
@@ -40,14 +41,15 @@
(define (home-niri-shepherd-service config)
"Return a shepherd service that runs Niri, a scrollable tiling Wayland
compositor. The service starts Niri in a DBus session with appropriate
environment variables set for a Wayland desktop session."
compositor. The service starts Niri with appropriate environment variables
set for a Wayland desktop session."
(list (shepherd-service
(documentation "Run Niri scrollable tiling Wayland compositor.")
(provision '(niri))
(requirement '(dbus))
(start #~(make-forkexec-constructor
(list #$(file-append bash "/bin/bash") "-l"
"-c" "exec dbus-run-session niri --session")
"-c" "exec niri --session")
#:environment-variables
(append (list #$@(niri-configuration-environment-variables config))
'("DESKTOP_SESSION=niri"
@@ -66,6 +68,8 @@ environment variables set for a Wayland desktop session."
(extensions
(list (service-extension home-shepherd-service-type
home-niri-shepherd-service)
(service-extension home-dbus-service-type
(const '()))
(service-extension home-profile-service-type
(lambda (config)
(list dbus