all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nils Landt <nils@landt.email>
To: Roman Riabenko <roman@riabenko.com>,
	Roman Riabenko via <help-guix@gnu.org>
Subject: Re: D-Bus service files on foreign distributions
Date: Thu, 12 Sep 2024 13:13:17 +0200 (CEST)	[thread overview]
Message-ID: <1883395578.670871.1726139597698@office.mailbox.org> (raw)
In-Reply-To: <e748991d233206295f94224fa05e48021a70b392.camel@riabenko.com>


> Roman Riabenko via <help-guix@gnu.org> hat am 11.09.2024 20:57 CEST geschrieben:
> 
>  
> У пн, 2024-08-26 у 10:27 +0200, Nils Landt пише:
> > > Roman Riabenko via <help-guix@gnu.org> hat am 25.08.2024 13:08 CEST
> > > geschrieben:
> > > 
> > > How to expose service files to D-Bus on a foreign distribution?
> > 
> > I'm 100% guessing here, but I think systemd just doesn't see your
> > service files because they are not in the search path.
> > If this is the case, you can set XDG_DATA_DIRS in
> > ~/.config/systemd/user.conf (under the Manager header), i.e.:
> > [Manager]
> > ManagerEnvironment="XDG_DATA_DIRS=/home/purism/.guix-profile/share"
> 
> Thank you for the suggestion. The lines are already present. I assume
> that the guix installation script added them.

From what I can tell, the installation script does not do this. Maybe you did it in the past already? Anyway, shouldn't matter.

> $ cat ~/.config/systemd/user.conf
> [Manager]
> ManagerEnvironment="XDG_DATA_DIRS=/home/purism/.guix-profile/share"
> 
> It may be working because the systemd environment for the user session
> gets the value.
> 
> $ systemctl --user show-environment | grep XDG_DATA_DIRS
> XDG_DATA_DIRS=/home/purism/.guix-profile/share:/home/purism/.guix-
> profile/share:/usr/share/librem5:/home/purism/.guix-
> profile/share:/home/purism/.guix-
> profile/share:/usr/share/librem5:/home/purism/.local/share/flatpak/expo
> rts/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/
> 
> But systemd does not pass the value to the user DBus environment.
> 
> $ systemctl --user status dbus | grep PID
>    Main PID: 1261 (dbus-daemon)
> $ sudo strings /proc/1261/environ | grep XDG_DATA_DIRS
> XDG_DATA_DIRS=/home/purism/.local/share/flatpak/exports/share:/var/lib/
> flatpak/exports/share:/usr/local/share/:/usr/share/
> 
> So, DBus does not see the service files in the guix profile.
> 
> $ LC_ALL=C gdbus call --session --method
> org.freedesktop.DBus.Introspectable.Introspect --dest
> org.gnome.TextEditor --object-path=/org/gnome/TextEditor
> Error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name
> org.gnome.TextEditor was not provided by any .service files
> 
> The manual page for systemd-system.conf says that to set manager
> environment variables passed to all executed process, one can set
> DefaultEnvironment option. I set it as suggested in
> https://unix.stackexchange.com/a/698459/423679
> 
> $ cat ~/.config/systemd/user.conf
> [Manager]
> ManagerEnvironment="XDG_DATA_DIRS=/home/purism/.guix-profile/share"
> DefaultEnvironment="XDG_DATA_DIRS=/home/purism/.guix-profile/share"
> 
> This change was ignored. So, I tried adding it to the file specified in
> the manual page.

DefaultEnvironment does nothing here. Processes spawned by the user manager inherit the environment variables from the user manager.

> $ cat /etc/systemd/user.conf | grep DefaultEnvironment
> DefaultEnvironment="XDG_DATA_DIRS=%h/.guix-profile/share"

Looking at the purism docs (https://software.pureos.net/package/src/pureos/byzantium/systemd), systemd is version 247. But %h expansion in user config is only available since systemd 256.1 (https://github.com/systemd/systemd/pull/26675).
So maybe you can try explicitly specifying the path here.
I don't think it will help, but it's something :)

BUT! While I was writing this, I noticed that ManagerEnvironment itself was added in version 248! So if you're really on 247, it can't work.

In this case, I suggest you try a drop-in file for the dbus, e.g.:
systemctl --user edit dbus
(add the following two lines as only uncommented ones):
[Service]
Environment="XDG_DATA_DIRS=/home/purism/.guix-profile/share"


  reply	other threads:[~2024-09-12 11:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-25 11:08 D-Bus service files on foreign distributions Roman Riabenko via
2024-08-26  8:27 ` Nils Landt
2024-09-11 18:57   ` Roman Riabenko via
2024-09-12 11:13     ` Nils Landt [this message]
2024-09-12 19:54       ` Roman Riabenko via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1883395578.670871.1726139597698@office.mailbox.org \
    --to=nils@landt.email \
    --cc=help-guix@gnu.org \
    --cc=roman@riabenko.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.