2023-07-25 22:19:40 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pkg-config
|
|
|
|
, gcc-arm-embedded
|
|
|
|
, readline
|
|
|
|
, bzip2
|
|
|
|
, openssl
|
|
|
|
, jansson
|
2024-03-07 02:48:33 +01:00
|
|
|
, gd
|
2023-07-25 22:19:40 +02:00
|
|
|
, whereami
|
|
|
|
, lua
|
2023-09-13 05:34:43 +02:00
|
|
|
, lz4
|
2023-07-25 22:19:40 +02:00
|
|
|
, Foundation
|
|
|
|
, AppKit
|
|
|
|
, withGui ? true, wrapQtAppsHook, qtbase
|
|
|
|
, withPython ? true, python3
|
|
|
|
, withBlueshark ? false, bluez5
|
|
|
|
, withGeneric ? false
|
|
|
|
, withSmall ? false
|
|
|
|
, withoutFunctions ? []
|
|
|
|
, hardwarePlatform ? if withGeneric then "PM3GENERIC" else "PM3RDV4"
|
|
|
|
, hardwarePlatformExtras ? lib.optionalString withBlueshark "BTADDON"
|
|
|
|
, standalone ? "LF_SAMYRUN"
|
|
|
|
}:
|
|
|
|
assert withBlueshark -> stdenv.hostPlatform.isLinux;
|
2024-03-07 02:48:33 +01:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2023-07-25 22:19:40 +02:00
|
|
|
pname = "proxmark3";
|
2024-03-21 10:34:58 +01:00
|
|
|
version = "4.18341";
|
2019-04-06 14:51:22 +02:00
|
|
|
|
2023-07-25 22:19:40 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "RfidResearchGroup";
|
|
|
|
repo = "proxmark3";
|
2024-03-07 02:48:33 +01:00
|
|
|
rev = "v${finalAttrs.version}";
|
2024-03-21 10:34:58 +01:00
|
|
|
hash = "sha256-YeBrrzCiDgl4WdhWYatm9sOAtBAECIv/f+OzB/RTdeg=";
|
2023-07-25 22:19:40 +02:00
|
|
|
};
|
2019-04-06 14:51:22 +02:00
|
|
|
|
2023-07-25 22:19:40 +02:00
|
|
|
patches = [
|
|
|
|
# Don't check for DISPLAY env variable on Darwin. pm3 uses this to test if
|
|
|
|
# XQuartz is installed, however it is not actually required for GUI features
|
|
|
|
./darwin-always-gui.patch
|
|
|
|
];
|
2019-04-06 14:51:22 +02:00
|
|
|
|
2023-07-25 22:19:40 +02:00
|
|
|
postPatch = ''
|
|
|
|
# Remove hardcoded paths on Darwin
|
|
|
|
substituteInPlace Makefile.defs \
|
|
|
|
--replace "/usr/bin/ar" "ar" \
|
|
|
|
--replace "/usr/bin/ranlib" "ranlib"
|
|
|
|
# Replace hardcoded path to libwhereami
|
|
|
|
substituteInPlace client/Makefile \
|
|
|
|
--replace "/usr/include/whereami.h" "${whereami}/include/whereami.h"
|
|
|
|
'';
|
2019-04-06 14:51:22 +02:00
|
|
|
|
2023-07-25 22:19:40 +02:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
gcc-arm-embedded
|
|
|
|
] ++ lib.optional withGui wrapQtAppsHook;
|
|
|
|
buildInputs = [
|
|
|
|
readline
|
|
|
|
bzip2
|
|
|
|
openssl
|
|
|
|
jansson
|
2024-03-07 02:48:33 +01:00
|
|
|
gd
|
2023-09-13 05:34:43 +02:00
|
|
|
lz4
|
2023-07-25 22:19:40 +02:00
|
|
|
whereami
|
|
|
|
lua
|
|
|
|
] ++ lib.optional withGui qtbase
|
|
|
|
++ lib.optional withPython python3
|
|
|
|
++ lib.optional withBlueshark bluez5
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ Foundation AppKit ];
|
2020-01-01 20:11:38 +01:00
|
|
|
|
2023-07-25 22:19:40 +02:00
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=${placeholder "out"}"
|
|
|
|
"UDEV_PREFIX=${placeholder "out"}/etc/udev/rules.d"
|
|
|
|
"PLATFORM=${hardwarePlatform}"
|
|
|
|
"PLATFORM_EXTRAS=${hardwarePlatformExtras}"
|
|
|
|
"STANDALONE=${standalone}"
|
|
|
|
"USE_BREW=0"
|
|
|
|
] ++ lib.optional withSmall "PLATFORM_SIZE=256"
|
|
|
|
++ map (x: "SKIP_${x}=1") withoutFunctions;
|
|
|
|
enableParallelBuilding = true;
|
2019-04-06 14:51:22 +02:00
|
|
|
|
2023-07-25 22:19:40 +02:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Client for proxmark3, powerful general purpose RFID tool";
|
|
|
|
homepage = "https://github.com/RfidResearchGroup/proxmark3";
|
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
maintainers = with maintainers; [ nyanotech emilytrau ];
|
|
|
|
platforms = platforms.unix;
|
2024-03-07 02:48:33 +01:00
|
|
|
mainProgram = "pm3";
|
2019-04-06 14:51:22 +02:00
|
|
|
};
|
2024-03-07 02:48:33 +01:00
|
|
|
})
|