about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/apksigcopier/default.nix
blob: 13cb0300d7f8d3aed60eba9609d4edc344e6e6e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{ lib
, apksigner
, bash
, fetchFromGitHub
, installShellFiles
, pandoc
, python3
}:

python3.pkgs.buildPythonApplication rec {
  pname = "apksigcopier";
  version = "1.1.1";

  src = fetchFromGitHub {
    owner = "obfusk";
    repo = "apksigcopier";
    rev = "refs/tags/v${version}";
    sha256 = "sha256-VuwSaoTv5qq1jKwgBTKd1y9RKUzz89n86Z4UBv7Q51o=";
  };

  nativeBuildInputs = [
    installShellFiles
    pandoc
  ];

  propagatedBuildInputs = with python3.pkgs; [
    click
  ];

  makeWrapperArgs = [
    "--prefix"
    "PATH"
    ":"
    "${lib.makeBinPath [ apksigner ]}"
  ];

  postPatch = ''
    substituteInPlace Makefile \
      --replace /bin/bash ${bash}/bin/bash
  '';

  postBuild = ''
    make ${pname}.1
  '';

  postInstall = ''
    installManPage ${pname}.1
  '';

  doInstallCheck = true;

  installCheckPhase = ''
    runHook preInstallCheck
    $out/bin/apksigcopier --version | grep "${version}"
    runHook postInstallCheck
  '';

  meta = with lib; {
    description = "Copy/extract/patch android apk signatures & compare APKs";
    longDescription = ''
      apksigcopier is a tool for copying android 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 = with maintainers; [ obfusk ];
  };
}