summary refs log tree commit diff
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2024-04-17 00:02:32 +0200
committerMel <einebeere@gmail.com>2024-04-17 00:02:32 +0200
commit97c6939a26b3d4dcac843030aa9911aff6b2e5f6 (patch)
treef40251278189f52e243531d0b1d1d34cae750a14
parentdc21ce532b56b56b1b60ff1bbe5726eff83e4dd5 (diff)
downloadmeowcraft-97c6939a26b3d4dcac843030aa9911aff6b2e5f6.tar.zst
meowcraft-97c6939a26b3d4dcac843030aa9911aff6b2e5f6.zip
Nix build Linux with Wayland
-rw-r--r--default.nix7
-rw-r--r--flake.nix12
2 files changed, 9 insertions, 10 deletions
diff --git a/default.nix b/default.nix
index 2c39828..e2e14cd 100644
--- a/default.nix
+++ b/default.nix
@@ -1,4 +1,4 @@
-{ lib, clangStdenv, meson, ninja, pkg-config, lld, glew, glfw, Cocoa, OpenGL, libX11, libXau, libXdmcp }:
+{ lib, clangStdenv, meson, ninja, pkg-config, lld, glew, glfw, Cocoa, OpenGL, wayland, wayland-protocols, libffi }:
 
 let
   stdenv = clangStdenv;
@@ -12,10 +12,7 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ meson ninja pkg-config lld ];
   buildInputs = [ glew glfw ]
     ++ lib.optionals stdenv.isDarwin [ Cocoa OpenGL ]
-    # TODO: Wayland support.
-    # NOTE: Also, even without Wayland, do we really need to link against libXau and
-    # libXdmcp of all things??
-    ++ lib.optionals stdenv.isLinux [ libX11 libXau libXdmcp ];
+    ++ lib.optionals stdenv.isLinux [ wayland wayland-protocols libffi ];
 
   mesonFlags = [
     "--buildtype=release"
diff --git a/flake.nix b/flake.nix
index 2124904..b13d1e9 100644
--- a/flake.nix
+++ b/flake.nix
@@ -27,10 +27,12 @@
       # NOTE: GLFW depends on OpenSSL and coreutils, which are very
       # large dependencies and have to be rebuilt from source to be able
       # to be linked statically. Maybe there is a way to avoid this?
-      glfw-static =  pkgs.glfw.overrideAttrs {
+      glfw-static =  (pkgs.glfw.overrideAttrs (oldAttrs: {
         pname = "glfw-static";
-        cmakeFlags = [ "-DBUILD_SHARED_LIBS=OFF" ];
-      };
+        cmakeFlags = oldAttrs.cmakeFlags ++ [
+          "-DBUILD_SHARED_LIBS=OFF"
+        ];
+      })).override { waylandSupport = pkgs.stdenv.isLinux; };
 
       glew-static =  pkgs.glew.overrideAttrs {
         pname = "glew-static";
@@ -52,8 +54,8 @@
           glfw-static glew-static
         ]) ++ lib.optionals stdenv.isDarwin (with darwinFrameworks; [
           Cocoa OpenGL
-        ]) ++ lib.optionals stdenv.isLinux (with pkgs.xorg; [
-          libX11 libXau libXdmcp
+        ]) ++ lib.optionals stdenv.isLinux (with pkgs; [
+          wayland wayland-protocols libffi
         ]);
       };
     });