Start sidebus-agent strictly before the apps

Gtk uses G_DBUS_CALL_FLAGS_NO_AUTO_START in all the (early) portal calls
so we basically get a version of https://gitlab.gnome.org/GNOME/gtk/-/issues/7379
if we try to lazily start the agent..
This commit is contained in:
Val Packett 2025-12-12 05:10:52 -03:00
parent f336a0d5ff
commit 787ca12b1e

View file

@ -301,19 +301,25 @@ in
description = "D-Bus session bus";
requires = [ "session-bus.socket" ];
serviceConfig = {
ImportCredential = "sidebus.port"; # inherited by the activated agent..
ExecStart = "${pkgs.dbus}/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --syslog-only"; # no systemd activation, we don't run a *session* systemd
User = "appvm";
Group = "appvm";
};
};
services.dbus.packages = [
(pkgs.writeTextDir "/share/dbus-1/services/org.freedesktop.portal.Desktop.service" ''
[D-BUS Service]
Name=org.freedesktop.portal.Desktop
Exec=${sidebus.packages.${system}.sidebus-agent}/bin/sidebus-agent
'')
];
systemd.services.sidebus-agent = {
enable = true;
description = "D-Bus session bus";
wantedBy = ["microvm.target"];
requires = ["session-bus.socket" "session-bus.service"];
after = ["session-bus.service"];
serviceConfig = {
ImportCredential = "sidebus.port";
Environment = ["DBUS_SESSION_BUS_ADDRESS=unix:path=${runtimeDir}/dbus.sock"];
ExecStart = "${sidebus.packages.${system}.sidebus-agent}/bin/sidebus-agent";
User = "appvm";
Group = "appvm";
};
};
hardware.graphics.enable = true;
hardware.graphics.package = self.packages.${system}.mesa;