diff options
Diffstat (limited to 'pkgs/build-support/fetchadc/default.nix')
-rw-r--r-- | pkgs/build-support/fetchadc/default.nix | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/pkgs/build-support/fetchadc/default.nix b/pkgs/build-support/fetchadc/default.nix new file mode 100644 index 00000000000..ac7a442de31 --- /dev/null +++ b/pkgs/build-support/fetchadc/default.nix @@ -0,0 +1,46 @@ +{ stdenv, curl, adc_user, adc_pass }: + +let + impureEnvVars = [ + # We borrow these environment variables from the caller to allow + # easy proxy configuration. This is impure, but a fixed-output + # derivation like fetchurl is allowed to do so since its result is + # by definition pure. + "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy" + ]; +in + +{ # Path to fetch. + path + + # Hash of the downloaded file +, sha256 + +, # Additional curl options needed for the download to succeed. + curlOpts ? "" + +, # Name of the file. If empty, use the basename of `path'. + name ? "" +}: + +stdenv.mkDerivation { + url = "https://developer.apple.com/downloads/download.action?path=${path}"; + + name = if name != "" then name else baseNameOf path; + builder = ./builder.sh; + + buildInputs = [ curl ]; + + meta = { + # Password-guarded files from ADC are certainly unfree, as far as we're concerned! + license = stdenv.lib.licenses.unfree; + }; + + outputHashAlgo = "sha256"; + outputHash = sha256; + outputHashMode = "flat"; + + inherit curlOpts adc_user adc_pass; + + preferLocalBuild = true; +} |