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