about summary refs log tree commit diff
path: root/pkgs/by-name/gl/glfw3/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/gl/glfw3/package.nix')
-rw-r--r--pkgs/by-name/gl/glfw3/package.nix42
1 files changed, 29 insertions, 13 deletions
diff --git a/pkgs/by-name/gl/glfw3/package.nix b/pkgs/by-name/gl/glfw3/package.nix
index 3d5050a8d46d..08a7aef50665 100644
--- a/pkgs/by-name/gl/glfw3/package.nix
+++ b/pkgs/by-name/gl/glfw3/package.nix
@@ -1,8 +1,23 @@
-{ stdenv, lib, fetchFromGitHub, cmake
-, libGL, libXrandr, libXinerama, libXcursor, libX11, libXi, libXext
-, darwin, fixDarwinDylibNames
-, extra-cmake-modules, wayland
-, wayland-scanner, wayland-protocols, libxkbcommon, libdecor
+{ stdenv
+, lib
+, fetchFromGitHub
+, cmake
+, pkg-config
+, libGL
+, vulkan-loader
+, libXrandr
+, libXinerama
+, libXcursor
+, libX11
+, libXi
+, libXext
+, darwin
+, fixDarwinDylibNames
+, wayland
+, wayland-scanner
+, wayland-protocols
+, libxkbcommon
+, libdecor
 , withMinecraftPatch ? false
 }:
 let
@@ -28,13 +43,13 @@ stdenv.mkDerivation {
 
   propagatedBuildInputs = lib.optionals (!stdenv.hostPlatform.isWindows) [ libGL ];
 
-  nativeBuildInputs = [ cmake extra-cmake-modules ]
-    ++ lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ]
-    ++ lib.optionals stdenv.isLinux [ wayland-scanner ];
+  nativeBuildInputs = [ cmake pkg-config ]
+    ++ lib.optionals stdenv.hostPlatform.isDarwin [ fixDarwinDylibNames ]
+    ++ lib.optionals stdenv.hostPlatform.isLinux [ wayland-scanner ];
 
   buildInputs =
-    lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ Carbon Cocoa Kernel ])
-    ++ lib.optionals stdenv.isLinux [
+    lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [ Carbon Cocoa Kernel ])
+    ++ lib.optionals stdenv.hostPlatform.isLinux [
       wayland
       wayland-protocols
       libxkbcommon
@@ -48,12 +63,13 @@ stdenv.mkDerivation {
 
   cmakeFlags = [
     "-DBUILD_SHARED_LIBS=ON"
-  ] ++ lib.optionals (!stdenv.isDarwin && !stdenv.hostPlatform.isWindows) [
+  ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isWindows) [
     "-DCMAKE_C_FLAGS=-D_GLFW_GLX_LIBRARY='\"${lib.getLib libGL}/lib/libGL.so.1\"'"
     "-DCMAKE_C_FLAGS=-D_GLFW_EGL_LIBRARY='\"${lib.getLib libGL}/lib/libEGL.so.1\"'"
+    "-DCMAKE_C_FLAGS=-D_GLFW_VULKAN_LIBRARY='\"${lib.getLib vulkan-loader}/lib/libvulkan.so.1\"'"
   ];
 
-  postPatch = lib.optionalString stdenv.isLinux ''
+  postPatch = lib.optionalString stdenv.hostPlatform.isLinux ''
     substituteInPlace src/wl_init.c \
       --replace-fail "libxkbcommon.so.0" "${lib.getLib libxkbcommon}/lib/libxkbcommon.so.0" \
       --replace-fail "libdecor-0.so.0" "${lib.getLib libdecor}/lib/libdecor-0.so.0" \
@@ -63,7 +79,7 @@ stdenv.mkDerivation {
   '';
 
   # glfw may dlopen libwayland-client.so:
-  postFixup = lib.optionalString stdenv.isLinux ''
+  postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
     patchelf ''${!outputLib}/lib/libglfw.so --add-rpath ${lib.getLib wayland}/lib
   '';