summary refs log tree commit diff
path: root/pkgs/build-support/fetchadc/default.nix
blob: 4d759e6f7f18617a96d37be23e02174b900fdd40 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{ stdenv, curl, adc_user, adc_pass }:

{ # 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;
}