1{ lib
2, apksigner
3, bash
4, fetchFromGitHub
5, installShellFiles
6, pandoc
7, python3
8}:
9
10python3.pkgs.buildPythonApplication rec {
11 pname = "apksigcopier";
12 version = "1.1.1";
13
14 src = fetchFromGitHub {
15 owner = "obfusk";
16 repo = "apksigcopier";
17 rev = "refs/tags/v${version}";
18 sha256 = "sha256-VuwSaoTv5qq1jKwgBTKd1y9RKUzz89n86Z4UBv7Q51o=";
19 };
20
21 nativeBuildInputs = [
22 installShellFiles
23 pandoc
24 ];
25
26 propagatedBuildInputs = with python3.pkgs; [
27 click
28 ];
29
30 makeWrapperArgs = [
31 "--prefix"
32 "PATH"
33 ":"
34 "${lib.makeBinPath [ apksigner ]}"
35 ];
36
37 postPatch = ''
38 substituteInPlace Makefile \
39 --replace /bin/bash ${bash}/bin/bash
40 '';
41
42 postBuild = ''
43 make ${pname}.1
44 '';
45
46 postInstall = ''
47 installManPage ${pname}.1
48 '';
49
50 doInstallCheck = true;
51
52 installCheckPhase = ''
53 runHook preInstallCheck
54 $out/bin/apksigcopier --version | grep "${version}"
55 runHook postInstallCheck
56 '';
57
58 meta = with lib; {
59 description = "Copy/extract/patch android apk signatures & compare APKs";
60 longDescription = ''
61 apksigcopier is a tool for copying android APK signatures from a signed
62 APK to an unsigned one (in order to verify reproducible builds).
63 It can also be used to compare two APKs with different signatures.
64 Its command-line tool offers four operations:
65
66 * copy signatures directly from a signed to an unsigned APK
67 * extract signatures from a signed APK to a directory
68 * patch previously extracted signatures onto an unsigned APK
69 * compare two APKs with different signatures (requires apksigner)
70 '';
71 homepage = "https://github.com/obfusk/apksigcopier";
72 license = with licenses; [ gpl3Plus ];
73 maintainers = with maintainers; [ obfusk ];
74 };
75}