14 , polkitSupport ? false
17 stdenv.mkDerivation rec {
21 outputs = [ "bin" "out" "dev" "doc" "man" ];
24 url = "https://pcsclite.apdu.fr/files/pcsc-lite-${version}.tar.bz2";
25 hash = "sha256-nuP5szNTdWIXeJNVmtT3uNXCPr6Cju9TBWwC2xQEnQg=";
28 patches = [ ./no-dropdir-literals.patch ];
32 -e "s@polkit_policy_dir=.*@polkit_policy_dir=$bin/share/polkit-1/actions@"
36 "--enable-confdir=/etc"
37 # The OS should care on preparing the drivers into this location
38 "--enable-usbdropdir=/var/lib/pcsc/drivers"
39 (lib.enableFeature stdenv.isLinux "libsystemd")
40 (lib.enableFeature polkitSupport "polkit")
41 ] ++ lib.optionals stdenv.isLinux [
42 "--enable-ipcdir=/run/pcscd"
43 "--with-systemdsystemunitdir=${placeholder "bin"}/lib/systemd/system"
47 sed -i -re '/^#define *PCSCLITE_HP_DROPDIR */ {
48 s/(DROPDIR *)(.*)/\1(getenv("PCSCLITE_HP_DROPDIR") ? : \2)/
53 # pcsc-spy is a debugging utility and it drags python into the closure
54 moveToOutput bin/pcsc-spy "$dev"
57 enableParallelBuilding = true;
59 nativeBuildInputs = [ autoreconfHook autoconf-archive pkg-config perl ];
61 buildInputs = [ python3 ]
62 ++ lib.optionals stdenv.isLinux [ systemdMinimal ]
63 ++ lib.optionals stdenv.isDarwin [ IOKit ]
64 ++ lib.optionals polkitSupport [ dbus polkit ];
67 description = "Middleware to access a smart card using SCard API (PC/SC)";
68 homepage = "https://pcsclite.apdu.fr/";
69 license = licenses.bsd3;
70 platforms = with platforms; unix;