#
# Smartcard Emulation Tools
#
{ pkgs, autoconf264, autoreconfHook264, autoconf-archive, pkg-config, python3, pcsclite, libusb1, help2man, qrencode }:
pkgs.stdenv.mkDerivation rec {
  pname = "vsmartcard";
  version = "0.9";

  src = pkgs.fetchFromGitHub {
    owner = "frankmorgner";
    repo = pname;
    rev = "virtualsmartcard-${version}";
    sha256 = "sha256-ohvdC8Pz/HN2kfq8wVpB9EW6kkBCRCh0wvcgwMjHWcQ=";
  };

  nativeBuildInputs = [
   autoconf264
   autoreconfHook264
   pkg-config
   help2man
  ];

  buildInputs = [
    python3
    pcsclite
    libusb1
    qrencode
  ];

  propagatedBuildInputs = [
    python3.pkgs.pycryptodome
  ];

  preAutoreconf = ''
    cd virtualsmartcard
  '';

  meta = {
    description = "smart card emulation and relay tools";
    homepage = "https://frankmorgner.github.io/vsmartcard/virtualsmartcard";
    license = pkgs.lib.licenses.gpl2;
  };
}
