2021-02-01 00:58:51 +00:00
|
|
|
{ stdenvNoCC, lib, elixir, hex, rebar, rebar3, cacert, git }:
|
2020-12-23 04:16:44 +00:00
|
|
|
|
|
|
|
{ name, version, sha256, src, mixEnv ? "prod", debug ? false, meta ? { } }:
|
|
|
|
|
|
|
|
stdenvNoCC.mkDerivation ({
|
|
|
|
name = "mix-deps-${name}-${version}";
|
|
|
|
|
2020-12-31 03:27:08 +00:00
|
|
|
nativeBuildInputs = [ elixir hex cacert git ];
|
2020-12-23 04:16:44 +00:00
|
|
|
|
|
|
|
inherit src;
|
|
|
|
|
|
|
|
MIX_ENV = mixEnv;
|
|
|
|
MIX_DEBUG = if debug then 1 else 0;
|
2021-01-10 08:46:10 +00:00
|
|
|
DEBUG = if debug then 1 else 0; # for rebar3
|
2020-12-23 04:16:44 +00:00
|
|
|
|
|
|
|
configurePhase = ''
|
2021-01-03 03:09:49 +00:00
|
|
|
export HEX_HOME="$TEMPDIR/.hex";
|
2020-12-23 04:16:44 +00:00
|
|
|
export MIX_HOME="$TEMPDIR/.mix";
|
2021-01-10 08:46:10 +00:00
|
|
|
export MIX_DEPS_PATH="$out";
|
|
|
|
|
|
|
|
# Rebar
|
|
|
|
mix local.rebar rebar "${rebar}/bin/rebar"
|
|
|
|
mix local.rebar rebar3 "${rebar3}/bin/rebar3"
|
|
|
|
export REBAR_GLOBAL_CONFIG_DIR="$TMPDIR/rebar3"
|
|
|
|
export REBAR_CACHE_DIR="$TMPDIR/rebar3.cache"
|
2020-12-23 04:16:44 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-01 00:58:51 +00:00
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
2020-12-23 04:16:44 +00:00
|
|
|
mix deps.get --only ${mixEnv}
|
|
|
|
'';
|
|
|
|
|
|
|
|
outputHashAlgo = "sha256";
|
|
|
|
outputHashMode = "recursive";
|
|
|
|
outputHash = sha256;
|
|
|
|
|
2021-02-01 00:58:51 +00:00
|
|
|
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
|
2020-12-23 04:16:44 +00:00
|
|
|
inherit meta;
|
|
|
|
})
|