nixpkgs/pkgs/tools/security/pcsc-scm-scl011/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

49 lines
1.6 KiB
Nix

{ lib, stdenv, fetchurl, unzip, libusb-compat-0_1 }:
let
arch = if stdenv.hostPlatform.system == "i686-linux" then "32"
else if stdenv.hostPlatform.system == "x86_64-linux" then "64"
else throw "Unsupported system: ${stdenv.hostPlatform.system}";
in
stdenv.mkDerivation rec {
pname = "pcsc-scm-scl";
version = "2.09";
src = fetchurl {
url = "http://files.identiv.com/products/smart-card-readers/contactless/scl010-011/Linux_Driver_Ver${version}.zip";
sha256 = "0ik26sxgqgsqplksl87z61vwmx51k7plaqmrkdid7xidgfhfxr42";
};
buildInputs = [ unzip ];
unpackPhase = ''
unzip $src
tar xf "Linux Driver Ver${version}/sclgeneric_${version}_linux_${arch}bit.tar.gz"
export sourceRoot=$(readlink -e sclgeneric_${version}_linux_${arch}bit)
'';
# Add support for SCL011 nPA (subsidized model for German eID)
patches = [ ./eid.patch ];
installPhase = ''
mkdir -p $out/pcsc/drivers
cp -r proprietary/*.bundle $out/pcsc/drivers
'';
libPath = stdenv.lib.makeLibraryPath [ libusb-compat-0_1 ];
fixupPhase = ''
patchelf --set-rpath $libPath \
$out/pcsc/drivers/SCLGENERIC.bundle/Contents/Linux/libSCLGENERIC.so.${version};
'';
meta = with lib; {
description = "SCM Microsystems SCL011 chipcard reader user space driver";
homepage = "https://www.scm-pc-card.de/index.php?lang=en&page=product&function=show_product&product_id=630";
downloadPage = "https://support.identiv.com/scl010-scl011/";
license = licenses.unfreeRedistributable;
maintainers = with maintainers; [ sephalon ];
platforms = platforms.linux;
};
}