[Nix-dev] DBus and XMonad
Rodney Lorrimar
dev at rodney.id.au
Wed Oct 19 12:53:09 CEST 2016
Hello List,
I've recently had some troubles starting up my gnome3 + XMonad desktop
session.
My first problem was that Taffybar and xmonad.hs were unable connect to
DBus with the following error:
connectSession: DBUS_SESSION_BUS_ADDRESS is missing or invalid.
The value of DBUS_SESSION_BUS_ADDRESS probably came from dbus-launch:
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-jp8hFEY1dV,guid=c6e01dc144bda2ae4ca47c84580747a5;unix:abstract=/tmp/dbus-BjlHWWC2xz,guid=3733c1a431ad4cb309cc622a580747a5
I'm not quite sure why the dbus socket was unavailable, but my solution
was to enable services.dbus.socketActivated in configuration.nix.
An additional problem is that the haskell-dbus library won't check the
socket $XDG_RUNTIME_DIR/bus after the connection fails using
DBUS_SESSION_BUS_ADDRESS. So my workaround is to change the environment
before connecting:
let bus d = "unix:path=" ++ d ++ "/bus"
maddr <- fmap bus <$> lookupEnv "XDG_RUNTIME_DIR"
case maddr of
Just addr -> setEnv "DBUS_SESSION_BUS_ADDRESS" addr
Nothing -> return ()
This allows me to start xmonad and taffybar.
My next problem is that gnome-terminal will no longer start:
dbus-daemon[6158]: Activating via systemd: service name='org.gnome.Terminal' unit='gnome-terminal-server.service'
dbus-daemon[6158]: Activation via systemd failed for unit 'gnome-terminal-server.service': Unit gnome-terminal-server.service not found.
I have found that this is due to
https://github.com/NixOS/nixpkgs/issues/19110
My workaround for that problem is simply:
ln -vsf /run/current-system/sw/lib/systemd/user/* ~/.config/systemd/user
Now I have a working desktop session again. I have posted this in case
anyone else has similar difficulties.
In future, having a socket-activated dbus would allow the NixOS xsession
script to be partly replaced by systemd. I think that could be quite
exciting.
Cheers,
Rodney
More information about the nix-dev
mailing list