nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 138 lines 2.9 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 autoconf-archive, 6 autoreconfHook, 7 gobject-introspection, 8 makeWrapper, 9 pkg-config, 10 wrapGAppsHook3, 11 systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, 12 systemd, 13 dbusSupport ? stdenv.hostPlatform.isLinux, 14 dbus, 15 pcsclite, 16 wget, 17 coreutils, 18 perlPackages, 19 testers, 20 nix-update-script, 21 22 # gui does not cross compile properly 23 withGui ? stdenv.buildPlatform.canExecute stdenv.hostPlatform, 24}: 25 26assert systemdSupport -> dbusSupport; 27 28stdenv.mkDerivation (finalAttrs: { 29 pname = "pcsc-tools"; 30 version = "1.7.3"; 31 32 src = fetchFromGitHub { 33 owner = "LudovicRousseau"; 34 repo = "pcsc-tools"; 35 tag = finalAttrs.version; 36 hash = "sha256-pNTEiXAcT0NivDMIHGI+0VC9rKqLMc07yQB15mDWZhM="; 37 }; 38 39 configureFlags = [ 40 "--datarootdir=${placeholder "out"}/share" 41 ]; 42 43 buildInputs = 44 lib.optionals dbusSupport [ 45 dbus 46 ] 47 ++ [ 48 perlPackages.perl 49 pcsclite 50 ] 51 ++ lib.optional systemdSupport systemd; 52 53 nativeBuildInputs = [ 54 autoconf-archive 55 autoreconfHook 56 makeWrapper 57 pkg-config 58 ] 59 ++ lib.optionals withGui [ 60 gobject-introspection 61 wrapGAppsHook3 62 ]; 63 64 preFixup = '' 65 makeWrapperArgs+=("''${gappsWrapperArgs[@]}") 66 ''; 67 68 postInstall = '' 69 wrapProgram $out/bin/scriptor \ 70 --set PERL5LIB "${ 71 with perlPackages; 72 makePerlPath [ 73 ChipcardPCSC 74 libintl-perl 75 ] 76 }" 77 78 '' 79 + lib.optionalString withGui '' 80 wrapProgram $out/bin/gscriptor \ 81 ''${makeWrapperArgs[@]} \ 82 --set PERL5LIB "${ 83 with perlPackages; 84 makePerlPath [ 85 ChipcardPCSC 86 libintl-perl 87 GlibObjectIntrospection 88 Glib 89 Gtk3 90 Pango 91 Cairo 92 CairoGObject 93 ] 94 }" 95 '' 96 + '' 97 98 wrapProgram $out/bin/ATR_analysis \ 99 --set PERL5LIB "${ 100 with perlPackages; 101 makePerlPath [ 102 ChipcardPCSC 103 libintl-perl 104 ] 105 }" 106 107 wrapProgram $out/bin/pcsc_scan \ 108 --prefix PATH : "$out/bin:${ 109 lib.makeBinPath [ 110 coreutils 111 wget 112 ] 113 }" 114 115 install -Dm444 -t $out/share/pcsc smartcard_list.txt 116 ''; 117 118 passthru = { 119 tests.version = testers.testVersion { 120 package = finalAttrs.finalPackage; 121 command = "pcsc_scan -V"; 122 }; 123 updateScript = nix-update-script { }; 124 }; 125 126 meta = { 127 description = "Tools used to test a PC/SC driver, card or reader"; 128 homepage = "https://pcsc-tools.apdu.fr/"; 129 changelog = "https://github.com/LudovicRousseau/pcsc-tools/releases/tag/${finalAttrs.version}"; 130 license = lib.licenses.gpl2Plus; 131 mainProgram = "pcsc_scan"; 132 maintainers = with lib.maintainers; [ 133 peterhoeg 134 anthonyroussel 135 ]; 136 platforms = lib.platforms.unix; 137 }; 138})