From 787ca12b1e32c8dbf0ccc16136c214372f369acf Mon Sep 17 00:00:00 2001 From: Val Packett Date: Fri, 12 Dec 2025 05:10:52 -0300 Subject: [PATCH] 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.. --- nixosModules/default.nix | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/nixosModules/default.nix b/nixosModules/default.nix index e81cde8..813a1f9 100644 --- a/nixosModules/default.nix +++ b/nixosModules/default.nix @@ -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;