2014-10-04 19:52:39 +01:00
|
|
|
{ stdenv, fetchadc, xar, gzip, cpio }:
|
2014-10-02 02:57:27 +01:00
|
|
|
|
|
|
|
let
|
2014-10-04 19:52:39 +01:00
|
|
|
name = "command-line-tools-mac-os-10.9";
|
2014-10-02 02:57:27 +01:00
|
|
|
|
2014-10-04 19:52:39 +01:00
|
|
|
pkg = { installPhase }: stdenv.mkDerivation {
|
|
|
|
name = "${name}.pkg";
|
|
|
|
|
|
|
|
phases = [ "installPhase" ];
|
|
|
|
|
|
|
|
inherit installPhase;
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Developer tools .pkg file";
|
|
|
|
maintainers = with maintainers; [ copumpkin ];
|
|
|
|
platforms = platforms.darwin;
|
|
|
|
license = licenses.unfree;
|
2014-10-02 02:57:27 +01:00
|
|
|
};
|
2014-10-04 19:52:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
basic = pkg: stdenv.mkDerivation {
|
|
|
|
inherit name;
|
2014-10-02 02:57:27 +01:00
|
|
|
|
|
|
|
phases = [ "unpackPhase" "installPhase" ];
|
|
|
|
|
2014-10-04 19:52:39 +01:00
|
|
|
outputs = [ "sdk" "tools" ];
|
2014-10-02 02:57:27 +01:00
|
|
|
|
|
|
|
unpackPhase = ''
|
2014-10-04 19:52:39 +01:00
|
|
|
${xar}/bin/xar -x -f "${pkg}"
|
2014-10-02 02:57:27 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2014-10-04 19:52:39 +01:00
|
|
|
start="$(pwd)"
|
|
|
|
mkdir -p $sdk
|
|
|
|
mkdir -p $tools
|
|
|
|
|
|
|
|
cd $sdk
|
|
|
|
cat $start/DevSDK_OSX109.pkg/Payload | ${gzip}/bin/gzip -d | ${cpio}/bin/cpio -idm
|
|
|
|
|
|
|
|
cd $tools
|
|
|
|
cat $start/CLTools_Executables.pkg/Payload | ${gzip}/bin/gzip -d | ${cpio}/bin/cpio -idm
|
2014-10-02 02:57:27 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2014-10-04 19:52:39 +01:00
|
|
|
description = "Mac OS command-line developer tools and SDK";
|
2014-10-02 02:57:27 +01:00
|
|
|
maintainers = with maintainers; [ copumpkin ];
|
|
|
|
platforms = platforms.darwin;
|
|
|
|
license = licenses.unfree;
|
|
|
|
};
|
|
|
|
};
|
2014-10-04 19:52:39 +01:00
|
|
|
in rec {
|
|
|
|
dmg = fetchadc {
|
|
|
|
# Isn't this a beautiful path? Note the subtle differences before and after the slash!
|
|
|
|
path = "Developer_Tools/command_line_tools_os_x_10.9_for_xcode__xcode_6/command_line_tools_for_os_x_10.9_for_xcode_6.dmg";
|
|
|
|
sha256 = "0zrpf73r3kfk9pdh6p6j6w1sbw7s2pp0f8rd83660r5hk1y3j5jc";
|
|
|
|
};
|
|
|
|
|
|
|
|
pure = { xpwn }: basic (pkg {
|
|
|
|
installPhase = ''
|
|
|
|
${xpwn}/bin/hdutil ${dmg} extract "Command Line Tools (OS X 10.9).pkg" $out
|
|
|
|
'';
|
|
|
|
});
|
|
|
|
|
|
|
|
impure = basic (pkg {
|
|
|
|
installPhase = ''
|
|
|
|
/usr/bin/hdiutil attach ${dmg} -mountpoint clt-mount -nobrowse
|
|
|
|
cp "clt-mount/Command Line Tools (OS X 10.9).pkg" $out
|
|
|
|
/usr/bin/hdiutil unmount clt-mount
|
|
|
|
'';
|
|
|
|
});
|
2014-10-02 02:57:27 +01:00
|
|
|
}
|