summary refs log tree commit diff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix16
1 files changed, 15 insertions, 1 deletions
diff --git a/flake.nix b/flake.nix
index 702c355..a883414 100644
--- a/flake.nix
+++ b/flake.nix
@@ -26,6 +26,10 @@
         libxi
         libxkbcommon
         vulkan-loader
+
+        #   It might be nice to make this conditional; see also the patchelf
+        # call below.
+        vulkan-validation-layers
       ];
   in {
     packages = forAllSystems (system: let pkgs = nixpkgsFor.${system}; in {
@@ -39,6 +43,11 @@
         # This needs to apply only to the top-level derivation, not to the
         # dependencies.
         preFixup = ''
+          #   For whatever reason, Vulkan layers need to be added in a
+          # separate call before Vulkan itself is.
+          patchelf --add-needed libVkLayer_khronos_validation.so \
+                   $out/bin/surreality
+
           patchelf --add-needed libxkbcommon-x11.so \
                    --add-needed libvulkan.so.1 \
                    $out/bin/surreality
@@ -56,7 +65,12 @@
 
         #   This makes cargo run work; mind that you don't let it mask a
         # problem with the nix build.
-        LD_LIBRARY_PATH = "${pkgs.libxkbcommon}/lib:${pkgs.vulkan-loader}/lib";
+        LD_LIBRARY_PATH = pkgs.lib.join ":"
+            (pkgs.lib.map (pkg: "${pkg}/lib") (with pkgs; [
+              libxkbcommon
+              vulkan-loader
+              vulkan-validation-layers
+            ]));
       };
     });
   };