Skip to content

build-aux: AppRun points libxkbcommon at the host's keyboard data (#2437) - #2439

Merged
zackees merged 2 commits into
masterfrom
fix/2437-nixos-xkb
Oct 26, 2026
Merged

zackees merged 2 commits into
masterfrom
fix/2437-nixos-xkb

Conversation

@zackees

@zackees zackees commented Oct 26, 2026

Copy link
Copy Markdown
Member

Refs #2437

Cause

The bundled libxkbcommon looks for keyboard data only in its compiled default, /usr/share/X11/xkb. NixOS keeps the data at /etc/X11/xkb and doesn't set XKB_CONFIG_ROOT. On a NixOS KDE Wayland session, Qt logged failed to create xkb context and then crashed in xkb_keymap_new (backtrace on #2437).

Fix

AppRun sets XKB_CONFIG_ROOT when the variable is unset and /usr/share/X11/xkb is missing. It uses the first of /etc/X11/xkb and /run/current-system/sw/share/X11/xkb that exists. A user's value, and any host with the standard directory, are left alone.

Tests

  • RED 7e87b70: test-apprun-driver-env.sh checks XKB_CONFIG_ROOT in each namespace case. The expectation follows the host: only a host without /usr/share/X11/xkb should get the variable. On a NixOS host, before the fix: FAIL [nixos] XKB_CONFIG_ROOT: expected set:/etc/X11/xkb, obs has unset, and the same for none. On Ubuntu CI the check passes either way, since the standard directory exists there.
  • GREEN 1916e37: all three cases pass on NixOS.
  • Packaged app on NixOS, private headless weston 15 (the master AppImage bb253a0):
    • Unchanged AppRun: xkbcommon: ERROR: failed to add default include path /usr/share/X11/xkb and qt.qpa.wayland: failed to create xkb context.
    • Patched AppRun: neither message, and OBS ran the full 20 s on Platform: Wayland.

Not verified: headless weston sends no keyboard keymap, so the crash itself (in xkb_keymap_new) isn't reached there. Checking that needs a Wayland session with a keyboard, which is why this says Refs.

The bundled libxkbcommon looks only in /usr/share/X11/xkb, which NixOS
does not have, and Qt's Wayland plugin crashed without an xkb context.
On this NixOS host the nixos and none cases fail: expected
set:/etc/X11/xkb, obs has unset.

Refs #2437
When XKB_CONFIG_ROOT is unset and /usr/share/X11/xkb is missing, AppRun
sets it to /etc/X11/xkb or /run/current-system/sw/share/X11/xkb, the
first that exists. On NixOS Wayland the bundled libxkbcommon found no
keyboard data and Qt's Wayland plugin crashed in xkb_keymap_new.

Refs #2437
@zackees
zackees enabled auto-merge October 26, 2026 02:55
@zackees
zackees added this pull request to the merge queue Oct 26, 2026
Merged via the queue into master with commit 8cc1972 Oct 26, 2026
31 checks passed
rdoupe pushed a commit to rdoupe/obs-studio that referenced this pull request Oct 26, 2026
appimage-run, or directly through nix-ld with hardware.graphics and
Wayland in nix-ld's libraries. The driver libraries and keyboard data
need no setup since obs-rust#2436 and obs-rust#2439.

Refs obs-rust#891
rdoupe pushed a commit to rdoupe/obs-studio that referenced this pull request Oct 26, 2026
obs-rust#2439's (obs-rust#2441)

obs-rust#2438 and obs-rust#2439 fixed obs-rust#2437 independently and merged a minute apart. Master
had two XKB_CONFIG_ROOT blocks in AppRun, two features ledger lines, and two
checks in test-apprun-driver-env.sh. The user case preset the variable twice
with different values, so one check always failed:
  FAIL [user] XKB_CONFIG_ROOT: expected set:/user/selected/XKB_CONFIG_ROOT,
  obs has set:/user/selected/xkb
This reverts obs-rust#2438 (6eeb47d). obs-rust#2439's code, check and ledger line stay.
@zackees
zackees deleted the fix/2437-nixos-xkb branch October 26, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant