pcsclite: Introduce PCSCLITE_HP_DROPDIR env var

This allows to override the directory where PCSC-Lite searches for USB
drivers at runtime and should make our NixOS module much more clean so
that we don't need to imperatively stitch together plugin directories
anymore.

I'm using a GNU extension for the ternary operator to avoid computing
getenv("PCSCLITE_HP_DROPDIR") twice:

https://gcc.gnu.org/onlinedocs/gcc/Conditionals.html#Conditionals

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @viric, @wkennington
This commit is contained in:
aszlig
2016-06-04 16:38:57 +02:00
parent 9a154e2838
commit 70246d7cfa
2 changed files with 81 additions and 0 deletions
+8
View File
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
sha256 = "12k8q0ckyy1fqcfh7x0b7kfrlfiscrqaqmidcggnzs4pi2iqml77";
};
patches = [ ./no-dropdir-literals.patch ];
configureFlags = [
# The OS should care on preparing the drivers into this location
"--enable-usbdropdir=/var/lib/pcsc/drivers"
@@ -15,6 +17,12 @@ stdenv.mkDerivation rec {
] ++ stdenv.lib.optional stdenv.isLinux
"--with-systemdsystemunitdir=\${out}/etc/systemd/system";
postConfigure = ''
sed -i -re '/^#define *PCSCLITE_HP_DROPDIR */ {
s/(DROPDIR *)(.*)/\1(getenv("PCSCLITE_HP_DROPDIR") ? : \2)/
}' config.h
'';
nativeBuildInputs = [ pkgconfig perl python2 ];
buildInputs = stdenv.lib.optionals stdenv.isLinux [ udev dbus_libs ];