2024-01-02 11:29:13 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, autoconf-archive
|
|
|
|
, autoreconfHook
|
|
|
|
, gobject-introspection
|
|
|
|
, makeWrapper
|
|
|
|
, pkg-config
|
2024-05-15 15:35:15 +00:00
|
|
|
, wrapGAppsHook3
|
|
|
|
, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
|
2024-09-26 11:04:55 +00:00
|
|
|
, dbusSupport ? stdenv.hostPlatform.isLinux, dbus
|
2024-01-02 11:29:13 +00:00
|
|
|
, pcsclite
|
|
|
|
, PCSC
|
|
|
|
, wget
|
|
|
|
, coreutils
|
|
|
|
, perlPackages
|
|
|
|
, testers
|
|
|
|
, nix-update-script
|
2024-05-15 15:35:15 +00:00
|
|
|
|
|
|
|
# gui does not cross compile properly
|
|
|
|
, withGui ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
|
2024-01-02 11:29:13 +00:00
|
|
|
}:
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
assert systemdSupport -> dbusSupport;
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
|
|
pname = "pcsc-tools";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "1.7.2";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "LudovicRousseau";
|
|
|
|
repo = "pcsc-tools";
|
|
|
|
rev = "refs/tags/${finalAttrs.version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-5a3sVcFEFzBkbRKUqlCPV7sL3O17G7hDVpxLpAWofdE=";
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--datarootdir=${placeholder "out"}/share"
|
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
buildInputs = lib.optionals dbusSupport [
|
|
|
|
dbus
|
|
|
|
] ++ [
|
|
|
|
perlPackages.perl pcsclite
|
2024-09-26 11:04:55 +00:00
|
|
|
] ++ lib.optional stdenv.hostPlatform.isDarwin PCSC
|
2024-05-15 15:35:15 +00:00
|
|
|
++ lib.optional systemdSupport systemd;
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
autoconf-archive
|
|
|
|
autoreconfHook
|
|
|
|
makeWrapper
|
|
|
|
pkg-config
|
2024-05-15 15:35:15 +00:00
|
|
|
] ++ lib.optionals withGui [
|
|
|
|
gobject-introspection
|
|
|
|
wrapGAppsHook3
|
2024-01-02 11:29:13 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
preFixup = ''
|
|
|
|
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/scriptor \
|
|
|
|
--set PERL5LIB "${with perlPackages; makePerlPath [ ChipcardPCSC libintl-perl ]}"
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
'' + lib.optionalString withGui ''
|
2024-01-02 11:29:13 +00:00
|
|
|
wrapProgram $out/bin/gscriptor \
|
|
|
|
''${makeWrapperArgs[@]} \
|
|
|
|
--set PERL5LIB "${with perlPackages; makePerlPath [
|
|
|
|
ChipcardPCSC
|
|
|
|
libintl-perl
|
|
|
|
GlibObjectIntrospection
|
|
|
|
Glib
|
|
|
|
Gtk3
|
|
|
|
Pango
|
|
|
|
Cairo
|
|
|
|
CairoGObject
|
|
|
|
]}"
|
2024-05-15 15:35:15 +00:00
|
|
|
'' + ''
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
wrapProgram $out/bin/ATR_analysis \
|
|
|
|
--set PERL5LIB "${with perlPackages; makePerlPath [ ChipcardPCSC libintl-perl ]}"
|
|
|
|
|
|
|
|
wrapProgram $out/bin/pcsc_scan \
|
|
|
|
--prefix PATH : "$out/bin:${lib.makeBinPath [ coreutils wget ]}"
|
|
|
|
|
|
|
|
install -Dm444 -t $out/share/pcsc smartcard_list.txt
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
tests.version = testers.testVersion {
|
|
|
|
package = finalAttrs.finalPackage;
|
|
|
|
command = "pcsc_scan -V";
|
|
|
|
};
|
|
|
|
updateScript = nix-update-script { };
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Tools used to test a PC/SC driver, card or reader";
|
|
|
|
homepage = "https://pcsc-tools.apdu.fr/";
|
|
|
|
changelog = "https://github.com/LudovicRousseau/pcsc-tools/releases/tag/${finalAttrs.version}";
|
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
mainProgram = "pcsc_scan";
|
|
|
|
maintainers = with maintainers; [ peterhoeg anthonyroussel ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
})
|