about summary refs log tree commit diff
path: root/pkgs/os-specific/darwin/ios-deploy/default.nix
blob: c405ac8e1c8bbc158ea58a092f118bac2574fb16 (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
{ lib
, stdenv
, fetchFromGitHub
, darwin
, testers
}:

let
  privateFrameworks = "/Library/Apple/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=";
  };

  buildInputs = [
    darwin.apple_sdk.frameworks.Foundation
  ];

  buildPhase = ''
    runHook preBuild

    awk '{ print "\""$0"\\n\""}' src/scripts/lldb.py >> src/ios-deploy/lldb.py.h
    clang src/ios-deploy/ios-deploy.m \
      -framework Foundation \
      -F${privateFrameworks} -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;
  };
})