summary refs log tree commit diff
path: root/flake.nix
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-07-03 16:21:22 -0700
committerIrene Knapp <ireneista@irenes.space>2026-07-03 16:21:22 -0700
commitd548bdcc43a947a1fbafe3d509668ca6f0e6d195 (patch)
tree3a4185df70b365410c329233559f11af51713cfb /flake.nix
parent428f5dd96f698f897489388d4033e4a2dce19bf2 (diff)
Vulkan debug messager (yay)
doesn't deal yet with the corner case of reporting errors to do with instance creation and destruction

Force-Push: yes
Change-Id: I6094d960081d8cd3123ae6fe46f77cb133948f39
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
+            ]));
       };
     });
   };