bug: non-nixos-gpu with Nvidia missing `libnvidia-egl-*.so` and Wayland libraries
bugtriage
### Are you following the right branch?
- [x] My Nixpkgs and Home Manager versions are in sync
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Issue description
In my home.nix I have:
```
targets.genericLinux.enable = true;
targets.genericLinux.gpu.nvidia = {
enable = true;
version = "610.43.02";
sha256 = "sha256-MDSgVLtM33dS/43CclZMsQVROAS/9TU4lFkBsWyndGM=";
};
```
While it satisfies most GUI programs, several still have problems.
For example, OBS Studio cannot capture screen, and emits such messages:
```
...
info: ---------------------------------
info: Initializing OpenGL...
info: Using EGL/Wayland
libEGL warning: pci id for fd 27: 10de:1e84, driver (null)
pci id for fd 13: 10de:1e84, driver (null)
pci id for fd 28: 10de:1e84, driver (null)
libEGL warning: egl: failed to create dri2 screen
pci id for fd 13: 10de:1e84, driver (null)
pci id for fd 28: 10de:1e84, driver (null)
libEGL warning: egl: failed to create dri2 screen
info: Initialized EGL 1.5
warning: Unable to open DRM render node.
info: Loading up OpenGL on adapter Mesa llvmpipe (LLVM 21.1.8, 256 bits)
info: OpenGL loaded successfully, version 4.6 (Core Profile) Mesa 26.1.2, shading language 4.60
info: ---------------------------------
...
info: ------------------------------------------------
info: Loaded scenes:
info: - scene 'Scene':
info: - source: 'Wayland output(dmabuf)' (wlrobs-dmabuf)
info: ------------------------------------------------
info: Device for 'Audio Output Capture' source Desktop Audio is also used for audio monitoring.
Deduplication logic is being applied to all monitored sources.
error: Cannot create EGLImage: Arguments are inconsistent (for example, a valid context requires buffers not supplied by a valid surface).
error: A sprite cannot be drawn without a width/height
...
error: Cannot create EGLImage: Arguments are inconsistent (for example, a valid context requires buffers not supplied by a valid surface).
error: A sprite cannot be drawn without a width/height
info: ==== Shutting down ==================================================
```
For investigation I've used a less verbose program: `imv`
* It emits the same libEGL warnings like OBS:
```
+$ imv
libEGL warning: pci id for fd 7: 10de:1e84, driver (null)
pci id for fd 6: 10de:1e84, driver (null)
pci id for fd 8: 10de:1e84, driver (null)
libEGL warning: egl: failed to create dri2 screen
pci id for fd 6: 10de:1e84, driver (null)
pci id for fd 8: 10de:1e84, driver (null)
libEGL warning: egl: failed to create dri2 screen
Reading paths from stdin...
```
* But they disappear when running with `WAYLAND_DISPLAY` environment variable cleared:
```
+$ WAYLAND_DISPLAY= imv
Reading paths from stdin...
```
* Running them via [nix-gl-host](https://github.com/numtide/nix-gl-host) also helps:
```
+$ nixglhost -d /usr/lib imv
Reading paths from stdin...
+$ nixglhost -d /usr/lib obs # can capture screen
...
```
Browsing `$XDG_CACHE_HOME/nix-gl-host` directory, I can see it containing files:
```
+$ find . -name 'libwayland*' -or -name 'libnvidia-egl-*' -or -name '*wayland.json'
./<hash>/egl/libnvidia-egl-gbm.so
./<hash>/egl/libnvidia-egl-gbm.so.1.1.3
./<hash>/egl/libnvidia-egl-wayland.so.1
./<hash>/egl/libnvidia-egl-wayland.so.1.1.21
./<hash>/egl/libnvidia-egl-gbm.so.1
./<hash>/egl/libnvidia-egl-wayland.so
./<hash>/lib/libwayland-server.so.0
./<hash>/lib/libwayland-client.so.0.25.0
./<hash>/lib/libwayland-server.so
./<hash>/lib/libwayland-client.so.0
./<hash>/lib/libwayland-client.so
./<hash>/lib/libwayland-server.so.0.25.0
./egl-confs/10_nvidia_wayland.json
```
which are nowhere present under `/run/opengl-driver` directory.
### Maintainer CC
@exzombie
### System information
```markdown
`$ nix shell nixpkgs#nix-info --command nix-info -m`:
- system: `"x86_64-linux"`
- host os: `Linux 7.0.12-arch1-1, Arch Linux, noversion, rolling`
- multi-user?: `no`
- sandbox: `yes`
- version: `nix-env (Nix) 2.34.7`
- nixpkgs: `not found`
```
0 条评论