From 682fed51612706e7cc9e425e65a57153c826957a Mon Sep 17 00:00:00 2001 From: elsirion Date: Fri, 31 May 2024 12:02:46 +0200 Subject: [PATCH] fix: support wayland in nix dev shell iced wants to load a dynamic library for wayland, which doesn't work on nix if it's not explicitly put into the path. See: https://github.com/rust-windowing/winit/issues/3244#issuecomment-1827827667 --- flake.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 2163c12..0d18cba 100644 --- a/flake.nix +++ b/flake.nix @@ -15,6 +15,7 @@ let overlays = [ rust-overlay.overlays.default ]; pkgs = import nixpkgs { inherit system overlays; }; + lib = pkgs.lib; rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; inputs = [ rust @@ -57,8 +58,15 @@ }; - devShell = pkgs.mkShell { + devShell = pkgs.mkShell rec { packages = inputs; + buildInputs = with pkgs; [ + libxkbcommon + libGL + # WINIT_UNIX_BACKEND=wayland + wayland + ]; + LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}"; shellHook = '' export LIBCLANG_PATH=${pkgs.libclang.lib}/lib/ export LD_LIBRARY_PATH=${pkgs.openssl}/lib:$LD_LIBRARY_PATH