Closed hollmmax closed 1 year ago
Thank you.
I'm really annoyed by this thing, it breaks every day or so. Do you have an idea about a more robust solution?
Not robust, I'm afraid.
But a solution would be to do what is already done for NVIDIA_JSON
, glob for nvidia*.json
and hope there's never more than 1 file.
I don't like it, but it should work at least now and I can't think of anything good.
Another option would be to check what files exist when calling nixNvidiaWrapper
, but that would be a lot of code for not much more stability.
I also need this on my system. I tried to figure out, what would be a more robust solution. One possibility is below. However, I don't think such complexity is necessary. The reason for the change in this PR is this nixpkgs commit, which is already in nixpkgs-22.05. Given that older nixpkgs versions are not supported, I think we can merge this. If we want to support older nixpkgs versions, something like the code below might be necessary.
diff --git a/nixGL.nix b/nixGL.nix
index 5274c6a..e0e55e3 100644
--- a/nixGL.nix
+++ b/nixGL.nix
@@ -62,6 +62,21 @@ let
kernel = null;
};
+ findSingleExistingPath = paths:
+ lib.findSingle builtins.pathExists
+ (throw "No path found") (throw "More than one path found")
+ paths;
+
+ vkIcdFilenameJson = findSingleExistingPath [
+ "${nvidiaLibsOnly}/share/vulkan/icd.d/nvidia_icd.json"
+ "${nvidiaLibsOnly}/share/vulkan/icd.d/nvidia_icd.x86_64.json"
+ ];
+
+ vkIcdFilenameJson32 = findSingleExistingPath [
+ "${nvidiaLibsOnly.lib32}/share/vulkan/icd.d/nvidia_icd.json"
+ "${nvidiaLibsOnly.lib32}/share/vulkan/icd.d/nvidia_icd.i686.json"
+ ];
+
nixGLNvidiaBumblebee = writeExecutable {
name = "nixGLNvidiaBumblebee-${version}";
text = ''
@@ -103,9 +118,9 @@ let
${
lib.optionalString (api == "Vulkan")
- ''export VK_ICD_FILENAMES=${nvidiaLibsOnly}/share/vulkan/icd.d/nvidia_icd.json${
+ ''export VK_ICD_FILENAMES=${vkIcdFilenameJson}${
lib.optionalString enable32bits
- ":${nvidiaLibsOnly.lib32}/share/vulkan/icd.d/nvidia_icd.json"
+ ":${vkIcdFilenameJson32}"
}"''${VK_ICD_FILENAMES:+:$VK_ICD_FILENAMES}"''
}
export LD_LIBRARY_PATH=${
Let's trust you.
This fixes #93 on Ubuntu 20.04.4 LTS for me.