summary refs log tree commit diff
path: root/pkgs/development/tools/apksigcopier/default.nix
blob: 16cfbad52a07d0b169e6ce288b9cb075b1dedcf7 (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
{ lib
, fetchFromGitHub
, python3
, installShellFiles
, bash
, pandoc
}:

# FIXME: how to "recommend" apksigner like the Debian package?

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

  src = fetchFromGitHub {
    owner = "obfusk";
    repo = "apksigcopier";
    rev = "v${version}";
    sha256 = "07ldq3q1x2lpb15q5s5i1pbg89sn6ah45amskm9pndqlh16z9k2x";
  };

  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 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 = [ maintainers.obfusk ];
  };
}