New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix where Vulkan validation layer JSON files are placed by the nixpkgs install phase #38316
Conversation
a7746b1
to
714caad
Compare
I tested with nox-review after already creating this PR using
|
I think I know why these are installed into |
I also suggest rebasing this on staging, since quiet a lot of stuff needs to be rebuilt. |
@GrahamcOfBorg eval |
When vulkan tries to load validation layers, it looks for JSON files in several directories, one of which is: <vulkan-loader>/etc/vulkan/explicit_layer.d It does *not* look in: <vulkan-loader>/share/vulkan/explicit_layer.d Yet that is where the install phase of the vulkan-loader default.nix places the files. Thus, I modified the install phase to place them in the etc location instead.
I've made the suggested changes. Rebased onto staging, and added the creation of a /share symlink to /etc. I also removed a redundant mkdir of $out/lib. |
@infinisil Meh, Wine rebuild + libretro, you say like it is a big deal… But oh well, I don't want to ping-pong this PR between master and staging branches. |
@7c6f434c, thanks! |
Motivation for this change
When Vulkan looks for validation layers, it looks for JSON files in several directories. One of those directories is {vulkan-loader}/etc/vulkan/explicit_layer.d. This appears to be because {vulkan-loader}/etc is specified in SYSCONFDIR, which is used here in the Vulkan loader source. And according to the Vulkan loader's BUILD.md file: "You can further customize the installation directories by using the CMake variables CMAKE_INSTALL_SYSCONFDIR to rename the etc directory and CMAKE_INSTALL_DATADIR to rename the share directory". It seems pretty clear that the vulkan/explicit_layer.d folder should be in etc, not share.
As for how the current version seems to work already: A later folder that it checks for these JSON files (after it fails to find anything at {vulkan-loader}/etc/vulkan/explicit_layer.d) is {user-profile}/share/vulkan/explicit_layer.d. (No idea why it checks share instead of etc here, though.) When you install vulkan-loader via nix-env, it seems to also copy the files to that folder, which allows Vulkan to find them. However, in a context where you're running a nix-shell or nix-build without already having vulkan-loader installed via nix-env, it fails to find the files anywhere.
Things done
Changed the install phase to place vulkan/explicit_layer.d under {vulkan-loader}/etc instead of {vulkan-loader}/share.
Caveat: My only testing is that I ran vulkaninfo under nix-shell, with and without my change, and it worked (i.e. listed layers) only with my change. I also ran my own tutorial-based Vulkan program, built with a dependency on vulkan-loader, and it failed to find any installed validation layers until my fix was applied.
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
Test failed, but I don't think it has anything to do with my change. See below../result/bin/
)