My current setup on my personal laptop (integrated graphics) is Fedora with the Nix package manager, running Wayland. I have recently wanted to try programming immediate-mode GUIs via Gio and it was kind of a pain in the ass. Here's what worked for me.
First, I cloned the gio-examples repository so that I had something to test against...
Then, I use the following nix-shell configuration:
let
  pkgs = import <nixpkgs> {};
  nixgl = import <nixgl> {};
in
pkgs.mkShell {
  shellHook = ''
    export GOPATH="$(pwd)/.go"
    export GOCACHE=""
    export GO111MODULE='on'
  '';
  buildInputs = [
    pkgs.go
    pkgs.libxkbcommon
    pkgs.pkgconfig
    pkgs.egl-wayland
    pkgs.libGL
    pkgs.wayland
    # pkgs.xorg.libX11
    # pkgs.xorg.libXcursor
    # pkgs.xorg.libXfixes
    nixgl.auto.nixGLDefault
  ];
}
# NOTE: you may need to add this repo for the nix openGL wrapper:
# nix-channel --add https://github.com/guibou/nixGL/archive/main.tar.gz nixgl && nix-channel --update
This nix-shell configuration is the cumulation of many hours of trial, error, and Google.
Lessons learned:
pkg-config to link libraries (is that the right term?), you have to include pkg-config in your nix shell because the system pkg-config (fedora, in my case) won't look in the right spots.Place my nix-shell configuration somewhere, probably gio-examples/shell.nix. If you name it shell.nix then invoke nix-shell to shell into the new environment.
To run the hello example, this should get you going:
nixGL go run -tags nox11 hello.go
I'm sure this sucks even more if you have a discrete GPU, so my condolences go out to you if you are in that position.