about summary refs log tree commit diff
path: root/pkgs/tools/security/pcsc-tools/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/security/pcsc-tools/default.nix')
-rw-r--r--pkgs/tools/security/pcsc-tools/default.nix27
1 files changed, 19 insertions, 8 deletions
diff --git a/pkgs/tools/security/pcsc-tools/default.nix b/pkgs/tools/security/pcsc-tools/default.nix
index c479caa0a6137..371a159f8c618 100644
--- a/pkgs/tools/security/pcsc-tools/default.nix
+++ b/pkgs/tools/security/pcsc-tools/default.nix
@@ -6,9 +6,9 @@
 , gobject-introspection
 , makeWrapper
 , pkg-config
-, wrapGAppsHook
-, systemd
-, dbus
+, wrapGAppsHook3
+, 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,17 +38,21 @@ 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
-    wrapGAppsHook
+  ] ++ lib.optionals withGui [
+    gobject-introspection
+    wrapGAppsHook3
   ];
 
   preFixup = ''
@@ -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 ]}"