From 51c7525a649cb24dd12d6e686a32150ab5cf4631 Mon Sep 17 00:00:00 2001
From: Eldritch Cookie <eldritch.cookie@disroot.org>
Date: Fri, 12 Jan 2024 14:42:21 -0300
Subject: [PATCH] libepoxy: added test for pkg-config modules

---
 pkgs/development/libraries/libepoxy/default.nix | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/pkgs/development/libraries/libepoxy/default.nix b/pkgs/development/libraries/libepoxy/default.nix
index cd98e2229fe2..9fab4c72947e 100644
--- a/pkgs/development/libraries/libepoxy/default.nix
+++ b/pkgs/development/libraries/libepoxy/default.nix
@@ -11,13 +11,14 @@
 , Carbon
 , OpenGL
 , x11Support ? !stdenv.isDarwin
+, testers
 }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   pname = "libepoxy";
   version = "1.5.10";
 
-  src = fetchFromGitHub {
+  src = with finalAttrs; fetchFromGitHub {
     owner = "anholt";
     repo = pname;
     rev = version;
@@ -58,7 +59,7 @@ stdenv.mkDerivation rec {
   mesonFlags = [
     "-Degl=${if (x11Support && !stdenv.isDarwin) then "yes" else "no"}"
     "-Dglx=${if x11Support then "yes" else "no"}"
-    "-Dtests=${lib.boolToString doCheck}"
+    "-Dtests=${lib.boolToString finalAttrs.doCheck}"
     "-Dx11=${lib.boolToString x11Support}"
   ];
 
@@ -66,6 +67,12 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
+  passthru.tests = {
+    pkg-config = testers.hasPkgConfigModules {
+      package = finalAttrs.finalPackage;
+    };
+  };
+
   meta = with lib; {
     description = "A library for handling OpenGL function pointer management";
     homepage = "https://github.com/anholt/libepoxy";
@@ -74,4 +81,4 @@ stdenv.mkDerivation rec {
     platforms = platforms.unix;
     pkgConfigModules = [ "epoxy" ];
   };
-}
+})