lol

A simple ADC downloader for upcoming darwin awesomeness

Closes #4327

authored by

Daniel Peebles and committed by
Mateusz Kowalczyk
0e9cf136 d815b900

+57
+7
pkgs/build-support/fetchadc/builder.sh
··· 1 + source $stdenv/setup 2 + 3 + loginpage=`curl --insecure -s -L -b cookies.txt "$url"` 4 + 5 + [[ $loginpage =~ form[^\>]+action=\"([^\"]+)\" ]] && loginurl=${BASH_REMATCH[1]} 6 + 7 + curl --insecure -s --output "$out" -L -b cookies.txt --data "appleId=${adc_user}&accountPassword=${adc_pass}" "https://idmsa.apple.com/IDMSWebAuth/${loginurl}"
+45
pkgs/build-support/fetchadc/default.nix
··· 1 + { stdenv, curl, adc_user, adc_pass }: 2 + 3 + let 4 + impureEnvVars = [ 5 + # We borrow these environment variables from the caller to allow 6 + # easy proxy configuration. This is impure, but a fixed-output 7 + # derivation like fetchurl is allowed to do so since its result is 8 + # by definition pure. 9 + "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy" 10 + ]; 11 + in 12 + 13 + { # URL to fetch. 14 + url 15 + 16 + # Hash of the downloaded file 17 + , sha256 18 + 19 + , # Additional curl options needed for the download to succeed. 20 + curlOpts ? "" 21 + 22 + , # Name of the file. If empty, use the basename of `url' (or of the 23 + # first element of `urls'). 24 + name ? "" 25 + }: 26 + 27 + stdenv.mkDerivation { 28 + name = if name != "" then name else baseNameOf (toString url); 29 + builder = ./builder.sh; 30 + 31 + buildInputs = [ curl ]; 32 + 33 + meta = { 34 + # Password-guarded files from ADC are certainly unfree, as far as we're concerned! 35 + license = stdenv.lib.licenses.unfree; 36 + }; 37 + 38 + outputHashAlgo = "sha256"; 39 + outputHash = sha256; 40 + outputHashMode = "flat"; 41 + 42 + inherit curlOpts url adc_user adc_pass; 43 + 44 + preferLocalBuild = true; 45 + }
+5
pkgs/top-level/all-packages.nix
··· 283 283 vs = vs90wrapper; 284 284 }; 285 285 286 + fetchadc = import ../build-support/fetchadc { 287 + inherit curl stdenv; 288 + inherit (config) adc_user adc_pass; 289 + }; 290 + 286 291 fetchbower = import ../build-support/fetchbower { 287 292 inherit stdenv git; 288 293 inherit (nodePackages) fetch-bower;