summary refs log tree commit diff
path: root/pkgs/tools/security
diff options
context:
space:
mode:
authorFranz Pletz <fpletz@fnordicwalking.de>2020-01-01 20:11:38 +0100
committerFranz Pletz <fpletz@fnordicwalking.de>2020-01-01 20:13:58 +0100
commitf197a51583ecb5f021fa60b86cc120bdae2769d7 (patch)
tree0e9249a8e3f6ec0370d2f49d52e8dd1ca7657299 /pkgs/tools/security
parent3c974c71cd221cb7a0435613e5208a98341ef4a6 (diff)
downloadnixpkgs-f197a51583ecb5f021fa60b86cc120bdae2769d7.tar
nixpkgs-f197a51583ecb5f021fa60b86cc120bdae2769d7.tar.gz
nixpkgs-f197a51583ecb5f021fa60b86cc120bdae2769d7.tar.bz2
nixpkgs-f197a51583ecb5f021fa60b86cc120bdae2769d7.tar.lz
nixpkgs-f197a51583ecb5f021fa60b86cc120bdae2769d7.tar.xz
nixpkgs-f197a51583ecb5f021fa60b86cc120bdae2769d7.tar.zst
nixpkgs-f197a51583ecb5f021fa60b86cc120bdae2769d7.zip
proxmark3: refactor & init unstable at 2019-12-28
Diffstat (limited to 'pkgs/tools/security')
-rw-r--r--pkgs/tools/security/proxmark3/default.nix78
1 files changed, 50 insertions, 28 deletions
diff --git a/pkgs/tools/security/proxmark3/default.nix b/pkgs/tools/security/proxmark3/default.nix
index afaed796057..e717558a24d 100644
--- a/pkgs/tools/security/proxmark3/default.nix
+++ b/pkgs/tools/security/proxmark3/default.nix
@@ -1,37 +1,59 @@
-{ stdenv, fetchFromGitHub, pkgconfig, ncurses, readline }:
+{ stdenv, fetchFromGitHub, pkgconfig, ncurses, readline, pcsclite, qt5
+, gcc-arm-embedded }:
 
-stdenv.mkDerivation rec {
-  pname = "proxmark3";
-  version = "3.1.0";
+let
+  generic = { pname, version, rev, sha256 }:
+    stdenv.mkDerivation rec {
+      inherit pname version;
 
-  src = fetchFromGitHub {
-    owner = "Proxmark";
-    repo = pname;
-    rev = "v${version}";
-    sha256 = "1qw28n1bhhl91ix77lv50qcr919fq3hjc8zhhqphwxal2svgx2jf";
-  };
+      src = fetchFromGitHub {
+        owner = "Proxmark";
+        repo = "proxmark3";
+        inherit rev sha256;
+      };
+
+      nativeBuildInputs = [ pkgconfig gcc-arm-embedded ];
+      buildInputs = [ ncurses readline pcsclite qt5.qtbase ];
 
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ ncurses readline ];
+      postPatch = ''
+        substituteInPlace client/Makefile --replace '-ltermcap' ' '
+        substituteInPlace liblua/Makefile --replace '-ltermcap' ' '
+        substituteInPlace client/flasher.c \
+          --replace 'armsrc/obj/fullimage.elf' \
+                    '${placeholder "out"}/firmware/fullimage.elf'
+      '';
 
-  postPatch = ''
-    substituteInPlace client/Makefile --replace '-ltermcap' ' '
-    substituteInPlace liblua/Makefile --replace '-ltermcap' ' '
-  '';
+      buildPhase = ''
+        make bootrom/obj/bootrom.elf armsrc/obj/fullimage.elf client
+      '';
 
-  preBuild = ''
-    cd client
-  '';
+      installPhase = ''
+        install -Dt $out/bin client/proxmark3
+        install -T client/flasher $out/bin/proxmark3-flasher
+        install -Dt $out/firmware bootrom/obj/bootrom.elf armsrc/obj/fullimage.elf
+      '';
 
-  installPhase = ''
-    mkdir -p $out/bin
-    cp proxmark3 $out/bin
-  '';
+      meta = with stdenv.lib; {
+        description = "Client for proxmark3, powerful general purpose RFID tool";
+        homepage = http://www.proxmark.org;
+        license = licenses.gpl2Plus;
+        maintainers = with maintainers; [ fpletz ];
+      };
+    };
+in
+
+{
+  proxmark3 = generic rec {
+    pname = "proxmark3";
+    version = "3.1.0";
+    rev = "v${version}";
+    sha256 = "1qw28n1bhhl91ix77lv50qcr919fq3hjc8zhhqphwxal2svgx2jf";
+  };
 
-  meta = with stdenv.lib; {
-    description = "Client for proxmark3,  powerful general purpose RFID tool";
-    homepage = http://www.proxmark.org;
-    license = licenses.gpl2Plus;
-    maintainers = with maintainers; [ fpletz ];
+  proxmark3-unstable = generic {
+    pname = "proxmark3-unstable";
+    version = "2019-12-28";
+    rev = "a4ff62be63ca2a81071e9aa2b882bd3ff57f13ad";
+    sha256 = "067lp28xqx61n3i2a2fy489r5frwxqrcfj8cpv3xdzi3gb3vk5c3";
   };
 }