summaryrefslogtreecommitdiffstats
path: root/pkgs/build-support/fetchipfs/default.nix
blob: 10da9cf0a0991bebe7a04bc528501dcc7056c65d (plain)
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
42
43
44
45
46
47
48
{
  lib,
  stdenv,
  curl,
}:
lib.fetchers.withNormalizedHash
  {
    hashTypes = [
      "sha1"
      "sha256"
      "sha512"
    ];
  }
  (
    {
      ipfs,
      url ? "",
      curlOpts ? "",
      outputHash,
      outputHashAlgo,
      meta ? { },
      port ? "8080",
      postFetch ? "",
      preferLocalBuild ? true,
    }:
    stdenv.mkDerivation {
      name = ipfs;
      builder = ./builder.sh;
      nativeBuildInputs = [ curl ];

      # New-style output content requirements.
      inherit outputHash outputHashAlgo;
      outputHashMode = "recursive";

      inherit
        curlOpts
        postFetch
        ipfs
        url
        port
        meta
        ;

      # Doing the download on a remote machine just duplicates network
      # traffic, so don't do that.
      inherit preferLocalBuild;
    }
  )