nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 105 lines 2.6 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 pkg-config, 6 gcc-arm-embedded, 7 readline, 8 bzip2, 9 openssl, 10 jansson, 11 gd, 12 whereami, 13 lua, 14 lz4, 15 udevCheckHook, 16 withGui ? true, 17 wrapQtAppsHook, 18 qtbase, 19 withPython ? true, 20 python3, 21 withBlueshark ? false, 22 bluez5, 23 withGeneric ? false, 24 withSmall ? false, 25 withoutFunctions ? [ ], 26 hardwarePlatform ? if withGeneric then "PM3GENERIC" else "PM3RDV4", 27 hardwarePlatformExtras ? lib.optionalString withBlueshark "BTADDON", 28 standalone ? "LF_SAMYRUN", 29}: 30assert withBlueshark -> stdenv.hostPlatform.isLinux; 31stdenv.mkDerivation (finalAttrs: { 32 pname = "proxmark3"; 33 version = "4.20469"; 34 35 src = fetchFromGitHub { 36 owner = "RfidResearchGroup"; 37 repo = "proxmark3"; 38 rev = "v${finalAttrs.version}"; 39 hash = "sha256-Z87YCuNWQ66FTAq7qXUYKI25BEWrXD+YK0GczDmWc9A="; 40 }; 41 42 patches = [ 43 # Don't check for DISPLAY env variable on Darwin. pm3 uses this to test if 44 # XQuartz is installed, however it is not actually required for GUI features 45 ./darwin-always-gui.patch 46 ]; 47 48 postPatch = '' 49 # Remove hardcoded paths on Darwin 50 substituteInPlace Makefile.defs \ 51 --replace-fail "/usr/bin/ar" "ar" \ 52 --replace-fail "/usr/bin/ranlib" "ranlib" 53 # Replace hardcoded path to libwhereami 54 # Replace darwin sed syntax with gnused 55 substituteInPlace client/Makefile \ 56 --replace-fail "/usr/include/whereami.h" "${whereami}/include/whereami.h" \ 57 --replace-fail "sed -E -i '''" "sed -i" 58 ''; 59 60 nativeBuildInputs = [ 61 pkg-config 62 gcc-arm-embedded 63 udevCheckHook 64 ] 65 ++ lib.optional withGui wrapQtAppsHook; 66 buildInputs = [ 67 readline 68 bzip2 69 openssl 70 jansson 71 gd 72 lz4 73 whereami 74 lua 75 ] 76 ++ lib.optional withGui qtbase 77 ++ lib.optional withPython python3 78 ++ lib.optional withBlueshark bluez5; 79 80 makeFlags = [ 81 "PREFIX=${placeholder "out"}" 82 "UDEV_PREFIX=${placeholder "out"}/etc/udev/rules.d" 83 "PLATFORM=${hardwarePlatform}" 84 "PLATFORM_EXTRAS=${hardwarePlatformExtras}" 85 "STANDALONE=${standalone}" 86 "USE_BREW=0" 87 ] 88 ++ lib.optional withSmall "PLATFORM_SIZE=256" 89 ++ map (x: "SKIP_${x}=1") withoutFunctions; 90 enableParallelBuilding = true; 91 92 doInstallCheck = true; 93 94 meta = with lib; { 95 description = "Client for proxmark3, powerful general purpose RFID tool"; 96 homepage = "https://github.com/RfidResearchGroup/proxmark3"; 97 license = licenses.gpl3Plus; 98 maintainers = with maintainers; [ 99 nyanotech 100 emilytrau 101 ]; 102 platforms = platforms.unix; 103 mainProgram = "pm3"; 104 }; 105})