Talk:Viber
Appearance
Latest comment: 15 July by Dusski in topic Fix for Missing Libraries (v27.3.0.2)
Viber on NixOS - Fix for Missing Libraries
Fix for Missing Libraries (v27.3.0.2)
Viber fails to launch on NixOS due to two issues: missing runtime libraries and a broken libxml2.so.2 symlink in the package.
Root Causes
1. Missing system libraries
Viber's NixOS package doesn't include several required runtime libraries (libxshmfence, libxcb-cursor, libxcb-util, pipewire).
2. Broken libxml2.so.2 symlink
The NixOS viber package creates a broken symlink:
opt/viber/lib/libxml2.so.2 -> /nix/store/.../libxml2-2.15.2/lib/libxml2.so
libxml2-2.15.2 only ships libxml2.so.16 (new ABI). Viber's bundled libQt6WebEngineCore.so.6 requires valuePush@@LIBXML2_2.4.30 from the old ABI, so it must be replaced with libxml2_13 (2.13.x).
Working Configuration
Replace pkgs.viber in environment.systemPackages with:
(pkgs.buildFHSEnv {
name = "viber";
targetPkgs = pkgs: [
(pkgs.viber.overrideAttrs (old: {
postFixup = (old.postFixup or "") + ''
rm -f $out/opt/viber/lib/libxml2.so.2
ln -s ${pkgs.libxml2_13.out}/lib/libxml2.so.2 $out/opt/viber/lib/libxml2.so.2
'';
}))
pkgs.libxshmfence
pkgs.libxcb-cursor
pkgs.xcbutil
pkgs.pipewire
];
runScript = "viber";
extraInstallCommands = ''
mkdir -p $out/share/applications
cp ${pkgs.viber}/share/applications/viber.desktop $out/share/applications/
sed -i "s|Exec=.*|Exec=viber %u|" $out/share/applications/viber.desktop
sed -i "s|Path=.*|Path=/opt/viber/|" $out/share/applications/viber.desktop
'';
})
Why each package is needed
| Package | Provides | Why needed |
|---|---|---|
pkgs.libxshmfence |
libxshmfence.so.1 |
Required by Viber's bundled Qt WebEngine |
pkgs.libxml2_13.out |
libxml2.so.2 (old ABI) |
Replaces broken symlink; Viber's Qt needs valuePush@@LIBXML2_2.4.30
|
pkgs.libxcb-cursor |
libxcb-cursor.so.0 |
Required by Qt 6.5+ xcb platform plugin |
pkgs.xcbutil |
libxcb-util.so.1 |
Required by Qt's xcb platform plugin (libQt6XcbQpa.so.6)
|
pkgs.pipewire |
libpipewire-0.3.so |
Qt multimedia audio support |
Important Notes
libxml2_13.outvslibxml2_13: The bare attribute resolves to the-binoutput which contains no.sofiles. Always use.out.xcb-utilvsxcbutil: Inside a NixOS config, usepkgs.xcbutil(no hyphen).nix eval nixpkgs#xcb-utilworks at the CLI butpkgs.xcb-utilin a config file does not.- Working directory:
bwrap(used bybuildFHSEnv) does not map/etc/nixosinside the sandbox. Launchviberfrom~, not from/etc/nixos.
What Didn't Work
| Approach | Why it failed |
|---|---|
programs.nix-ld.libraries |
Doesn't intercept library lookups for Viber's bundled libs |
steam-run viber |
Steam runtime doesn't include libxshmfence either
|
writeShellScriptBin with LD_LIBRARY_PATH |
Leaks into Viber's own bundled libs causing libxml2 version conflicts
|
pkgs.libxml2_13 (bare) |
Resolves to -bin output — symlink points nowhere
|
pkgs.xcb-util |
Attribute doesn't exist in pkgs set; correct name is pkgs.xcbutil
|