From 79beeefdc79350be88f68ea9aa0439698165cbd8 Mon Sep 17 00:00:00 2001 From: Peter Edley Date: Fri, 18 Sep 2026 20:32:40 +0100 Subject: [PATCH] build: add Fyne/GLFW native deps to dev shell Add libGL, mesa, wayland, libxkbcommon and the X client libraries the Fyne cgo toolchain links against, plus LIBRARY_PATH so Go's linker finds them (it does not read NIX_LDFLAGS). --- flake.nix | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/flake.nix b/flake.nix index 23b36fc..0e49382 100644 --- a/flake.nix +++ b/flake.nix @@ -30,12 +30,39 @@ libjpeg_turbo pipewire xdg-desktop-portal + # Fyne / GLFW (cgo) native dependencies. + libGL + mesa + wayland + libxkbcommon + libX11 + libXrandr + libXi + libXcursor + libXinerama + libXxf86vm ]; # Make turbojpeg resolve via pkg-config for cgo builds. PKG_CONFIG_PATH = "${pkgs.libjpeg_turbo.dev}/lib/pkgconfig"; LD_LIBRARY_PATH = "${pkgs.libjpeg_turbo.out}/lib"; + # Fyne/GLFW link against X11, Wayland, GL and misc libs. Go's cgo + # linker does not read NIX_LDFLAGS, so expose the runtime lib dirs + # via LIBRARY_PATH for the link step. + LIBRARY_PATH = with pkgs; lib.makeLibraryPath [ + libGL + mesa + wayland + libxkbcommon + libX11 + libXrandr + libXi + libXcursor + libXinerama + libXxf86vm + ]; + # Nix's libspa-0.2.pc emits -fno-strict-aliasing/-fno-strict-overflow # which Go's cgo rejects unless explicitly allowed. CGO_CFLAGS_ALLOW = "-fno-strict-overflow|-fno-strict-aliasing";