Skip to content

buildFHSUserEnvBubblewrap: mount vulkan ICDs - #135024

Closed
jonringer wants to merge 2 commits into
NixOS:masterfrom
jonringer:mount-icds-bubblewrap
Closed

jonringer wants to merge 2 commits into
NixOS:masterfrom
jonringer:mount-icds-bubblewrap

Conversation

@jonringer

@jonringer jonringer commented Aug 21, 2021 •

Copy link
Copy Markdown
Contributor
Motivation for this change

Another alternative solution to #130984, just mount the system ICDs (if they exist) at the default location. If there aren't any, then it will revert to the existing Mesa drivers brought in by steamfhs

This should inherit the behavior of the system, and avoid trying to load ICDs which may or may not exist.

overlaps with: #126435
may solve: #126428

closes: #134556

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Jonathan Ringer added 2 commits August 20, 2021 16:57
@github-actions github-actions Bot added the 6.topic: steam Steam game store/launcher (store.steampowered.com) label Aug 21, 2021
@ofborg ofborg Bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels Aug 21, 2021
@r-rmcgibbo

Copy link
Copy Markdown

Result of nixpkgs-review pr 135024 at 6a16856 run on x86_64-linux 1

57 packages skipped due to time constraints:
  • Sylk
  • altair
  • android-studio (androidStudioPackages.stable)
  • androidStudioPackages.beta
  • androidStudioPackages.canary
  • androidStudioPackages.dev
  • anki-bin
  • anytype
  • apple-music-electron
  • betterdiscord-installer
  • ...
7 packages built successfully:
  • kodiPackages.steam-launcher
  • protontricks
  • steam
  • steam-run
  • steam-run-native
  • steam-tui
  • steamcmd

@critbase

Copy link
Copy Markdown
Contributor

Oh cool, this looks like it might be a cleaner solution than my PR. I'll try and test this later.

Also, would the 32 bit files (under /run/opengl-driver-32) need to be mounted this way as well?

@jonringer

Copy link
Copy Markdown
Contributor Author

Oh cool, this looks like it might be a cleaner solution than my PR. I'll try and test this later.

Also, would the 32 bit files (under /run/opengl-driver-32) need to be mounted this way as well?

Currently no, The unfortunate reality is that the file is named the same nvidia_icd.json, so one will overwrite the other... We could start installing the drivers with the arch suffixed, similar to mesa which has radeon_icd.x86_64.json

@bendlas

bendlas commented Nov 24, 2021

Copy link
Copy Markdown
Contributor

Field report: with this patch applied (in particular 98014f0), Satisfactory doesn't start any more.

It pops up an error Dialog: Cannot find a compatible Vulkan driver (ICD).

That's with Proton-6.16-GE-1

@jonringer

Copy link
Copy Markdown
Contributor Author

Field report: with this patch applied (in particular 98014f0), Satisfactory doesn't start any more.

It pops up an error Dialog: Cannot find a compatible Vulkan driver (ICD).

That's with Proton-6.16-GE-1

Are you running an AMD, NVIDIA, or Intel GPU?

@bendlas

bendlas commented Nov 25, 2021

Copy link
Copy Markdown
Contributor

Are you running an AMD, NVIDIA, or Intel GPU?

Nvidia legacy 470: https://github.com/bendlas/nixos-config/blob/6f6d1c7e0ab1cf6f242d3be2afd5165b96c98803/nitox.nix#L108

$ uname -a
Linux nitox 5.10.80 #1-NixOS SMP Thu Nov 18 13:04:33 UTC 2021 x86_64 GNU/Linux

$ glxinfo
name of display: :0
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
server glx version string: 1.4
...
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 670/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 470.86
OpenGL core profile shading language version string: 4.60 NVIDIA
...

@Flakebi

Flakebi commented Nov 25, 2021

Copy link
Copy Markdown
Member

I’m not familiar with the steam sandboxes, but does Vulkan work on your host system? I.e.
Does vulkaninfo (from vulkan-tools) show your nvidia GPU?
And I assume there is an nvidia icd json in /run/opengl-driver/share/vulkan/icd.d/ that references some nvidia .so library in /nix/store?

@jonringer

Copy link
Copy Markdown
Contributor Author

And I assume there is an nvidia icd json in /run/opengl-driver/share/vulkan/icd.d/ that references some nvidia .so library in /nix/store?

Correct

$ cat /run/opengl-driver/share/vulkan/icd.d/nvidia_icd.json
{
    "file_format_version" : "1.0.0",
    "ICD": {
        "library_path": "/nix/store/spvqmp94b0i8wvbc3jr8bfj5lsr8i5yr-nvidia-x11-495.44-5.4.160/lib/libGLX_nvidia.so.0",
        "api_version" : "1.2.186"
    }
}

@jonringer

Copy link
Copy Markdown
Contributor Author

seems this is already the case:

[nix-shell:/home/jon/projects/nixpkgs]$ steam-run bash
(nix-shell) [14:32:55] jon@jon-desktop /home/jon/projects/nixpkgs (master)
$ cat /run/opengl-driver/share/vulkan/icd.d/nvidia_icd.json
{
    "file_format_version" : "1.0.0",
    "ICD": {
        "library_path": "/nix/store/spvqmp94b0i8wvbc3jr8bfj5lsr8i5yr-nvidia-x11-495.44-5.4.160/lib/libGLX_nvidia.so.0",
        "api_version" : "1.2.186"
    }
}

@smcv

smcv commented Feb 4, 2022

Copy link
Copy Markdown

The unfortunate reality is that the file is named the same nvidia_icd.json, so one will overwrite the other... We could start installing the drivers with the arch suffixed, similar to mesa which has radeon_icd.x86_64.json

For reference, in case this change gets resurrected as a result of ValveSoftware/Dota-2#2018, there are basically three ways to do multilib/multiarch Vulkan drivers:

  1. Have a JSON manifest per architecture with different names and optionally different content, like Mesa; or
  2. Arrange for the content to be literally identical, and only have one JSON manifest shared between architectures:
    a. reference the actual library by its SONAME only, like libGLX_nvidia.so.0, and then arrange for it to be findable via LD_LIBRARY_PATH or ld.so.cache, like the NVIDIA proprietary driver on e.g. Debian; or
    b. reference the actual library with special tokens that are expanded by ld.so, like /usr/${LIB}/libGLX_nvidia.so.0; or
  3. Use multiple directories, and set VK_ICD_FILENAMES or XDG_DATA_DIRS to force the search path

I agree that the way Mesa does it (option 1) is likely to be easiest for an OS distributor.

Option 2a might not be an option on NixOS in general, but for the FHS-like container that is used to run Steam, it could probably be made to work.

Option 2b might not work on NixOS, it depends how you configure glibc. It would only work if ${LIB} has different expansions for x86_64 and i386 loaders.

@jonringer

jonringer commented Mar 27, 2022 •

Copy link
Copy Markdown
Contributor Author

As a follow up, our buildFHSUserEnvBubblewrap (which steam uses) now uses XDG_DATA_DIRS to pass the share directory provided by NixOS's graphics installation path. This should no longer be an issue

Edit: Related PR #164206

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: steam Steam game store/launcher (store.steampowered.com) 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

steam/proton: missing icd files for nvidia

6 participants