diff options
Diffstat (limited to 'pkgs/development/beam-modules/fetch-mix-deps.nix')
-rw-r--r-- | pkgs/development/beam-modules/fetch-mix-deps.nix | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/pkgs/development/beam-modules/fetch-mix-deps.nix b/pkgs/development/beam-modules/fetch-mix-deps.nix index 020a82ad70b7..73365bd1a93e 100644 --- a/pkgs/development/beam-modules/fetch-mix-deps.nix +++ b/pkgs/development/beam-modules/fetch-mix-deps.nix @@ -1,34 +1,49 @@ { stdenvNoCC, lib, elixir, hex, rebar, rebar3, cacert, git }: -{ name, version, sha256, src, mixEnv ? "prod", debug ? false, meta ? { } }: - -stdenvNoCC.mkDerivation ({ - name = "mix-deps-${name}-${version}"; - +{ pname +, version +, sha256 +, src +, mixEnv ? "prod" +, debug ? false +, meta ? { } +, ... +}@attrs: + +stdenvNoCC.mkDerivation (attrs // { nativeBuildInputs = [ elixir hex cacert git ]; - inherit src; - MIX_ENV = mixEnv; MIX_DEBUG = if debug then 1 else 0; DEBUG = if debug then 1 else 0; # for rebar3 - - configurePhase = '' + # the api with `mix local.rebar rebar path` makes a copy of the binary + MIX_REBAR = "${rebar}/bin/rebar"; + MIX_REBAR3 = "${rebar3}/bin/rebar3"; + # there is a persistent download failure with absinthe 1.6.3 + # those defaults reduce the failure rate + HEX_HTTP_CONCURRENCY = 1; + HEX_HTTP_TIMEOUT = 120; + + configurePhase = attrs.configurePhase or '' + runHook preConfigure export HEX_HOME="$TEMPDIR/.hex"; export MIX_HOME="$TEMPDIR/.mix"; - export MIX_DEPS_PATH="$out"; + export MIX_DEPS_PATH="$TEMPDIR/deps"; # 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" + runHook postConfigure ''; dontBuild = true; - installPhase = '' + installPhase = attrs.installPhase or '' + runHook preInstall mix deps.get --only ${mixEnv} + find "$TEMPDIR/deps" -path '*/.git/*' -a ! -name HEAD -exec rm -rf {} + + cp -r --no-preserve=mode,ownership,timestamps $TEMPDIR/deps $out + runHook postInstall ''; outputHashAlgo = "sha256"; |