Repository navigation
build-aux: AppRun adds the NixOS driver libraries to nix-ld's path (#891) - #2436
Merged
Merged
Conversation
Under nix-ld (the AppImage run directly on NixOS, without appimage-run) OBS's loader searches NIX_LD_LIBRARY_PATH, which lacks /run/opengl-driver/lib, so obs-nvenc finds no libcuda.so.1 and NVENC is missing. The nixos case fails: obs has set:/nix/ld/default. Refs #891
Run directly on NixOS, OBS's loader is nix-ld, which searches only NIX_LD_LIBRARY_PATH. AppRun now appends /run/opengl-driver/lib when it exists and nix-ld is in use, so obs-nvenc finds libcuda.so.1 and libnvidia-encode.so.1. Checked on an RTX 3060 (driver 595.99.02): "NVENC not supported" before, NVENC 13.0 with H.264 and HEVC after. Refs #891
zackees
enabled auto-merge
October 26, 2026 02:49
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #891 (item 1 of the triage list: NVENC under nix-ld without
/run/opengl-driver/lib).Cause
Run directly on NixOS (not through
appimage-run), AppRun's host mode copies the host loader, and on NixOS that loader is nix-ld. nix-ld searches onlyNIX_LD_LIBRARY_PATH, which by default holds/run/current-system/sw/share/nix-ld/liband not the driver closure.obs-nvencloadslibcuda.so.1andlibnvidia-encode.so.1by soname, so on NixOS it finds neither.Fix
AppRun appends
/run/opengl-driver/libtoNIX_LD_LIBRARY_PATHwhen that directory exists and the variable is set, meaning nix-ld is in use. A value that already lists the directory is left alone, and so is an unset one. Only nix-ld reads this variable, so unlikeLD_LIBRARY_PATHit can't leak into host programs OBS starts. Appending keeps the user's entries first.Tests
test-apprun-driver-env.sh(run by ci.toml and bytest-appimage.sh) now checksNIX_LD_LIBRARY_PATHin each of its three namespace cases. Before the fix, the nixos case fails:expected set:/nix/ld/default:/run/opengl-driver/lib, obs has set:/nix/ld/default.Failed to initialize module 'obs-nvenc.so',NVENC not supported.[obs-nvenc] NVENC version: 13.0 (compiled) / 13.0 (driver), CUDA driver version: 13.20, withobs_nvenc_h264_texandobs_nvenc_hevc_texregistered.__EGL_VENDOR_LIBRARY_FILENAMES=.../50_mesa.json), because NVIDIA's EGL can't drive Xvfb. NVENC doesn't depend on the display.Not in this PR: #891's items 2 (
LIBGL_DRIVERS_PATHandONEVPL_SEARCH_PATH) and 3 (NixOS docs).Separately: started on a NixOS Wayland session, the same AppImage crashes in
xkb_keymap_newafterqt.qpa.wayland: failed to create xkb context, because NixOS has no/usr/share/X11/xkb. I'll file that on its own.