Unverified Commit c873717c authored by Janik's avatar Janik Committed by GitHub
Browse files

Merge pull request #237551 from emilytrau/pm3-darwin

parents 14278609 f30598cd
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
}:
let
  libExt = stdenv.hostPlatform.extensions.sharedLibrary;
in
stdenv.mkDerivation rec {
  pname = "whereami";
  version = "unstable-2022-02-18";

  src = fetchFromGitHub {
    owner = "gpakosz";
    repo = pname;
    rev = "ba364cd54fd431c76c045393b6522b4bff547f50";
    sha256 = "XhRqW0wdXzlmyBf1cjqtQvztuyV4buxVl19Q0uyEOhk=";
  };

  makeFlags = [
    "-C_gnu-make"
    "build-library"
    "binsubdir=platform"
  ];

  installPhase = ''
    runHook preInstall

    mkdir -p $out/lib $out/include
    cp bin/platform/library${libExt} $out/lib/libwhereami${libExt}
    cp src/whereami.h $out/include/whereami.h

    runHook postInstall
  '';

  meta = with lib; {
    description = "Locate the current executable and running module/library";
    homepage = "https://github.com/gpakosz/whereami";
    license = with licenses; [ mit wtfpl ];
    maintainers = with maintainers; [ emilytrau ];
    platforms = platforms.all;
  };
}
+13 −0
Original line number Diff line number Diff line
diff --git a/client/src/proxmark3.c b/client/src/proxmark3.c
index 6c77bfad3..0d41a2d6b 100644
--- a/client/src/proxmark3.c
+++ b/client/src/proxmark3.c
@@ -1098,7 +1098,7 @@ int main(int argc, char *argv[]) {
 
 #ifdef HAVE_GUI
 
-#  if defined(_WIN32)
+#  if defined(_WIN32) || (defined(__MACH__) && defined(__APPLE__))
     InitGraphics(argc, argv, script_cmds_file, script_cmd, stayInCommandLoop);
     MainGraphics();
 #  else
+64 −16
Original line number Diff line number Diff line
{ lib, mkDerivation, fetchFromGitHub, pkg-config, gcc-arm-embedded, bluez5
{ lib
, stdenv
, fetchFromGitHub
, pkg-config
, gcc-arm-embedded
, readline

, hardwarePlatform ? "PM3RDV4"

, hardwarePlatformExtras ? "" }:

mkDerivation rec {
, bzip2
, openssl
, jansson
, whereami
, lua
, 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;
stdenv.mkDerivation rec {
  pname = "proxmark3-rrg";
  version = "4.16191";

@@ -16,23 +33,54 @@ mkDerivation rec {
    sha256 = "sha256-l0aDp0s9ekUUHqkzGfVoSIf/4/GN2uiVGL/+QtKRCOs=";
  };

  nativeBuildInputs = [ pkg-config gcc-arm-embedded ];
  buildInputs = [ bluez5 readline ];
  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
  ];

  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"
  '';

  nativeBuildInputs = [
    pkg-config
    gcc-arm-embedded
  ] ++ lib.optional withGui wrapQtAppsHook;
  buildInputs = [
    readline
    bzip2
    openssl
    jansson
    whereami
    lua
  ] ++ lib.optional withGui qtbase
    ++ lib.optional withPython python3
    ++ lib.optional withBlueshark bluez5
    ++ lib.optionals stdenv.hostPlatform.isDarwin [ Foundation AppKit ];

  makeFlags = [
    "PREFIX=${placeholder "out"}"
    "UDEV_PREFIX=${placeholder "out"}/etc/udev/rules.d"
    "PLATFORM=${hardwarePlatform}"
    "PLATFORM_EXTRAS=${hardwarePlatformExtras}"
  ];

  installPhase = ''
    install -Dt $out/bin client/proxmark3
    install -Dt $out/firmware bootrom/obj/bootrom.elf armsrc/obj/fullimage.elf
  '';
    "STANDALONE=${standalone}"
    "USE_BREW=0"
  ] ++ lib.optional withSmall "PLATFORM_SIZE=256"
    ++ map (x: "SKIP_${x}=1") withoutFunctions;
  enableParallelBuilding = true;

  meta = with lib; {
    description = "Client for proxmark3, powerful general purpose RFID tool";
    homepage = "https://rfidresearchgroup.com/";
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ nyanotech ];
    maintainers = with maintainers; [ nyanotech emilytrau ];
    platforms = platforms.unix;
  };
}
+5 −1
Original line number Diff line number Diff line
@@ -11646,7 +11646,9 @@ with pkgs;
  inherit (callPackages ../tools/security/proxmark3 { gcc-arm-embedded = gcc-arm-embedded-8; })
    proxmark3 proxmark3-unstable;
  proxmark3-rrg = libsForQt5.callPackage ../tools/security/proxmark3/proxmark3-rrg.nix { };
  proxmark3-rrg = libsForQt5.callPackage ../tools/security/proxmark3/proxmark3-rrg.nix {
    inherit (darwin.apple_sdk.frameworks) Foundation AppKit;
  };
  proxychains = callPackage ../tools/networking/proxychains { };
@@ -24860,6 +24862,8 @@ with pkgs;
  # bump when majoring of packages have updated
  webrtc-audio-processing = webrtc-audio-processing_0_3;
  whereami = callPackage ../development/libraries/whereami { };
  wildmidi = callPackage ../development/libraries/wildmidi { };
  wiredtiger = callPackage ../development/libraries/wiredtiger { };