about summary refs log tree commit diff
path: root/pkgs/build-support/rust/fetchcargo.nix
blob: 518420002622afe67c940bb93d615eb1c00f147c (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
{ stdenv, cacert, git, cargo, rustRegistry }:
{ name ? "cargo-deps", src, srcs, sourceRoot, sha256, cargoUpdateHook ? "" }:

stdenv.mkDerivation {
  name = "${name}-fetch";
  buildInputs = [ cargo git ];
  inherit src srcs sourceRoot rustRegistry cargoUpdateHook;

  phases = "unpackPhase installPhase";

  installPhase = ''
    source ${./fetch-cargo-deps}

    export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt

    fetchCargoDeps . "$out"
  '';

  outputHashAlgo = "sha256";
  outputHashMode = "recursive";
  outputHash = sha256;

  impureEnvVars = [ "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy" ];
  preferLocalBuild = true;
}