2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, pkg-config, udev, dbus, perl, python3
|
2020-04-24 23:36:52 +00:00
|
|
|
, IOKit ? null }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "pcsclite";
|
2021-03-09 03:18:52 +00:00
|
|
|
version = "1.9.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
outputs = [ "bin" "out" "dev" "doc" "man" ];
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://pcsclite.apdu.fr/files/pcsc-lite-${version}.tar.bz2";
|
2021-03-09 03:18:52 +00:00
|
|
|
sha256 = "sha256-c8R4m3h2qDOnD0k82iFlXf6FaJ2bfilwHCQyduVeaDo=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [ ./no-dropdir-literals.patch ];
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
# The OS should care on preparing the drivers into this location
|
|
|
|
"--enable-usbdropdir=/var/lib/pcsc/drivers"
|
|
|
|
"--enable-confdir=/etc"
|
2021-01-15 22:18:51 +00:00
|
|
|
] ++ lib.optional stdenv.isLinux
|
2020-04-24 23:36:52 +00:00
|
|
|
"--with-systemdsystemunitdir=\${out}/etc/systemd/system"
|
2021-01-15 22:18:51 +00:00
|
|
|
++ lib.optional (!stdenv.isLinux)
|
2020-04-24 23:36:52 +00:00
|
|
|
"--disable-libsystemd";
|
|
|
|
|
|
|
|
postConfigure = ''
|
|
|
|
sed -i -re '/^#define *PCSCLITE_HP_DROPDIR */ {
|
|
|
|
s/(DROPDIR *)(.*)/\1(getenv("PCSCLITE_HP_DROPDIR") ? : \2)/
|
|
|
|
}' config.h
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# pcsc-spy is a debugging utility and it drags python into the closure
|
|
|
|
moveToOutput bin/pcsc-spy "$dev"
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config perl ];
|
2021-01-15 22:18:51 +00:00
|
|
|
buildInputs = [ python3 ] ++ lib.optionals stdenv.isLinux [ udev dbus ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [ IOKit ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Middleware to access a smart card using SCard API (PC/SC)";
|
|
|
|
homepage = "https://pcsclite.apdu.fr/";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = with platforms; unix;
|
|
|
|
};
|
|
|
|
}
|