Add Apple command-line tools

Closes #4365

authored by Daniel Peebles and committed by Mateusz Kowalczyk c55c435a 59418454

+107 -9
+8 -7
pkgs/build-support/fetchadc/default.nix
··· 10 10 ]; 11 11 in 12 12 13 - { # URL to fetch. 14 - url 13 + { # Path to fetch. 14 + path 15 15 16 16 # Hash of the downloaded file 17 17 , sha256 ··· 19 19 , # Additional curl options needed for the download to succeed. 20 20 curlOpts ? "" 21 21 22 - , # Name of the file. If empty, use the basename of `url' (or of the 23 - # first element of `urls'). 22 + , # Name of the file. If empty, use the basename of `path'. 24 23 name ? "" 25 24 }: 26 25 27 26 stdenv.mkDerivation { 28 - name = if name != "" then name else baseNameOf (toString url); 27 + url = "https://developer.apple.com/downloads/download.action?path=${path}"; 28 + 29 + name = if name != "" then name else baseNameOf path; 29 30 builder = ./builder.sh; 30 31 31 32 buildInputs = [ curl ]; ··· 39 40 outputHash = sha256; 40 41 outputHashMode = "flat"; 41 42 42 - inherit curlOpts url adc_user adc_pass; 43 + inherit curlOpts adc_user adc_pass; 43 44 44 45 preferLocalBuild = true; 45 - } 46 + }
+37
pkgs/os-specific/darwin/command-line-tools/default.nix
··· 1 + { stdenv, callPackage, fetchadc, xpwn, xar, gzip, cpio }: 2 + 3 + let 4 + cmdline_packages = stdenv.mkDerivation { 5 + name = "osx-10.9-command-line-tools-packages"; 6 + 7 + src = fetchadc { 8 + # Isn't this a beautiful path? Note the subtle differences before and after the slash! 9 + 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"; 10 + sha256 = "0zrpf73r3kfk9pdh6p6j6w1sbw7s2pp0f8rd83660r5hk1y3j5jc"; 11 + }; 12 + 13 + phases = [ "unpackPhase" "installPhase" ]; 14 + 15 + outputs = [ "devsdk" "cltools" ]; 16 + 17 + unpackPhase = '' 18 + ${xpwn}/bin/hdutil $src extract "Command Line Tools (OS X 10.9).pkg" "Command Line Tools (OS X 10.9).pkg" 19 + ${xar}/bin/xar -x -f "Command Line Tools (OS X 10.9).pkg" 20 + ''; 21 + 22 + installPhase = '' 23 + cp -r DevSDK_OSX109.pkg/ $devsdk 24 + cp -r CLTools_Executables.pkg/ $cltools 25 + ''; 26 + 27 + meta = with stdenv.lib; { 28 + description = "Basis for the Mac OS command-line tools package"; 29 + maintainers = with maintainers; [ copumpkin ]; 30 + platforms = platforms.darwin; 31 + license = licenses.unfree; 32 + }; 33 + }; 34 + in { 35 + sdk = callPackage ./sdk.nix { inherit cmdline_packages; }; 36 + tools = callPackage ./tools.nix { inherit cmdline_packages; }; 37 + }
+25
pkgs/os-specific/darwin/command-line-tools/sdk.nix
··· 1 + { stdenv, cpio, gzip, cmdline_packages }: 2 + 3 + stdenv.mkDerivation { 4 + name = "osx-command-line-sdk-10.9"; 5 + src = cmdline_packages.devsdk; 6 + 7 + phases = [ "unpackPhase" "installPhase" "fixupPhase" ]; 8 + 9 + unpackPhase = '' 10 + cat $src/Payload | ${gzip}/bin/gzip -d | ${cpio}/bin/cpio -idm 11 + ''; 12 + 13 + installPhase = '' 14 + mkdir -p $out 15 + cp -r System $out 16 + cp -r usr/* $out 17 + ''; 18 + 19 + meta = with stdenv.lib; { 20 + description = "Apple command-line tools SDK (headers and man pages)"; 21 + maintainers = with maintainers; [ copumpkin ]; 22 + platforms = platforms.darwin; 23 + license = licenses.unfree; 24 + }; 25 + }
+25
pkgs/os-specific/darwin/command-line-tools/tools.nix
··· 1 + { stdenv, cpio, gzip, cmdline_packages }: 2 + 3 + stdenv.mkDerivation { 4 + name = "osx-command-line-sdk-10.9"; 5 + src = cmdline_packages.cltools; 6 + 7 + phases = [ "unpackPhase" "installPhase" "fixupPhase" ]; 8 + 9 + unpackPhase = '' 10 + cat $src/Payload | ${gzip}/bin/gzip -d | ${cpio}/bin/cpio -idm 11 + ''; 12 + 13 + installPhase = '' 14 + mkdir -p $out 15 + cp -r Library/Developer/CommandLineTools/Library $out 16 + cp -r Library/Developer/CommandLineTools/usr/* $out 17 + ''; 18 + 19 + meta = with stdenv.lib; { 20 + description = "Apple command-line developer tools"; 21 + maintainers = with maintainers; [ copumpkin ]; 22 + platforms = platforms.darwin; 23 + license = licenses.unfree; 24 + }; 25 + }
+12 -2
pkgs/top-level/all-packages.nix
··· 285 285 286 286 fetchadc = import ../build-support/fetchadc { 287 287 inherit curl stdenv; 288 - inherit (config) adc_user adc_pass; 288 + adc_user = if config ? adc_user 289 + then config.adc_user 290 + else throw "You need an adc_user attribute in your config to download files from Apple Developer Connection"; 291 + adc_pass = if config ? adc_pass 292 + then config.adc_pass 293 + else throw "You need an adc_pass attribute in your config to download files from Apple Developer Connection"; 289 294 }; 290 295 291 296 fetchbower = import ../build-support/fetchbower { ··· 7550 7555 7551 7556 cramfsswap = callPackage ../os-specific/linux/cramfsswap { }; 7552 7557 7553 - darwin = rec { 7558 + darwin = let 7559 + cmdline = callPackage ../os-specific/darwin/command-line-tools {}; 7560 + in rec { 7554 7561 cctools = forceNativeDrv (callPackage ../os-specific/darwin/cctools-port { 7555 7562 cross = assert crossSystem != null; crossSystem; 7556 7563 inherit maloader; ··· 7569 7576 osx_private_sdk = callPackage ../os-specific/darwin/osx-private-sdk { inherit osx_sdk; }; 7570 7577 7571 7578 security_tool = callPackage ../os-specific/darwin/security-tool { inherit osx_private_sdk; }; 7579 + 7580 + cmdline_sdk = cmdline.sdk; 7581 + cmdline_tools = cmdline.tools; 7572 7582 }; 7573 7583 7574 7584 devicemapper = lvm2;