I trying to get a VPN client running on NixOS. The binaries have all their dependencies resolved and the application runs, but it reports that it cannot connect to the D-Bus session bus:
2020-04-10,15:21:02:223, 10685,10685,, 1, /LinuxService.h, 75, bool f5::qt::setupDBusService(f5::qt::CustomQApplication&), Cannot connect to session bus
Here’s my expression:
{ stdenv
, dpkg
, makeWrapper
, buildFHSUserEnv
, glib
, libGL
, libxml2
, libxslt
, fontconfig
, freetype
, sqlite
, libICE
, libSM
, libXcomposite
, libXi
, libXrender
, xkeyboard_config
}:
let
f5vpn-dpkg = stdenv.mkDerivation {
name = "f5vpn-dpkg";
src = ./linux_f5vpn.x86_64.deb;
nativeBuildInputs = [
dpkg
makeWrapper
xkeyboard_config
];
dontConfigure = true;
dontBuild = true;
sourceRoot = ".";
unpackCmd = ''dpkg -x $src $out'';
installPhase = ''
makeWrapper \
$out/opt/f5/vpn/f5vpn \
$out/bin/f5vpn \
--prefix "QT_XKB_CONFIG_ROOT" ":" "${xkeyboard_config}/share/X11/xkb"
mkdir -p $out/share/applications
cp $out/opt/f5/vpn/com.f5.f5vpn.desktop $out/share/applications
substituteInPlace \
$out/share/applications/com.f5.f5vpn.desktop \
--replace "/opt/f5/vpn/f5vpn" "$out/bin/f5vpn"
mkdir -p $out/share/dbus-1/services
cp $out/opt/f5/vpn/com.f5.f5vpn.service $out/share/dbus-1/services
substituteInPlace \
$out/share/dbus-1/services/com.f5.f5vpn.service \
--replace "/opt/f5/vpn/f5vpn" "$out/bin/f5vpn"
'';
preFixup = ''
patchelf --remove-rpath $out/opt/f5/vpn/f5vpn
patchelf --set-rpath $out/opt/f5/vpn/lib $out/opt/f5/vpn/f5vpn
'';
};
in
buildFHSUserEnv {
name = "f5vpn-fhs";
targetPkgs = pkgs: [
f5vpn-dpkg
pkgs.glib
pkgs.libGL
pkgs.libxml2
pkgs.libxslt
pkgs.fontconfig
pkgs.freetype
pkgs.sqlite
pkgs.xorg.libICE
pkgs.xorg.libSM
pkgs.xorg.libX11
pkgs.xorg.libxcb
pkgs.xorg.libXcomposite
pkgs.xorg.libXext
pkgs.xorg.libXi
pkgs.xorg.libXrender
pkgs.zlib
];
runScript = "f5vpn";
}
I went for buildFHSUserEnv
because I can see that it relies on some absolute paths when I run it on Ubuntu, but the same thing happens if I build it with autoPatchelfHook
.
It’s worth mentioning that with steam-run
, the application actually gets past the session bus point, but there are other issues (eventually a segfault), and I really don’t want to go down that road without understanding why it won’t work in my own FHS sandbox.
I also tried using the Qt-specific mkDerivation
(as outlined in Nixpkgs 23.11 manual | Nix & NixOS), but I cannot see how that would matter since I already resolved the dependencies. It didn’t make a difference anyway.
Any ideas? Are there any differences in how NixOS handles D-Bus compared to other distros?