summary refs log tree commit diff
path: root/pkgs/development/beam-modules/fetch-rebar-deps.nix
blob: 389e07beca6c4f069b94bd2102ddee60f0c1004e (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
{ stdenv, rebar3 }:

{ name, version, sha256, src
, meta ? {}
}:

with stdenv.lib;

stdenv.mkDerivation ({
  name = "rebar-deps-${name}-${version}";

  phases = [ "downloadPhase" "installPhase" ];

  downloadPhase = ''
    cp ${src} .
    HOME='.' DEBUG=1 ${rebar3}/bin/rebar3 get-deps
  '';

  installPhase = ''
    mkdir -p "$out/_checkouts"
    for i in ./_build/default/lib/* ; do
       echo "$i"
       cp -R "$i" "$out/_checkouts"
    done
  '';

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

  impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
  inherit meta;
})