about summary refs log tree commit diff
path: root/pkgs/development/tools/apksigcopier
diff options
context:
space:
mode:
authorFelix C. Stegerman <flx@obfusk.net>2021-07-04 18:38:15 +0200
committerFelix C. Stegerman <flx@obfusk.net>2021-07-04 18:38:15 +0200
commit1188245f1001b3a67595f58407f4b85c24d5a5fe (patch)
treef832bdea3a8927824bd386799f861ba967f387b8 /pkgs/development/tools/apksigcopier
parenta498577a2cce10751ee4b884edb910be97ae3ae2 (diff)
apksigcopier: init at 1.0.0
Diffstat (limited to 'pkgs/development/tools/apksigcopier')
-rw-r--r--pkgs/development/tools/apksigcopier/default.nix61
1 files changed, 61 insertions, 0 deletions
diff --git a/pkgs/development/tools/apksigcopier/default.nix b/pkgs/development/tools/apksigcopier/default.nix
new file mode 100644
index 0000000000000..972de479ee780
--- /dev/null
+++ b/pkgs/development/tools/apksigcopier/default.nix
@@ -0,0 +1,61 @@
+{ lib
+, fetchFromGitHub
+, python3
+, installShellFiles
+, bash
+, pandoc
+}:
+
+# FIXME: how to "recommend" apksigner like the Debian package?
+
+python3.pkgs.buildPythonApplication rec {
+  pname = "apksigcopier";
+  version = "1.0.0";
+
+  src = fetchFromGitHub {
+    owner = "obfusk";
+    repo = "apksigcopier";
+    rev = "v${version}";
+    sha256 = "1la1ml91jvqc1zakbqfpayjbs67pi3i18bsgz3mf11rxgphd3fpk";
+  };
+
+  nativeBuildInputs = [ installShellFiles pandoc ];
+  propagatedBuildInputs = with python3.pkgs; [ click ];
+  checkInputs = with python3.pkgs; [ flake8 mypy pylint ];
+
+  postPatch = ''
+    substituteInPlace Makefile \
+      --replace /bin/bash ${bash}/bin/bash \
+      --replace 'apksigcopier --version' '${python3.interpreter} apksigcopier --version'
+  '';
+
+  postBuild = ''
+    make ${pname}.1
+  '';
+
+  checkPhase = ''
+    make test
+  '';
+
+  postInstall = ''
+    installManPage ${pname}.1
+  '';
+
+  meta = with lib; {
+    description = "Copy/extract/patch apk signatures & compare apks";
+    longDescription = ''
+      apksigcopier is a tool for copying APK signatures from a signed APK
+      to an unsigned one (in order to verify reproducible builds).  It can
+      also be used to compare two APKs with different signatures.  Its
+      command-line tool offers four operations:
+
+      * copy signatures directly from a signed to an unsigned APK
+      * extract signatures from a signed APK to a directory
+      * patch previously extracted signatures onto an unsigned APK
+      * compare two APKs with different signatures (requires apksigner)
+    '';
+    homepage = "https://github.com/obfusk/apksigcopier";
+    license = with licenses; [ gpl3Plus ];
+    maintainers = [ maintainers.obfusk ];
+  };
+}