summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/io/ios-deploy/package.nix
blob: ad7aed063795451e1ef4b35b9432e008dd6772f7 (plain)
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
{
  lib,
  stdenv,
  fetchFromGitHub,
  testers,
}:

let
  privateFrameworks = "/System/Library/PrivateFrameworks";
in
stdenv.mkDerivation (finalAttrs: {
  pname = "ios-deploy";
  version = "1.12.2";

  src = fetchFromGitHub {
    owner = "ios-control";
    repo = "ios-deploy";
    rev = finalAttrs.version;
    hash = "sha256-TVGC+f+1ow3b93CK3PhIL70le5SZxxb2ug5OkIg8XCA=";
  };

  buildPhase = ''
    runHook preBuild

    awk '{ print "\""$0"\\n\""}' src/scripts/lldb.py >> src/ios-deploy/lldb.py.h
    cp -RL ${privateFrameworks}/MobileDevice.framework MobileDevice.framework
    clang src/ios-deploy/ios-deploy.m \
      -framework Foundation \
      -F. -framework MobileDevice \
      -o ios-deploy

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    install -Dm755 ios-deploy $out/bin/ios-deploy

    runHook postInstall
  '';

  __impureHostDeps = [
    privateFrameworks
  ];

  passthru.tests.version = testers.testVersion {
    package = finalAttrs.finalPackage;
  };

  meta = {
    description = "Install and debug iPhone apps from the command line, without using Xcode";
    homepage = "https://github.com/ios-control/ios-deploy";
    license = lib.licenses.gpl3Plus;
    mainProgram = "ios-deploy";
    maintainers = with lib.maintainers; [ wegank ];
    platforms = lib.platforms.darwin;
  };
})