about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-02-12 14:19:43 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-02-13 10:21:07 -0500
commit205293d8a97e10576119f1424e87382ab82c888c (patch)
tree7356c96a77f230f6c8c750e20c1550cb468003fd
parent14cb2130bb78b96853e576d21ea823b1b19f39de (diff)
downloadnixlib-205293d8a97e10576119f1424e87382ab82c888c.tar
nixlib-205293d8a97e10576119f1424e87382ab82c888c.tar.gz
nixlib-205293d8a97e10576119f1424e87382ab82c888c.tar.bz2
nixlib-205293d8a97e10576119f1424e87382ab82c888c.tar.lz
nixlib-205293d8a97e10576119f1424e87382ab82c888c.tar.xz
nixlib-205293d8a97e10576119f1424e87382ab82c888c.tar.zst
nixlib-205293d8a97e10576119f1424e87382ab82c888c.zip
hidapi: Add `meta.pkgConfigModules` and test
-rw-r--r--pkgs/development/libraries/hidapi/default.nix15
1 files changed, 12 insertions, 3 deletions
diff --git a/pkgs/development/libraries/hidapi/default.nix b/pkgs/development/libraries/hidapi/default.nix
index b29b64c2a757..e9bfe33e9f48 100644
--- a/pkgs/development/libraries/hidapi/default.nix
+++ b/pkgs/development/libraries/hidapi/default.nix
@@ -7,16 +7,17 @@
 , udev
 , Cocoa
 , IOKit
+, testers
 }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   pname = "hidapi";
   version = "0.12.0";
 
   src = fetchFromGitHub {
     owner = "libusb";
     repo = "hidapi";
-    rev = "${pname}-${version}";
+    rev = "${finalAttrs.pname}-${finalAttrs.version}";
     sha256 = "sha256-SMhlcB7LcViC6UFVYACjunxsGkvSOKC3mbLBH4XQSzM=";
   };
 
@@ -28,12 +29,20 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = lib.optionals stdenv.isDarwin [ Cocoa IOKit ];
 
+  passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+
   meta = with lib; {
     description = "Library for communicating with USB and Bluetooth HID devices";
     homepage = "https://github.com/libusb/hidapi";
     maintainers = with maintainers; [ prusnak ];
     # You can choose between GPLv3, BSD or HIDAPI license (even more liberal)
     license = with licenses; [ bsd3 /* or */ gpl3Only ] ;
+    pkgConfigModules = lib.optionals stdenv.isDarwin [
+      "hidapi"
+    ] ++ lib.optionals stdenv.isLinux [
+      "hidapi-hidraw"
+      "hidapi-libusb"
+    ];
     platforms = platforms.unix;
   };
-}
+})