1{
2 lib,
3 fetchFromGitHub,
4 swiftPackages,
5 swift,
6 swiftpm,
7 swiftpm2nix,
8 makeWrapper,
9 aria2,
10}:
11let
12 generated = swiftpm2nix.helpers ./generated;
13 stdenv = swiftPackages.stdenv;
14in
15stdenv.mkDerivation (finalAttrs: {
16 pname = "xcodes";
17 version = "1.6.0";
18
19 src = fetchFromGitHub {
20 owner = "XcodesOrg";
21 repo = "xcodes";
22 rev = finalAttrs.version;
23 hash = "sha256-TwPfASRU98rifyA/mINFfoY0MbbwmAh8JneVpJa38CA=";
24 };
25
26 nativeBuildInputs = [
27 swift
28 swiftpm
29 makeWrapper
30 ];
31
32 configurePhase = generated.configure;
33
34 installPhase = ''
35 runHook preInstall
36
37 binPath="$(swiftpmBinPath)"
38 install -D $binPath/xcodes $out/bin/xcodes
39 wrapProgram $out/bin/xcodes \
40 --prefix PATH : ${lib.makeBinPath [ aria2 ]}
41
42 runHook postInstall
43 '';
44
45 meta = {
46 changelog = "https://github.com/XcodesOrg/xcodes/releases/tag/${finalAttrs.version}";
47 description = "Command-line tool to install and switch between multiple versions of Xcode";
48 homepage = "https://github.com/XcodesOrg/xcodes";
49 license = with lib.licenses; [
50 mit
51 # unxip
52 lgpl3Only
53 ];
54 maintainers = with lib.maintainers; [
55 _0x120581f
56 emilytrau
57 ];
58 platforms = lib.platforms.darwin;
59 };
60})