Merge pull request #107440 from happysalada/add_fetch_mix

This commit is contained in:
Jörg Thalheim 2021-02-08 08:21:59 +00:00 committed by GitHub
commit 950ba78ad9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 0 deletions

View file

@ -33,6 +33,7 @@ let
buildRebar3 = callPackage ./build-rebar3.nix {};
buildHex = callPackage ./build-hex.nix {};
buildErlangMk = callPackage ./build-erlang-mk.nix {};
fetchMixDeps = callPackage ./fetch-mix-deps.nix { };
buildMix = callPackage ./build-mix.nix {};
# BEAM-based languages.

View file

@ -0,0 +1,40 @@
{ stdenvNoCC, lib, elixir, hex, rebar, rebar3, cacert, git }:
{ name, version, sha256, src, mixEnv ? "prod", debug ? false, meta ? { } }:
stdenvNoCC.mkDerivation ({
name = "mix-deps-${name}-${version}";
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 = ''
export HEX_HOME="$TEMPDIR/.hex";
export MIX_HOME="$TEMPDIR/.mix";
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"
'';
dontBuild = true;
installPhase = ''
mix deps.get --only ${mixEnv}
'';
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = sha256;
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
inherit meta;
})