1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 libusb-compat-0_1,
6 readline,
7 autoreconfHook,
8 pkg-config,
9}:
10
11stdenv.mkDerivation rec {
12 pname = "libnfc";
13 version = "1.8.0";
14
15 src = fetchFromGitHub {
16 owner = "nfc-tools";
17 repo = "libnfc";
18 rev = "libnfc-${version}";
19 sha256 = "5gMv/HajPrUL/vkegEqHgN2d6Yzf01dTMrx4l34KMrQ=";
20 };
21
22 nativeBuildInputs = [
23 # Note: Use autotools instead of cmake to build for darwin.
24 # When built with cmake, the following error occurs on real device like PN532:
25 # ```
26 # $ LIBNFC_DEVICE=pn532_uart:/dev/tty.usbserial-110 nfc-list
27 # nfc-list uses libnfc 1.8.0
28 # error libnfc.bus.uart Unable to set serial port speed to 115200 baud. Speed value must be one of those defined in termios(3).
29 # error libnfc.driver.pn532_uart pn53x_check_communication error
30 # nfc-list: ERROR: Unable to open NFC device: pn532_uart:/dev/tty.usbserial-110
31 # ```
32 autoreconfHook
33 pkg-config
34 ];
35
36 buildInputs = [
37 readline
38 ];
39
40 propagatedBuildInputs = [
41 libusb-compat-0_1
42 ];
43
44 configureFlags = [
45 "sysconfdir=/etc"
46 ];
47
48 meta = with lib; {
49 description = "Library for Near Field Communication (NFC)";
50 homepage = "https://github.com/nfc-tools/libnfc";
51 license = licenses.lgpl3Plus;
52 maintainers = with maintainers; [ offline ];
53 platforms = platforms.unix;
54 };
55}