Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv 2, lib 3, fetchurl 4, autoreconfHook 5, autoconf-archive 6, pkg-config 7, perl 8, python3 9, dbus 10, polkit 11, systemdMinimal 12, IOKit 13, pname ? "pcsclite" 14, polkitSupport ? false 15}: 16 17stdenv.mkDerivation rec { 18 inherit pname; 19 version = "1.9.5"; 20 21 outputs = [ "bin" "out" "dev" "doc" "man" ]; 22 23 src = fetchurl { 24 url = "https://pcsclite.apdu.fr/files/pcsc-lite-${version}.tar.bz2"; 25 hash = "sha256-nuP5szNTdWIXeJNVmtT3uNXCPr6Cju9TBWwC2xQEnQg="; 26 }; 27 28 patches = [ ./no-dropdir-literals.patch ]; 29 30 postPatch = '' 31 sed -i configure.ac \ 32 -e "s@polkit_policy_dir=.*@polkit_policy_dir=$bin/share/polkit-1/actions@" 33 ''; 34 35 configureFlags = [ 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" 44 ]; 45 46 postConfigure = '' 47 sed -i -re '/^#define *PCSCLITE_HP_DROPDIR */ { 48 s/(DROPDIR *)(.*)/\1(getenv("PCSCLITE_HP_DROPDIR") ? : \2)/ 49 }' config.h 50 ''; 51 52 postInstall = '' 53 # pcsc-spy is a debugging utility and it drags python into the closure 54 moveToOutput bin/pcsc-spy "$dev" 55 ''; 56 57 enableParallelBuilding = true; 58 59 nativeBuildInputs = [ autoreconfHook autoconf-archive pkg-config perl ]; 60 61 buildInputs = [ python3 ] 62 ++ lib.optionals stdenv.isLinux [ systemdMinimal ] 63 ++ lib.optionals stdenv.isDarwin [ IOKit ] 64 ++ lib.optionals polkitSupport [ dbus polkit ]; 65 66 meta = with lib; { 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; 71 }; 72}