15 stdenv.mkDerivation rec {
19 src = fetchFromGitLab {
20 domain = "gitlab.freedesktop.org";
24 sha256 = "sha256-2U9JtpGyP4lbxtVJeP5GUgh5XthloPvFIw28+nldYx8=";
28 # Enable 64-bit file APIs on 32-bit systems:
29 # https://gitlab.freedesktop.org/glvnd/libglvnd/-/merge_requests/288
31 name = "large-file.patch";
32 url = "https://gitlab.freedesktop.org/glvnd/libglvnd/-/commit/956d2d3f531841cabfeddd940be4c48b00c226b4.patch";
33 hash = "sha256-Y6YCzd/jZ1VZP9bFlHkHjzSwShXeA7iJWdyfxpgT2l0=";
49 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
50 substituteInPlace src/GLX/Makefile.am \
51 --replace "-Wl,-Bsymbolic " ""
52 substituteInPlace src/EGL/Makefile.am \
53 --replace "-Wl,-Bsymbolic " ""
54 substituteInPlace src/GLdispatch/Makefile.am \
55 --replace "-Xlinker --version-script=$(VERSION_SCRIPT)" "-Xlinker"
58 env.NIX_CFLAGS_COMPILE = toString (
60 "-UDEFAULT_EGL_VENDOR_CONFIG_DIRS"
61 # FHS paths are added so that non-NixOS applications can find vendor files.
62 "-DDEFAULT_EGL_VENDOR_CONFIG_DIRS=\"${addDriverRunpath.driverLink}/share/glvnd/egl_vendor.d:/etc/glvnd/egl_vendor.d:/usr/share/glvnd/egl_vendor.d\""
64 "-Wno-error=array-bounds"
66 ++ lib.optionals stdenv.cc.isClang [
74 # Indirectly: https://bugs.freedesktop.org/show_bug.cgi?id=35268
75 ++ lib.optional stdenv.hostPlatform.isMusl "--disable-tls"
76 # Remove when aarch64-darwin asm support is upstream: https://gitlab.freedesktop.org/glvnd/libglvnd/-/issues/216
77 ++ lib.optional (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) "--disable-asm";
84 # Set RUNPATH so that libGLX can find driver libraries in /run/opengl-driver(-32)/lib.
85 # Note that libEGL does not need it because it uses driver config files which should
86 # contain absolute paths to libraries.
88 addDriverRunpath $out/lib/libGLX.so
91 passthru = { inherit (addDriverRunpath) driverLink; };
94 description = "GL Vendor-Neutral Dispatch library";
96 libglvnd is a vendor-neutral dispatch layer for arbitrating OpenGL API
97 calls between multiple vendors. It allows multiple drivers from different
98 vendors to coexist on the same filesystem, and determines which vendor to
99 dispatch each API call to at runtime.
100 Both GLX and EGL are supported, in any combination with OpenGL and OpenGL ES.
102 inherit (src.meta) homepage;
103 # https://gitlab.freedesktop.org/glvnd/libglvnd#libglvnd:
104 changelog = "https://gitlab.freedesktop.org/glvnd/libglvnd/-/tags/v${version}";
105 license = with licenses; [
112 platforms = platforms.unix;
113 # https://gitlab.freedesktop.org/glvnd/libglvnd/-/issues/212
114 badPlatforms = [ lib.systems.inspect.platformPatterns.isStatic ];
115 maintainers = with maintainers; [ primeos ];