1 { stdenvNoCC, lib, elixir, hex, rebar, rebar3, cacert, git }@inputs:
12 , elixir ? inputs.elixir
13 , hex ? inputs.hex.override { inherit elixir; }
19 if hash != "" then { outputHashAlgo = null; outputHash = hash; }
20 else if sha256 != "" then { outputHashAlgo = "sha256"; outputHash = sha256; }
21 else { outputHashAlgo = "sha256"; outputHash = lib.fakeSha256; };
23 stdenvNoCC.mkDerivation (attrs // {
24 nativeBuildInputs = [ elixir hex cacert git ];
27 MIX_DEBUG = if debug then 1 else 0;
28 DEBUG = if debug then 1 else 0; # for rebar3
29 # the api with `mix local.rebar rebar path` makes a copy of the binary
30 MIX_REBAR = "${rebar}/bin/rebar";
31 MIX_REBAR3 = "${rebar3}/bin/rebar3";
32 # there is a persistent download failure with absinthe 1.6.3
33 # those defaults reduce the failure rate
34 HEX_HTTP_CONCURRENCY = 1;
35 HEX_HTTP_TIMEOUT = 120;
37 configurePhase = attrs.configurePhase or ''
39 export HEX_HOME="$TEMPDIR/.hex";
40 export MIX_HOME="$TEMPDIR/.mix";
41 export MIX_DEPS_PATH="$TEMPDIR/deps";
44 export REBAR_GLOBAL_CONFIG_DIR="$TMPDIR/rebar3"
45 export REBAR_CACHE_DIR="$TMPDIR/rebar3.cache"
53 installPhase = attrs.installPhase or ''
55 mix deps.get ''${MIX_ENV:+--only $MIX_ENV}
56 find "$TEMPDIR/deps" -path '*/.git/*' -a ! -name HEAD -exec rm -rf {} +
57 cp -r --no-preserve=mode,ownership,timestamps $TEMPDIR/deps $out
61 outputHashMode = "recursive";
63 impureEnvVars = lib.fetchers.proxyImpureEnvVars;