mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-06 04:53:27 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
108 lines
2.6 KiB
Nix
108 lines
2.6 KiB
Nix
{ stdenv
|
|
, lib
|
|
, fetchFromGitHub
|
|
, autoconf-archive
|
|
, autoreconfHook
|
|
, gobject-introspection
|
|
, makeWrapper
|
|
, pkg-config
|
|
, wrapGAppsHook3
|
|
, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
|
|
, dbusSupport ? stdenv.hostPlatform.isLinux, dbus
|
|
, pcsclite
|
|
, PCSC
|
|
, wget
|
|
, coreutils
|
|
, 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.2";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "LudovicRousseau";
|
|
repo = "pcsc-tools";
|
|
rev = "refs/tags/${finalAttrs.version}";
|
|
hash = "sha256-5a3sVcFEFzBkbRKUqlCPV7sL3O17G7hDVpxLpAWofdE=";
|
|
};
|
|
|
|
configureFlags = [
|
|
"--datarootdir=${placeholder "out"}/share"
|
|
];
|
|
|
|
buildInputs = lib.optionals dbusSupport [
|
|
dbus
|
|
] ++ [
|
|
perlPackages.perl pcsclite
|
|
] ++ lib.optional stdenv.hostPlatform.isDarwin PCSC
|
|
++ lib.optional systemdSupport systemd;
|
|
|
|
nativeBuildInputs = [
|
|
autoconf-archive
|
|
autoreconfHook
|
|
makeWrapper
|
|
pkg-config
|
|
] ++ lib.optionals withGui [
|
|
gobject-introspection
|
|
wrapGAppsHook3
|
|
];
|
|
|
|
preFixup = ''
|
|
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
|
|
'';
|
|
|
|
postInstall = ''
|
|
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 [
|
|
ChipcardPCSC
|
|
libintl-perl
|
|
GlibObjectIntrospection
|
|
Glib
|
|
Gtk3
|
|
Pango
|
|
Cairo
|
|
CairoGObject
|
|
]}"
|
|
'' + ''
|
|
|
|
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;
|
|
};
|
|
})
|