aboutsummaryrefslogtreecommitdiff
path: root/fetch.nix
blob: 78cbf9a1bc3dd707204b60bb0e446f9ea0fa677c (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
37
38
39
40
41
{ bash
, coreutils
, writeTextFile
, unzip
, ...
}:

let fetch = rec {

  tar = builtins.fetchTarball;
  url = builtins.fetchurl;

  zip =
    { url
    , sha256
    , name ? "unnamed-zipfile"
    }@x:

    builtins.trace x

    derivation rec {
      inherit name;

      src = fetch.url x.url;

      buildScript = writeTextFile {
        name = "${name}.zip-downloader";
        executable = true;

        text = ''
          ${coreutils}/bin/mkdir -p $out
          ${unzip}/bin/unzip -d $out $src
        '';
      };

      builder = "${bash}/bin/bash";
      args = [ "-e" buildScript ];
      system = builtins.currentSystem;
    };

}; in fetch