about summary refs log tree commit diff
path: root/pkgs/development/tools/xcodes/default.nix
blob: a7449aa08651cc2909ee5ea6ff6e57e88022d340 (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
, stdenv
, fetchFromGitHub
, swift
, swiftpm
, swiftpm2nix
, makeWrapper
, CryptoKit
, LocalAuthentication
, libcompression
, aria2
}:
let
  generated = swiftpm2nix.helpers ./generated;
in
stdenv.mkDerivation (finalAttrs: {
  pname = "xcodes";
  version = "1.4.1";

  src = fetchFromGitHub {
    owner = "XcodesOrg";
    repo = finalAttrs.pname;
    rev = finalAttrs.version;
    hash = "sha256-ARrSQ9ozM90Yg7y4WdU7jjNQ64sXHuhxZh/iNJcFfY0=";
  };

  nativeBuildInputs = [ swift swiftpm makeWrapper ];

  buildInputs = [
    CryptoKit
    LocalAuthentication
    libcompression
  ];

  configurePhase = generated.configure;

  installPhase = ''
    runHook preInstall

    binPath="$(swiftpmBinPath)"
    install -D $binPath/xcodes $out/bin/xcodes
    wrapProgram $out/bin/xcodes \
      --prefix PATH : ${lib.makeBinPath [ aria2 ]}

    runHook postInstall
  '';

  meta = with lib; {
    changelog = "https://github.com/XcodesOrg/xcodes/releases/tag/${finalAttrs.version}";
    description = "Command-line tool to install and switch between multiple versions of Xcode";
    homepage = "https://github.com/XcodesOrg/xcodes";
    license = with licenses; [
      mit
      # unxip
      lgpl3Only
    ];
    maintainers = with maintainers; [ _0x120581f emilytrau ];
    platforms = platforms.darwin;
  };
})