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).
76 lines
2.0 KiB
Nix
76 lines
2.0 KiB
Nix
{
|
|
description = "TeleportFling Development Environment";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils, ... }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
in
|
|
{
|
|
devShells.default = pkgs.mkShell {
|
|
inputsFrom = [];
|
|
nativeBuildInputs = with pkgs; [
|
|
go
|
|
golangci-lint
|
|
pkg-config
|
|
gopls
|
|
nixd
|
|
nodejs
|
|
gitea-mcp-server
|
|
];
|
|
buildInputs = with pkgs; [
|
|
git
|
|
direnv
|
|
nix-direnv
|
|
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";
|
|
|
|
shellHook = ''
|
|
echo "TeleportFling dev shell ready!"
|
|
'';
|
|
};
|
|
});
|
|
}
|