diff --git a/pkgs/tools/security/pcsc-tools/default.nix b/pkgs/tools/security/pcsc-tools/default.nix index c479caa0a613..d2cb57bd485f 100644 --- a/pkgs/tools/security/pcsc-tools/default.nix +++ b/pkgs/tools/security/pcsc-tools/default.nix @@ -7,8 +7,8 @@ , makeWrapper , pkg-config , wrapGAppsHook -, systemd -, dbus +, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd +, dbusSupport ? stdenv.isLinux, dbus , pcsclite , PCSC , wget @@ -16,8 +16,13 @@ , perlPackages , testers , nix-update-script + +# gui does not cross compile properly +, withGui ? stdenv.buildPlatform.canExecute stdenv.hostPlatform }: +assert systemdSupport -> dbusSupport; + stdenv.mkDerivation (finalAttrs: { pname = "pcsc-tools"; version = "1.7.1"; @@ -33,16 +38,20 @@ stdenv.mkDerivation (finalAttrs: { "--datarootdir=${placeholder "out"}/share" ]; - buildInputs = [ dbus perlPackages.perl pcsclite ] - ++ lib.optional stdenv.isDarwin PCSC - ++ lib.optional stdenv.isLinux systemd; + buildInputs = lib.optionals dbusSupport [ + dbus + ] ++ [ + perlPackages.perl pcsclite + ] ++ lib.optional stdenv.isDarwin PCSC + ++ lib.optional systemdSupport systemd; nativeBuildInputs = [ autoconf-archive autoreconfHook - gobject-introspection makeWrapper pkg-config + ] ++ lib.optionals withGui [ + gobject-introspection wrapGAppsHook ]; @@ -54,6 +63,7 @@ stdenv.mkDerivation (finalAttrs: { wrapProgram $out/bin/scriptor \ --set PERL5LIB "${with perlPackages; makePerlPath [ ChipcardPCSC libintl-perl ]}" + '' + lib.optionalString withGui '' wrapProgram $out/bin/gscriptor \ ''${makeWrapperArgs[@]} \ --set PERL5LIB "${with perlPackages; makePerlPath [ @@ -66,6 +76,7 @@ stdenv.mkDerivation (finalAttrs: { Cairo CairoGObject ]}" + '' + '' wrapProgram $out/bin/ATR_analysis \ --set PERL5LIB "${with perlPackages; makePerlPath [ ChipcardPCSC libintl-perl ]}" diff --git a/pkgs/tools/security/pcsclite/default.nix b/pkgs/tools/security/pcsclite/default.nix index 1a5d9badf3c7..b078ee737bd9 100644 --- a/pkgs/tools/security/pcsclite/default.nix +++ b/pkgs/tools/security/pcsclite/default.nix @@ -10,6 +10,10 @@ , dbus , polkit , systemdLibs +, dbusSupport ? stdenv.isLinux +, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemdLibs +, udevSupport ? dbusSupport +, libusb1 , IOKit , testers , nix-update-script @@ -17,6 +21,9 @@ , polkitSupport ? false }: +assert polkitSupport -> dbusSupport; +assert systemdSupport -> dbusSupport; + stdenv.mkDerivation (finalAttrs: { inherit pname; version = "2.1.0"; @@ -35,11 +42,13 @@ stdenv.mkDerivation (finalAttrs: { "--enable-confdir=/etc" # The OS should care on preparing the drivers into this location "--enable-usbdropdir=/var/lib/pcsc/drivers" - (lib.enableFeature stdenv.isLinux "libsystemd") + (lib.enableFeature systemdSupport "libsystemd") (lib.enableFeature polkitSupport "polkit") - ] ++ lib.optionals stdenv.isLinux [ "--enable-ipcdir=/run/pcscd" + ] ++ lib.optionals systemdSupport [ "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system" + ] ++ lib.optionals (!udevSupport) [ + "--disable-libudev" ]; makeFlags = [ @@ -70,9 +79,11 @@ stdenv.mkDerivation (finalAttrs: { ]; buildInputs = [ python3 ] - ++ lib.optionals stdenv.isLinux [ systemdLibs ] + ++ lib.optionals systemdSupport [ systemdLibs ] ++ lib.optionals stdenv.isDarwin [ IOKit ] - ++ lib.optionals polkitSupport [ dbus polkit ]; + ++ lib.optionals dbusSupport [ dbus ] + ++ lib.optionals polkitSupport [ polkit ] + ++ lib.optionals (!udevSupport) [ libusb1 ]; passthru = { tests = { diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index d2f882832c3b..34b4ca3b7916 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -3312,6 +3312,9 @@ with self; { "-Wno-error=implicit-int" "-Wno-error=int-conversion" ]); + postPatch = '' + substituteInPlace Makefile.PL --replace pkg-config $PKG_CONFIG + ''; NIX_CFLAGS_LINK = "-L${lib.getLib pkgs.pcsclite}/lib -lpcsclite"; # tests fail; look unfinished doCheck = false;