D-Bus proxy-manager-thing sidecar for VMs
| nixosModules | ||
| sidebus-agent | ||
| sidebus-broker | ||
| sidebus-common | ||
| .envrc | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CONTRIBUTING.md | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE.md | ||
| README.md | ||
sidebus
(it.. runs as a "sidecar" to a VM.. but manages D-Bus.. get it?)
A cross-domain smart D-Bus proxying system that makes (some) XDG Desktop Portals work across virtual machines.
Design Overview
sidebus-brokerhost process:- to be launched alongside the VMM
- hosts a "private" bus for VM-instance-specific daemons such as permission-store and document-portal
- listens on vsock (or on a unix socket that muvm would proxy as vsock) and connects to the VM bus as a client when the agent connects
- orchestrates the lifecycle of the aforementioned daemons + virtiofsd
- (we are sharing the directory provided by the document-portal FUSE filesystem!)
- provides portal front-end interfaces like
org.freedesktop.portal.FileChooseron the VM bus- by proxying to the host session's xdg-desktop-portal!..
- (not talking directly to impls: don't want to reimplement per-DE portal selection; also 1:1 mapping is nicer to code)
- but with extra hooks like exposing files to the guest using our private (per-VM) document-portal!
- by proxying to the host session's xdg-desktop-portal!..
sidebus-agentguest process:- connects to the broker over vsock and splices the connection into the VM (session) bus
- can be spawned spawned on-demand by D-Bus
- uses systemd credentials for config args like vsock port
- (very convenient to pass via the VMM, e.g. qemu:
-smbios type=11,value=io.systemd.credential:sidebus.port=1337)
- (very convenient to pass via the VMM, e.g. qemu:
Development Notes
- the Nix flake provides paths to the daemons we run via environment variables.. conveniently, both in the release build and in the dev shell (so rust-analyzer doesn't complain)!
- the
--debug-accessflag ofsidebus-brokerallows for testing on the host, without needing to connect over vsock, e.g.:clear; rm /tmp/b/* ; mkdir -p /tmp/{b,r} ; RUST_LOG=debug cargo run --bin sidebus-broker -- --debug-access /tmp/b --vsock-port 1234 --runtime-dir /tmp/rGTK_A11Y=none DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/b/vm.sock ashpd-demo
Acknowledgments
Spectrum's work on a similar system has been very helpful during the development process.